Browse Source

HTML export: Allow special colors for each TODO keyword

Wanrong Lin writes:

    Right now in the HTML export the TODO keywords have either
    class="todo", or class="done". That loses all the face properties
    in the original TODO keywords. I think the TODO keywords faces are
    important visual aids to differentiate different types of TODO
    items, so I just wonder whether it is possible to keep the faces
    in the HTML.

This makes sense.  This commit adds, to each TODO keyword, an
additional class named after the keyword.  For example:

  <span class="todo WAITING">WAITING</span>

So each todo keyword gets class "todo" or "done" depending on which
general type it is.  And in addition it gets itself as class.

So go to your CSS file and configure like this:

.todo { font-weight:bold; }
.done { font-weight:bold; }
.TODO { color:red; }
.WAITING { color:orange; }
.DONE { color:green; }

Thanks to Sebastian Rose for the multiple-classes trick.
Carsten Dominik 16 years ago
parent
commit
d8780dbbee
3 changed files with 8 additions and 3 deletions
  1. 3 2
      doc/org.texi
  2. 3 0
      lisp/ChangeLog
  3. 2 1
      lisp/org-exp.el

+ 3 - 2
doc/org.texi

@@ -8109,8 +8109,9 @@ assigns the following special CSS classes to appropriate parts of the
 document - your style specifications may change these, in addition to any of
 document - your style specifications may change these, in addition to any of
 the standard classes like for headlines, tables etc.
 the standard classes like for headlines, tables etc.
 @example
 @example
-.todo              @r{TODO keywords}
+.todo              @r{TODO keywords, all not-done states}
-.done              @r{the DONE keyword}
+.done              @r{the DONE keywords, all stated the count as done}
+WAITING            @r{Each TODO keyword also uses a class named after itself}
 .timestamp         @r{time stamp}
 .timestamp         @r{time stamp}
 .timestamp-kwd     @r{keyword associated with a time stamp, like SCHEDULED}
 .timestamp-kwd     @r{keyword associated with a time stamp, like SCHEDULED}
 .tag               @r{tag in a headline}
 .tag               @r{tag in a headline}

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2009-02-12  Carsten Dominik  <carsten.dominik@gmail.com>
 2009-02-12  Carsten Dominik  <carsten.dominik@gmail.com>
 
 
+	* org-exp.el (org-export-as-html): Add TODO keyword as extra
+	class, so that each keyword can get special colors through CSS.
+
 	* org-clock.el (org-clock-out): Add another nil for the previous
 	* org-clock.el (org-clock-out): Add another nil for the previous
 	state into the call to `org-add-log-setup'.
 	state into the call to `org-add-log-setup'.
 
 

+ 2 - 1
lisp/org-exp.el

@@ -3743,7 +3743,8 @@ lang=\"%s\" xml:lang=\"%s\">
 			    (if (member (match-string 2 line)
 			    (if (member (match-string 2 line)
 					org-done-keywords)
 					org-done-keywords)
 				"done" "todo")
 				"done" "todo")
-			    "\">" (match-string 2 line)
+			    " " (match-string 2 line)
+			    "\"> " (match-string 2 line)
 			    "</span>" (substring line (match-end 2)))))
 			    "</span>" (substring line (match-end 2)))))
 
 
 	  ;; Does this contain a reference to a footnote?
 	  ;; Does this contain a reference to a footnote?