emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: ox-odt.el should support text:start-value [9.1.14 (9.1.14-7-g01c419-elpaplus @ …/org-plus-contrib-20181015/)]
@ 2018-10-18  1:21 Mark A. Hershberger
  0 siblings, 0 replies; 5+ messages in thread
From: Mark A. Hershberger @ 2018-10-18  1:21 UTC (permalink / raw)
  To: emacs-orgmode


I saw that exporting plain lists with specified starting numbers
(‘[@20]') wasn't working—the lists just start over.

I was a bit frustrated with this, so I went looking at the code and the
ODF schema.  I found that ODF supports the text:start-value attribute[1]
that could be used where needed.

I came up with the following hack:

diff -ub ox-odt.el\~ ox-odt.el
--- ox-odt.el~	2018-10-17 16:47:32.859161792 -0400
+++ ox-odt.el	2018-10-17 21:04:46.391759435 -0400
@@ -1966,10 +1966,13 @@
 CONTENTS holds the contents of the item.  INFO is a plist holding
 contextual information."
   (let* ((plain-list (org-export-get-parent item))
+         (count (org-element-property :counter item))
 	 (type (org-element-property :type plain-list)))
     (unless (memq type '(ordered unordered descriptive-1 descriptive-2))
       (error "Unknown list type: %S" type))
-    (format "\n<text:list-item>\n%s\n%s"
+    (format (concat "\n<text:list-item"
+                    (when count (concat " text:start-value=\"" count "\""))
+                    ">\n%s\n%s")
 	    contents
 	    (if (org-element-map item 'table #'identity info 'first-match)
 		"</text:list-header>"

Diff finished.  Wed Oct 17 21:17:59 2018


Emacs  : GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.11, cairo version 1.14.8)
 of 2018-10-17
Package: Org mode version 9.1.14 (9.1.14-7-g01c419-elpaplus @ …/org-plus-contrib-20181015/)


Footnotes:
[1]  http://docs.oasis-open.org/office/v1.2/cs01/OpenDocument-v1.2-cs01-part1.html#a_19_868_3__text_list-item_

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

* Re: Bug: ox-odt.el should support text:start-value [9.1.14 (9.1.14-7-g01c419-elpaplus @ …/org-plus-contrib-20181015/)]
@ 2018-10-18  2:23 Mark A. Hershberger
  2018-10-18 22:19 ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Mark A. Hershberger @ 2018-10-18  2:23 UTC (permalink / raw)
  To: emacs-orgmode

Working code changes:

diff -ub org-plus-contrib-20181008/ox-odt.el\~ org-plus-contrib-20181008/ox-odt.el
--- org-plus-contrib-20181008/ox-odt.el~	2018-10-12 19:13:13.095335320 -0400
+++ org-plus-contrib-20181008/ox-odt.el	2018-10-17 22:10:30.194483160 -0400
@@ -1966,10 +1966,13 @@
 CONTENTS holds the contents of the item.  INFO is a plist holding
 contextual information."
   (let* ((plain-list (org-export-get-parent item))
+         (count (org-element-property :counter item))
 	 (type (org-element-property :type plain-list)))
     (unless (memq type '(ordered unordered descriptive-1 descriptive-2))
       (error "Unknown list type: %S" type))
-    (format "\n<text:list-item>\n%s\n%s"
+    (format (concat "\n<text:list-item"
+                    (when count (concat (format " text:start-value=\"%s\"" count)))
+                    ">\n%s\n%s")
 	    contents
 	    (if (org-element-map item 'table #'identity info 'first-match)
 		"</text:list-header>"

Diff finished.  Wed Oct 17 22:11:23 2018

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

* Re: Bug: ox-odt.el should support text:start-value [9.1.14 (9.1.14-7-g01c419-elpaplus @ …/org-plus-contrib-20181015/)]
  2018-10-18  2:23 Bug: ox-odt.el should support text:start-value [9.1.14 (9.1.14-7-g01c419-elpaplus @ …/org-plus-contrib-20181015/)] Mark A. Hershberger
@ 2018-10-18 22:19 ` Nicolas Goaziou
  2018-10-19 13:45   ` Mark A. Hershberger
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2018-10-18 22:19 UTC (permalink / raw)
  To: Mark A. Hershberger; +Cc: emacs-orgmode

Hello,

"Mark A. Hershberger" <mah@everybody.org> writes:

> Working code changes:
>
> diff -ub org-plus-contrib-20181008/ox-odt.el\~ org-plus-contrib-20181008/ox-odt.el
> --- org-plus-contrib-20181008/ox-odt.el~	2018-10-12 19:13:13.095335320 -0400
> +++ org-plus-contrib-20181008/ox-odt.el	2018-10-17 22:10:30.194483160 -0400
> @@ -1966,10 +1966,13 @@
>  CONTENTS holds the contents of the item.  INFO is a plist holding
>  contextual information."
>    (let* ((plain-list (org-export-get-parent item))
> +         (count (org-element-property :counter item))
>  	 (type (org-element-property :type plain-list)))
>      (unless (memq type '(ordered unordered descriptive-1 descriptive-2))
>        (error "Unknown list type: %S" type))
> -    (format "\n<text:list-item>\n%s\n%s"
> +    (format (concat "\n<text:list-item"
> +                    (when count (concat (format " text:start-value=\"%s\"" count)))
> +                    ">\n%s\n%s")
>  	    contents
>  	    (if (org-element-map item 'table #'identity info 'first-match)
>  		"</text:list-header>"

Thank you.

Could you provide a patch using git format-patch, with a proper commit
message? Also, if you haven't signed FSF papers, please add TINYCHANGE
at the end of the commit message.

Regards,

-- 
Nicolas Goaziou

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

* Re: Bug: ox-odt.el should support text:start-value [9.1.14 (9.1.14-7-g01c419-elpaplus @ …/org-plus-contrib-20181015/)]
  2018-10-18 22:19 ` Nicolas Goaziou
@ 2018-10-19 13:45   ` Mark A. Hershberger
  2018-10-20  8:13     ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Mark A. Hershberger @ 2018-10-19 13:45 UTC (permalink / raw)
  To: emacs-orgmode

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

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Could you provide a patch using git format-patch, with a proper commit
> message?

Attached.  Also see
<https://code.orgmode.org/hexmode/org-mode/commit/91cb08df2473c70b7817c37ae0744e051964ad07>.

> Also, if you haven't signed FSF papers, please add TINYCHANGE at the
> end of the commit message.

I have signed papers on file.

Mark.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-support-for-text-start-value-to-ox-odt.el.patch --]
[-- Type: text/x-diff, Size: 1294 bytes --]

From 91cb08df2473c70b7817c37ae0744e051964ad07 Mon Sep 17 00:00:00 2001
From: "Mark A. Hershberger" <mah@nichework.com>
Date: Fri, 19 Oct 2018 09:19:38 -0400
Subject: [PATCH] Add support for text:start-value to ox-odt.el

ODF supports starting lists at a set number via text:start-value.
Without this, ODF files just restart numbering when they should
continue with the specified number.
---
 lisp/ox-odt.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index 70ef9de2e..b9a81f74d 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -1966,10 +1966,13 @@ contextual information."
 CONTENTS holds the contents of the item.  INFO is a plist holding
 contextual information."
   (let* ((plain-list (org-export-get-parent item))
+	 (count (org-element-property :counter item))
 	 (type (org-element-property :type plain-list)))
     (unless (memq type '(ordered unordered descriptive-1 descriptive-2))
       (error "Unknown list type: %S" type))
-    (format "\n<text:list-item>\n%s\n%s"
+    (format (concat "\n<text:list-item"
+		    (when count (concat (format " text:start-value=\"%s\"" count)))
+		    ">\n%s\n%s")
 	    contents
 	    (if (org-element-map item 'table #'identity info 'first-match)
 		"</text:list-header>"
-- 
2.19.1


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

* Re: Bug: ox-odt.el should support text:start-value [9.1.14 (9.1.14-7-g01c419-elpaplus @ …/org-plus-contrib-20181015/)]
  2018-10-19 13:45   ` Mark A. Hershberger
@ 2018-10-20  8:13     ` Nicolas Goaziou
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Goaziou @ 2018-10-20  8:13 UTC (permalink / raw)
  To: Mark A. Hershberger; +Cc: emacs-orgmode

Hello,

"Mark A. Hershberger" <mah@everybody.org> writes:

> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>
>> Could you provide a patch using git format-patch, with a proper commit
>> message?
>
> Attached.  Also see
> <https://code.orgmode.org/hexmode/org-mode/commit/91cb08df2473c70b7817c37ae0744e051964ad07>.

Applied. Thank you.

>> Also, if you haven't signed FSF papers, please add TINYCHANGE at the
>> end of the commit message.
>
> I have signed papers on file.

Great. I added you to the list of contributors with signed FSF papers.

Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2018-10-20  8:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-18  2:23 Bug: ox-odt.el should support text:start-value [9.1.14 (9.1.14-7-g01c419-elpaplus @ …/org-plus-contrib-20181015/)] Mark A. Hershberger
2018-10-18 22:19 ` Nicolas Goaziou
2018-10-19 13:45   ` Mark A. Hershberger
2018-10-20  8:13     ` Nicolas Goaziou
  -- strict thread matches above, loose matches on Subject: below --
2018-10-18  1:21 Mark A. Hershberger

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