emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Baoqiu Cui <cbaoqiu@yahoo.com>
To: emacs-orgmode@gnu.org
Cc: carsten.dominik@gmail.com
Subject: Re: Renumber HTML ordered lists from org-mode?
Date: Mon, 26 Apr 2010 14:39:12 -0700	[thread overview]
Message-ID: <byc1ve1yjun.fsf@yahoo-inc.com> (raw)
In-Reply-To: 8BD3FCFE-364D-4774-A20C-9502FD313C86@gmail.com

[-- Attachment #1: Type: text/plain, Size: 98 bytes --]

Hi Carsten,

Attached please find the patch to support this new feature in the
DocBook exporter:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: orderedlist-startingnumber.diff --]
[-- Type: text/x-patch, Size: 1851 bytes --]

diff --git a/lisp/org-docbook.el b/lisp/org-docbook.el
index bb8d048..d7ea4b7 100644
--- a/lisp/org-docbook.el
+++ b/lisp/org-docbook.el
@@ -533,7 +533,7 @@ publishing directory."
 	 table-buffer table-orig-buffer
 	 ind item-type starter didclose
 	 rpl path attr caption label desc descp desc1 desc2 link
-	 fnc item-tag
+	 fnc item-tag initial-number
 	 footref-seen footnote-list
 	 id-file
 	 )
@@ -998,7 +998,11 @@ publishing directory."
 		    starter (if (match-beginning 2)
 				(substring (match-string 2 line) 0 -1))
 		    line (substring line (match-beginning 5))
-		    item-tag nil)
+		    item-tag nil
+		    initial-number nil)
+	      (if (string-match "\\`\\[@start:\\([0-9]+\\)\\][ \t]?" line)
+		  (setq initial-number (match-string 1 line)
+			line (replace-match "" t t line)))
 	      (if (and starter (string-match "\\(.*?\\) ::[ \t]*" line))
 		  (setq item-type "d"
 			item-tag (match-string 1 line)
@@ -1031,7 +1035,18 @@ publishing directory."
 		(org-export-docbook-close-para-maybe)
 		(insert (cond
 			 ((equal item-type "u") "<itemizedlist>\n<listitem>\n")
-			 ((equal item-type "o") "<orderedlist>\n<listitem>\n")
+			 ((equal item-type "o")
+			  ;; Check for a specific start number.  If it
+			  ;; is specified, we use the ``override''
+			  ;; attribute of element <listitem> to pass the
+			  ;; info to DocBook.  We could also use the
+			  ;; ``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"))
 			 ((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

[-- Attachment #3: Type: text/plain, Size: 768 bytes --]



Carsten Dominik <carsten.dominik@gmail.com> writes:

> On Feb 11, 2010, at 12:14 AM, Uriel Avalos wrote:
>
>> In HTML, one way of renumbering OL lists is to use "start". (Ex: <ol
>> start=13>...</ol> restarts the numbering at 13.)
>>
>> Is there anyway to do that from within org-mode without hacking the
>> exported HTML file?
>>
>> Is there a +ATTR_HTML:  planned for OL and UL lists?
>
> This has taken a long time.  I have not done an ATTR_, but you
> can now write
>
>    1. [@start:20] item number 20
>
> to have a list start at 20.
>
> Currently this works in Org-mode itself to change the list with
> a different counter, and for the HTML, LaTeX, and ASCII
> exporters.  I hope that it can also be translated for the docbook
> exporter.

Thanks,

-- 
Baoqiu

[-- Attachment #4: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

      reply	other threads:[~2010-04-26 21:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-10 23:14 Renumber HTML ordered lists from org-mode? Uriel Avalos
2010-02-23  6:14 ` Carsten Dominik
2010-04-26 14:36 ` Carsten Dominik
2010-04-26 21:39   ` Baoqiu Cui [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=byc1ve1yjun.fsf@yahoo-inc.com \
    --to=cbaoqiu@yahoo.com \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).