diff options
author | Jens Lechtenboerger <jens.lechtenboerger@fsfe.org> | 2018-12-02 20:25:38 +0100 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2018-12-08 12:45:22 +0100 |
commit | 94d2dbf95fdb711f224ce6870d6b9552cc609414 (patch) | |
tree | cc941f4d34decdb3224658c009e2617365a62624 | |
parent | 1eea78d1a563bc0aae3f613fc89a185307e9b138 (diff) | |
download | org-mode-94d2dbf95fdb711f224ce6870d6b9552cc609414.tar.gz |
ox-html: New property HTML_HEADLINE_CLASS for class of headline
* lisp/ox-html.el (org-html-headline): Add new property
HTML_HEADLINE_CLASS to assign class attribute to headline.
* doc/org-manual.org (CSS support): Document new property
HTML_HEADLINE_CLASS.
-rw-r--r-- | doc/org-manual.org | 4 | ||||
-rw-r--r-- | etc/ORG-NEWS | 3 | ||||
-rw-r--r-- | lisp/ox-html.el | 9 |
3 files changed, 13 insertions, 3 deletions
diff --git a/doc/org-manual.org b/doc/org-manual.org index b5b0713..231315a 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -12813,10 +12813,12 @@ around them. Both of these approaches can avoid referring to an external file. #+cindex: @samp{HTML_CONTAINER_CLASS}, property +#+cindex: @samp{HTML_HEADLINE_CLASS}, property In order to add styles to a sub-tree, use the =HTML_CONTAINER_CLASS= property to assign a class to the tree. In order to specify CSS styles for a particular headline, you can use the ID specified in -a =CUSTOM_ID= property. +a =CUSTOM_ID= property. You can also assign a specific class to +a headline with the =HTML_HEADLINE_CLASS= property. Never change the ~org-html-style-default~ constant. Instead use other simpler ways of customizing as described above. diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 0462447..f9bea4b 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -42,6 +42,9 @@ See [[git:3367ac9457]] for details. ** New features *** Babel **** Add LaTeX output support in PlantUML +*** New property =HTML_HEADLINE_CLASS= in HTML export +The new property =HTML_HEADLINE_CLASS= assigns a class attribute to +a headline. *** Allow LaTeX attributes and captions for "table.el" tables Supported LaTeX attributes are ~:float~, ~:center~, ~:font~ and ~:caption~. diff --git a/lisp/ox-html.el b/lisp/ox-html.el index 6a81be1..7c836f1 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -2607,7 +2607,10 @@ holding contextual information." (and (org-export-last-sibling-p headline info) (format "</%s>\n" html-type)))) ;; Standard headline. Export it as a section. - (let ((extra-class (org-element-property :HTML_CONTAINER_CLASS headline)) + (let ((extra-class + (org-element-property :HTML_CONTAINER_CLASS headline)) + (headline-class + (org-element-property :HTML_HEADLINE_CLASS headline)) (first-content (car (org-element-contents headline)))) (format "<%s id=\"%s\" class=\"%s\">%s%s</%s>\n" (org-html--container headline info) @@ -2616,9 +2619,11 @@ holding contextual information." (concat (format "outline-%d" level) (and extra-class " ") extra-class) - (format "\n<h%d id=\"%s\">%s</h%d>\n" + (format "\n<h%d id=\"%s\"%s>%s</h%d>\n" level id + (if (not headline-class) "" + (format " class=\"%s\"" headline-class)) (concat (and numberedp (format |