Browse Source

Add classes to checkbox list elements.

* lisp/ox-html.el (org-html-format-list-item): Add the appropriate
  class `on', `off' or `trans' (the tri-state checkbox types) to the
  list elements in checkbox lists.
Rick Frankel 5 years ago
parent
commit
8d20a8419f
1 changed files with 6 additions and 5 deletions
  1. 6 5
      lisp/ox-html.el

+ 6 - 5
lisp/ox-html.el

@@ -2486,7 +2486,8 @@ INFO is a plist holding contextual information.  See
 					     &optional term-counter-id
 					     headline)
   "Format a list item into HTML."
-  (let ((checkbox (concat (org-html-checkbox checkbox info)
+  (let ((class (symbol-name checkbox))
+	(checkbox (concat (org-html-checkbox checkbox info)
 			  (and checkbox " ")))
 	(br (org-html-close-tag "br" nil info)))
     (concat
@@ -2495,20 +2496,20 @@ INFO is a plist holding contextual information.  See
 	(let* ((counter term-counter-id)
 	       (extra (if counter (format " value=\"%s\"" counter) "")))
 	  (concat
-	   (format "<li%s>" extra)
+	   (format "<li class=\"%s\"%s>" class extra)
 	   (when headline (concat headline br)))))
        (unordered
 	(let* ((id term-counter-id)
 	       (extra (if id (format " id=\"%s\"" id) "")))
 	  (concat
-	   (format "<li%s>" extra)
+	   (format "<li class=\"%s\"%s>" class extra)
 	   (when headline (concat headline br)))))
        (descriptive
 	(let* ((term term-counter-id))
 	  (setq term (or term "(no term)"))
 	  ;; Check-boxes in descriptive lists are associated to tag.
-	  (concat (format "<dt> %s </dt>"
-			  (concat checkbox term))
+	  (concat (format "<dt class=\"%s\">%s</dt>"
+			  class (concat checkbox term))
 		  "<dd>"))))
      (unless (eq type 'descriptive) checkbox)
      contents