From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nik Clayton Subject: Case sensitivity of special block names in HTML export / class names Date: Mon, 29 Jul 2019 14:52:37 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000008ef196058ed15ec5" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:37338) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hs592-0001n8-Op for emacs-orgmode@gnu.org; Mon, 29 Jul 2019 08:52:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hs591-0001q1-Ov for emacs-orgmode@gnu.org; Mon, 29 Jul 2019 08:52:52 -0400 Received: from mail-io1-xd2f.google.com ([2607:f8b0:4864:20::d2f]:44020) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hs591-0001p2-DQ for emacs-orgmode@gnu.org; Mon, 29 Jul 2019 08:52:51 -0400 Received: by mail-io1-xd2f.google.com with SMTP id k20so119652818ios.10 for ; Mon, 29 Jul 2019 05:52:50 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode --0000000000008ef196058ed15ec5 Content-Type: text/plain; charset="UTF-8" Hoi, Org special block names (within Org) appear to be case-insensitive. That is, I can write either: #+BEGIN_NOTES ... #+END_NOTES or #+begin_notes ... #+end_notes and Org is happy. I think the switch from Org 8 to 9 changed the default templates to insert lower-case blocks instead of upper case blocks, so it's natural now to have files that contain a mix of both cases. This is a problem for HTML export, as they get converted to:
...
or
...
depending on the original case of the special block in the .org file. HTML class element values are case sensitive in non-quirks mode browsers, so this makes existing CSS for content exported by Org fail, as div.NOTES { ... } does not match a
. A quick local fix is: (defun my/downcase-special-block (ohsb special-block contents info) (let ((special-block-copy (org-element-copy special-block))) (org-element-put-property special-block-copy :type (downcase (org-element-property :type special-block))) (funcall ohsb special-block-copy contents info))) (advice-add #'org-html-special-block :around #'my/downcase-special-block) But I wanted to raise this in case there was any interest in a more general solution (perhaps a configuration option to either (a) retain case (current behaviour), (b) convert to lower case, (c) convert to upper case? N --0000000000008ef196058ed15ec5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hoi,

Org special block names= (within Org) appear to be case-insensitive. That is, I can write either:

#+BEGIN_NOTES
...
=
#+END_NOTES

or

<= div style=3D"margin-left:40px">#+begin_notes
...
#+end_notes

and Org is happy. I think the switch from Or= g 8 to 9 changed the default templates to insert lower-case blocks instead = of upper case blocks, so it's natural now to have files that contain a = mix of both cases.

This is a problem for HTML = export, as they get converted to:

<div class= =3D"NOTES">...</div>

or<= /div>

<div class=3D"notes">...</div= >

depending on the original case of the = special block in the .org file. HTML class element values are case sensitiv= e in non-quirks mode browsers, so this makes existing CSS for content expor= ted by Org fail, as

div.NOTES { ... }
=

does not match a <div class=3D"notes">.
<= br>
A quick local fix is:

(defun my/downcase-special-block (ohsb = special-block contents info)
=C2=A0 (let ((special-block-copy (org-eleme= nt-copy special-block)))
=C2=A0 =C2=A0 (org-element-put-property
<= /div>
=C2=A0=C2=A0=C2= =A0=C2=A0 special-block-copy
=C2=A0=C2=A0=C2=A0=C2=A0 :type
=C2=A0 =C2=A0=C2=A0 = (downcase (org-element-property :type special-block)))
=C2=A0 =C2=A0 (fu= ncall ohsb special-block-copy contents info)))

(advice-add #'org= -html-special-block :around
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 #&= #39;my/downcase-special-block)

But I wanted= to raise this in case there was any interest in a more general solution (p= erhaps a configuration option to either (a) retain case (current behaviour)= , (b) convert to lower case, (c) convert to upper case?

N
--0000000000008ef196058ed15ec5--