From: Nik Clayton <nik@ngo.org.uk>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Case sensitivity of special block names in HTML export / class names
Date: Mon, 29 Jul 2019 14:52:37 +0200 [thread overview]
Message-ID: <CAKJTzL7_zeM8wdPHb7xLdWALDTOnWt=gEs2RfiaCWiJBVz=8GA@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1415 bytes --]
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:
<div class="NOTES">...</div>
or
<div class="notes">...</div>
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 <div class="notes">.
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
[-- Attachment #2: Type: text/html, Size: 2959 bytes --]
reply other threads:[~2019-07-29 12:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAKJTzL7_zeM8wdPHb7xLdWALDTOnWt=gEs2RfiaCWiJBVz=8GA@mail.gmail.com' \
--to=nik@ngo.org.uk \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).