From cb23060a460a7474f0762ef3d56dc7ad151879cc Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 28 Jul 2010 19:24:46 +0200 Subject: [PATCH] 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] --- lisp/org-docbook.el | 16 ++++++++-------- lisp/org-html.el | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lisp/org-docbook.el b/lisp/org-docbook.el index ab2dfd6d9..d90d949c8 100644 --- a/lisp/org-docbook.el +++ b/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") "\n\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 to pass the @@ -1063,10 +1063,8 @@ publishing directory." ;; ``startingnumber'' attribute of element ;; , but the former works on both ;; DocBook 5.0 and prior versions. - (if initial-number - (format "\n\n" - initial-number) - "\n\n")) + (format "\n\n" item-number)) + ((equal item-type "o") "\n\n") ((equal item-type "d") (format "\n%s\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 "" item-number)) ((equal listtype "o") "") ((equal listtype "u") "") ((equal listtype "d") (format diff --git a/lisp/org-html.el b/lisp/org-html.el index 60b4b9664..1a5c5eb9b 100644 --- a/lisp/org-html.el +++ b/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") "
    \n
  • \n") - ((equal item-type "o") - (if initial-number - (format "
      \n
    1. \n" initial-number) - "
        \n
      1. \n")) + ((and (equal item-type "o") item-number) + (format "
          \n
        1. \n" item-number)) + ((equal item-type "o") "
            \n
          1. \n") ((equal item-type "d") (format "
            \n
            %s
            \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 "
            %s
            \n" (or item-tag "???"))) + ((and (equal item-type "o") item-number) + (format "
          2. \n" item-number)) (t "
          3. \n"))))) (if (string-match "^[ \t]*\\[\\([X ]\\)\\]" line) (setq line