Browse Source

HTML and DocBook exporters handle multiple uses of [@start:?].

* org-docbook.el (org-export-as-docbook): Use override="num" in any
  listitem matching [@start:num]
* org-html.el (org-export-as-html): Use value="num" in any li matching
  [@start:num]
Nicolas Goaziou 11 years ago
parent
commit
cb23060a46
2 changed files with 16 additions and 16 deletions
  1. 8 8
      lisp/org-docbook.el
  2. 8 8
      lisp/org-html.el

+ 8 - 8
lisp/org-docbook.el

@@ -554,7 +554,7 @@ publishing directory."
 	 table-buffer table-orig-buffer
 	 ind item-type starter
 	 rpl path attr caption label desc descp desc1 desc2 link
-	 fnc item-tag initial-number
+	 fnc item-tag item-number
 	 footref-seen footnote-list
 	 id-file
 	 )
@@ -1023,9 +1023,9 @@ publishing directory."
 				(substring (match-string 2 line) 0 -1))
 		    line (substring line (match-beginning 5))
 		    item-tag nil
-		    initial-number nil)
+		    item-number nil)
 	      (if (string-match "\\`\\[@start:\\([0-9]+\\)\\][ \t]?" line)
-		  (setq initial-number (match-string 1 line)
+		  (setq item-number (match-string 1 line)
 			line (replace-match "" t t line)))
 	      (if (and starter (string-match "\\(.*?\\) ::[ \t]*" line))
 		  (setq item-type "d"
@@ -1055,7 +1055,7 @@ publishing directory."
 		(org-export-docbook-close-para-maybe)
 		(insert (cond
 			 ((equal item-type "u") "<itemizedlist>\n<listitem>\n")
-			 ((equal item-type "o")
+			 ((and (equal item-type "o") item-number)
 			  ;; Check for a specific start number.  If it
 			  ;; is specified, we use the ``override''
 			  ;; attribute of element <listitem> to pass the
@@ -1063,10 +1063,8 @@ publishing directory."
 			  ;; ``startingnumber'' attribute of element
 			  ;; <orderedlist>, but the former works on both
 			  ;; DocBook 5.0 and prior versions.
-			  (if initial-number
-			      (format "<orderedlist>\n<listitem override=\"%s\">\n"
-				      initial-number)
-			    "<orderedlist>\n<listitem>\n"))
+			  (format "<orderedlist>\n<listitem override=\"%s\">\n" item-number))
+			 ((equal item-type "o") "<orderedlist>\n<listitem>\n")
 			 ((equal item-type "d")
 			  (format "<variablelist>\n<varlistentry><term>%s</term><listitem>\n" item-tag))))
 		;; For DocBook, we need to open a para right after tag
@@ -1080,6 +1078,8 @@ publishing directory."
 		(let ((listtype (car local-list-type)))
 		  (org-export-docbook-close-li listtype)
 		  (insert (cond
+			   ((and (equal listtype "o") item-number)
+			    (format "<listitem override=\"%s\">" item-number))
 			   ((equal listtype "o") "<listitem>")
 			   ((equal listtype "u") "<listitem>")
 			   ((equal listtype "d") (format

+ 8 - 8
lisp/org-html.el

@@ -962,7 +962,7 @@ PUB-DIR is set, use this as the publishing directory."
 	 table-buffer table-orig-buffer
 	 ind item-type starter
 	 rpl path attr desc descp desc1 desc2 link
-	 snumber fnc item-tag initial-number
+	 snumber fnc item-tag item-number
 	 footnotes footref-seen
 	 id-file href
 	 )
@@ -1546,10 +1546,10 @@ lang=\"%s\" xml:lang=\"%s\">
 		    starter (if (match-beginning 2)
 				(substring (match-string 2 line) 0 -1))
 		    line (substring line (match-beginning 5))
-		    initial-number nil
+		    item-number nil
 		    item-tag nil)
 	      (if (string-match "\\`\\[@start:\\([0-9]+\\)\\][ \t]?" line)
-		  (setq initial-number (match-string 1 line)
+		  (setq item-number (match-string 1 line)
 			line (replace-match "" t t line)))
 	      (if (and starter (string-match "\\(.*?\\) ::[ \t]*" line))
 		  (setq item-type "d"
@@ -1571,15 +1571,13 @@ lang=\"%s\" xml:lang=\"%s\">
 	       ((and starter
 		     (or (not in-local-list)
 			 (> ind (car local-list-indent))))
-		;; check for a specified start number
 		;; Start new (level of) list
 		(org-close-par-maybe)
 		(insert (cond
 			 ((equal item-type "u") "<ul>\n<li>\n")
-			 ((equal item-type "o")
-			  (if initial-number
-			      (format "<ol start=%s>\n<li>\n" initial-number)
-			    "<ol>\n<li>\n"))
+			 ((and (equal item-type "o") item-number)
+			  (format "<ol>\n<li value=\"%s\">\n" item-number))
+			 ((equal item-type "o") "<ol>\n<li>\n")
 			 ((equal item-type "d")
 			  (format "<dl>\n<dt>%s</dt><dd>\n" item-tag))))
 		(push item-type local-list-type)
@@ -1591,6 +1589,8 @@ lang=\"%s\" xml:lang=\"%s\">
 		(insert (cond
 			 ((equal (car local-list-type) "d")
 			  (format "<dt>%s</dt><dd>\n" (or item-tag "???")))
+			 ((and (equal item-type "o") item-number)
+			  (format "<li value=\"%s\">\n" item-number))
 			 (t "<li>\n")))))
 	      (if (string-match "^[ \t]*\\[\\([X ]\\)\\]" line)
 		  (setq line