summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2010-02-01 09:37:35 +0100
committerCarsten Dominik <carsten.dominik@gmail.com>2010-02-01 09:37:35 +0100
commite853e2d7981d022402fe9d9f6dbda8ff182b4dc2 (patch)
treef8fba6c4c4ad2cdeb56419a921a67a1839bde00f
parentdbbf76a8e3174c5b1392ebfa1d6b5c4fd0be5751 (diff)
downloadorg-mode-e853e2d7981d022402fe9d9f6dbda8ff182b4dc2.tar.gz
HTML export: Add class to outline containers using property
The HTML_CONTAINER_CLASS property can now be used to add a property to the outline container of a node.
-rwxr-xr-xlisp/ChangeLog10
-rw-r--r--lisp/org-exp.el14
-rw-r--r--lisp/org-html.el6
-rw-r--r--lisp/org.el2
4 files changed, 29 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3f4edaa..61619bc 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,6 +1,16 @@
2010-02-01 Carsten Dominik <carsten.dominik@gmail.com>
+ * org-html.el (org-html-level-start): Use the
+ `html-container-class' text property to set an additional class
+ for an outline container.
+
+ * org-exp.el (org-export-remember-html-container-classes): New
+ function.
+ (org-export-preprocess-string): Call
+ `org-export-remember-html-container-classes'.
+
* org.el (org-cycle): Mention level cycling in the docstring.
+ (org-default-properties): Add new property HTML_CONTAINER_CLASS.
* org-remember.el (org-remember-apply-template): Do file insertion
first.
diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index 73e9a6c..3b56c3e 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -1362,6 +1362,9 @@ on this string to produce the exported version."
;; Find all headings and compute the targets for them
(setq target-alist (org-export-define-heading-targets target-alist))
+ ;; Find HTML special classes for headlines
+ (org-export-remember-html-container-classes)
+
;; Get rid of drawers
(org-export-remove-or-extract-drawers
drawers (plist-get parameters :drawers) backend)
@@ -1590,6 +1593,17 @@ the current file."
(unless desc (insert "][" link))
(add-text-properties pos (point) props))))))
+(defun org-export-remember-html-container-classes ()
+ "Store the HTML_CONTAINER_CLASS properties in a text property."
+ (goto-char (point-min))
+ (let (class)
+ (while (re-search-forward
+ "^[ \t]*:HTML_CONTAINER_CLASS:[ \t]+\\(\\S-+\\)" nil t)
+ (setq class (match-string 1))
+ (save-excursion
+ (org-back-to-heading t)
+ (put-text-property (point-at-bol) (point-at-eol) 'html-container-class class)))))
+
(defvar org-export-format-drawer-function nil
"Function to be called to format the contents of a drawer.
The function must accept three parameters:
diff --git a/lisp/org-html.el b/lisp/org-html.el
index 768b345..597ecb4 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -2003,6 +2003,7 @@ When TITLE is nil, just close all open levels."
(org-close-par-maybe)
(let* ((target (and title (org-get-text-property-any 0 'target title)))
(extra-targets (assoc target org-export-target-aliases))
+ (extra-class (and title (org-get-text-property-any 0 'html-container-class title)))
(preferred (cdr (assoc target org-export-preferred-target-alist)))
(remove (or preferred target))
(l org-level-max)
@@ -2066,8 +2067,9 @@ When TITLE is nil, just close all open levels."
(setq href (cdr (assoc (concat "sec-" snumber) org-export-preferred-target-alist)))
(setq suffix (or href snumber))
(setq href (or href (concat "sec-" snumber)))
- (insert (format "\n<div id=\"outline-container-%s\" class=\"outline-%d\">\n<h%d id=\"%s\">%s%s</h%d>\n<div class=\"outline-text-%d\" id=\"text-%s\">\n"
- suffix level level href
+ (insert (format "\n<div id=\"outline-container-%s\" class=\"outline-%d%s\">\n<h%d id=\"%s\">%s%s</h%d>\n<div class=\"outline-text-%d\" id=\"text-%s\">\n"
+ suffix level (if extra-class (concat " " extra-class) "")
+ level href
extra-targets
title level level suffix))
(org-open-par)))))
diff --git a/lisp/org.el b/lisp/org.el
index 96aeded..ae734f3 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12383,7 +12383,7 @@ but in some other way.")
"TABLE_EXPORT_FORMAT" "TABLE_EXPORT_FILE"
"EXPORT_FILE_NAME" "EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE"
"ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER"
- "CLOCK_MODELINE_TOTAL" "STYLE")
+ "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS")
"Some properties that are used by Org-mode for various purposes.
Being in this list makes sure that they are offered for completion.")