emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Renumber HTML ordered lists from org-mode?
@ 2010-02-10 23:14 Uriel Avalos
  2010-02-23  6:14 ` Carsten Dominik
  2010-04-26 14:36 ` Carsten Dominik
  0 siblings, 2 replies; 4+ messages in thread
From: Uriel Avalos @ 2010-02-10 23:14 UTC (permalink / raw)
  To: emacs-orgmode

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?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Renumber HTML ordered lists from org-mode?
  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
  1 sibling, 0 replies; 4+ messages in thread
From: Carsten Dominik @ 2010-02-23  6:14 UTC (permalink / raw)
  To: Uriel Avalos; +Cc: emacs-orgmode


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?

That would be nice to have - but we don't have it yet.

A patch would be seriously considered!

- Carsten

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Renumber HTML ordered lists from org-mode?
  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
  1 sibling, 1 reply; 4+ messages in thread
From: Carsten Dominik @ 2010-04-26 14:36 UTC (permalink / raw)
  To: Uriel Avalos; +Cc: emacs-orgmode


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.

- Carsten

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Renumber HTML ordered lists from org-mode?
  2010-04-26 14:36 ` Carsten Dominik
@ 2010-04-26 21:39   ` Baoqiu Cui
  0 siblings, 0 replies; 4+ messages in thread
From: Baoqiu Cui @ 2010-04-26 21:39 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: carsten.dominik

[-- 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-04-26 21:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

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).