* Open Document Exporter @ 2013-06-24 21:29 Georg Lehner 2013-06-25 1:35 ` Vikas Rawal ` (4 more replies) 0 siblings, 5 replies; 10+ messages in thread From: Georg Lehner @ 2013-06-24 21:29 UTC (permalink / raw) To: emacs-orgmode Hello List! I am doing a lot of technical documentation with org-mode - until now primarily with the LaTeX (pdflatex) converter (Version 8.0.3 and git head respectively). Now I have started to use the odt-exporter since my co-workers need something ... compatible. It is working very well for me, however I would like to fine-tune several things: 1. content.xml changed on disk ================== At the end of the export process I get the message: content.xml changed on disk; really edit the buffer? (y, n, r or C-h) Please type y, n or r; or ? for help After typing 'y', I have to reconfirm with 'yes' and then with 'y' again to get a valid export. Any tips how to fix or avoid this? 2. Blank lines after headlines ================= After each headline I get a blank line. Can these be suppressed? I'd like to control the separation between headline and text by styles and not by extra lines. 3. Internal links exporting as numbers ====================== In LaTeX export I have the following behaviour: [[*Headline][Headline]] converts to a Hyperlink to the respective headline with description text 'Headline'. [[*Headline]] converts to the respective headline number In ODT export both convert to the headline number. I believe to have this tracked down to the 'org-odt-link' function in ox-odt.el where the first link form seems to fall through to 'org-odt-link--infer-description'. If the link description differs from the fuzzy link, eg. [[*Headline][ Headline]] then the export happens inside the 'org-odt-link' function and works well - of course LaTeX export then shows the extra space. The code in ox-odt.el seems to be based loosely on ox-latex.el's 'org-latex-link' function, however seems more contrincated. My Lisp skills are far from being able to spot the right place to fix this behavior. Any help is highly appreciated. 4. Description Lists =========== These are exported "HTML"-like similar to: *definition 1* text 1 * definition 2* text 2 Where each definition element is an unnumbered list item without bullet and each text element is an unnumbered sublist item also without bullet. Of course I would like to have the definition lists formatted LaTeX-like: *definition 1*<TAB>and text 1 with hanging indent *definition 2*<TAB>text 2 And have tried to mangle around in the 'org-odt--translate-description-lists' function, however I failed bitterly to get out something useful. I understand that I have to boldface the description (don't know how to do this on the parsed tree) and concatenate somehow the definition text - recursively, because it could have nested text-material. Any hints where to go? 5. Smart-Quotes cannot be disabled ===================== The following patch disables smart-quotes when required so by a ':nil option. The (when ... clause was missing from the original code. --- SparkleShare/jorge/emacs/lib/org-8.0.3/lisp/ox-odt.el 2013-06-24 22:13:27.000000000 +0200 +++ progs/org-mode/lisp/ox-odt.el 2013-06-22 21:53:27.000000000 +0200 @@ -2967,8 +2967,7 @@ (setq output (org-odt--encode-plain-text output t)) ;; Handle smart quotes. Be sure to provide original string since ;; OUTPUT may have been modified. - (when (plist-get info :with-smart-quotes) - (setq output (org-export-activate-smart-quotes output :utf-8 info text))) + (setq output (org-export-activate-smart-quotes output :utf-8 info text)) ;; Convert special strings. (when (plist-get info :with-special-strings) (mapc 6. Table caption does not translate ==================== I have expanded the 'org-export-dictionary' constant with german (and spanisch) translations of all keywords. However my table captions still show the englisch "Table" prefix. With Figures (alias 'Illustrations' in ODT) things work fine. - - - Best Regards, Georg Lehner Please find below the diff to current (yesterdays) ox.el with the translations. diff -u SparkleShare/jorge/emacs/lib/org-8.0.3/lisp/ox.el progs/org-mode/lisp/ox.el --- SparkleShare/jorge/emacs/lib/org-8.0.3/lisp/ox.el 2013-06-22 21:55:54.000000000 +0200 +++ progs/org-mode/lisp/ox.el 2013-06-22 21:40:52.000000000 +0200 @@ -5260,19 +5260,15 @@ ("zh-CN" :html "日期" :utf-8 "日期") ("zh-TW" :html "日期" :utf-8 "日期")) ("Equation" - ("fr" :ascii "Equation" :default "Équation") - ("de" :default "Gleichung") - ("es" :html "Ecuación" :default "Ecuación")) - ("Figure" - ("de" :default "Abbildung") - ("es" :default "Figura")) + ("fr" :ascii "Equation" :default "Équation")) + ("Figure") ("Footnotes" ("ca" :html "Peus de pàgina") ("cs" :default "Pozn\xe1mky pod carou") ("da" :default "Fodnoter") - ("de" :html "Fußnoten" :default "Fußnoten") + ("de" :html "Fußnoten") ("eo" :default "Piednotoj") - ("es" :html "Nota al pie de página" :default "Nota al pie de página") + ("es" :html "Pies de página") ("fi" :default "Alaviitteet") ("fr" :default "Notes de bas de page") ("hu" :html "Lábjegyzet") @@ -5291,41 +5287,26 @@ ("zh-CN" :html "脚注" :utf-8 "脚注") ("zh-TW" :html "腳註" :utf-8 "腳註")) ("List of Listings" - ("fr" :default "Liste des programmes") - ("de" :default "Programmauflistungsverzeichnis") - ("es" :default "Indice de Listados de programas")) + ("fr" :default "Liste des programmes")) ("List of Tables" - ("fr" :default "Liste des tableaux") - ("de" :default "Tabellenverzeichnis") - ("es" :default "Indice de tablas")) + ("fr" :default "Liste des tableaux")) ("Listing %d:" ("fr" :ascii "Programme %d :" :default "Programme nº %d :" - :latin1 "Programme %d :") - ("de" :default "Programmlisting %d") - ("es" :default "Listado de programa %d")) + :latin1 "Programme %d :")) ("Listing %d: %s" ("fr" :ascii "Programme %d : %s" :default "Programme nº %d : %s" - :latin1 "Programme %d : %s") - ("de" :default "Programlisting %d: %s") - ("es" :default "Listado de programa %d: %s") - ) + :latin1 "Programme %d : %s")) ("See section %s" - ("fr" :default "cf. section %s") - ("de" :default "siehe Abschnitt %s") - ("es" :default "vea seccion %s")) + ("fr" :default "cf. section %s")) ("Table %d:" ("fr" - :ascii "Tableau %d :" :default "Tableau nº %d :" :latin1 "Tableau %d :") - ("de" :default "Tabelle %d") - ("es" :default "Tabla %d")) + :ascii "Tableau %d :" :default "Tableau nº %d :" :latin1 "Tableau %d :")) ("Table %d: %s" ("fr" :ascii "Tableau %d : %s" :default "Tableau nº %d : %s" - :latin1 "Tableau %d : %s") - ("de" :default "Tabelle %d: %s") - ("es" :default "Tabla %d: %s")) + :latin1 "Tableau %d : %s")) ("Table of Contents" ("ca" :html "Índex") ("cs" :default "Obsah") @@ -5351,9 +5332,7 @@ ("zh-CN" :html "目录" :utf-8 "目录") ("zh-TW" :html "目錄" :utf-8 "目錄")) ("Unknown reference" - ("fr" :ascii "Destination inconnue" :default "Référence inconnue") - ("de" :default "Unbekannter Verweis") - ("es" :default "referencia desconocida"))) + ("fr" :ascii "Destination inconnue" :default "Référence inconnue"))) "Dictionary for export engine. Alist whose CAR is the string to translate and CDR is an alist ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Open Document Exporter 2013-06-24 21:29 Open Document Exporter Georg Lehner @ 2013-06-25 1:35 ` Vikas Rawal 2013-06-27 0:19 ` Georg Lehner 2013-06-26 9:42 ` Nicolas Goaziou ` (3 subsequent siblings) 4 siblings, 1 reply; 10+ messages in thread From: Vikas Rawal @ 2013-06-25 1:35 UTC (permalink / raw) To: Georg Lehner; +Cc: emacs-orgmode > > At the end of the export process I get the message: > > content.xml changed on disk; really edit the buffer? (y, n, r or C-h) > Please type y, n or r; or ? for help > > After typing 'y', I have to reconfirm with 'yes' and then with 'y' again to > get a valid export. > > Any tips how to fix or avoid this? You perhaps have content.xml open as a buffer in emacs. Close that buffer, and you should be fine. Vikas ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Open Document Exporter 2013-06-25 1:35 ` Vikas Rawal @ 2013-06-27 0:19 ` Georg Lehner 2013-06-27 13:58 ` Bastien 2013-06-29 12:43 ` Jambunathan K 0 siblings, 2 replies; 10+ messages in thread From: Georg Lehner @ 2013-06-27 0:19 UTC (permalink / raw) To: emacs-orgmode On 06/25/2013 03:35 AM, Vikas Rawal wrote: >> At the end of the export process I get the message: >> >> content.xml changed on disk; really edit the buffer? (y, n, r or C-h) >> Please type y, n or r; or ? for help >> >> After typing 'y', I have to reconfirm with 'yes' and then with 'y' again to >> get a valid export. >> >> Any tips how to fix or avoid this? > You perhaps have content.xml open as a buffer in emacs. Close that > buffer, and you should be fine. > > Vikas The content.xml buffer gets created and modified by the exporter. I have found at least one (and the more annoying) place in ox-odt.el, where this happens. Using the 'write-file function Instead of (save-buffer 0) resolved the issue. In the patch below there are the following "fixes" for ox-odt.el: 1. content.xml changed on disk message avoided ============================= see: @@ -4092,7 +4111,9 @@ 2. Internal cross references ================ By replacing 'OrgXref.' with '__RefHeading__' has prefix of internal link labels, the cross references show the target Heading Line when the mouse hovers over them. The patch is rather brute force, but e.g. table captions and references still show the "original" behavior: The reference shows "Table" and the caption shows the Table number when hovering over them. By replacing: text:reference-format=\"chapter\" with text:reference-format=\"number\" cross references show the real chapter number, not the internal numbering. This is e.g. different, when you decide to change the outline numbering properties "Before" and "After" from their defaults. While looking at that I found out that some 'bookmarks' get generated twice by the exporter: once as "OrgXref.sec-n-m" and once as "sec-n-m", with n and m beeing the chapter and section numbers. 3. Search path for contributed style files ======================= @@ -157,7 +157,7 @@ the search path for "git" based org-mode installations had one parent directory level too much (../). 4. LaTeX like definition lists ================ The rest of the patch deals with trying to make definition lists - term :: definition look as in LaTex and not as in HTML. Caution! the patch is very quirky, it does not work with nested lists at all. It works fine with simple, short definitions though. How to use it: - create a text style named 'OrgDefinitionTerm' in your template file. Bold text is sufficient. - create a paragraph style named 'OrgDefinitionItem' in your template file. I made mine having a hanging indent of 2cm and one (1) tab-stop at 2.1cm. What the patch does: - The 'org-odt--translate-description-lists' filter is removed from the filter stack, so descriptive lists remain just descriptive lists (and do not get split into descriptive-1 and descriptive-2 item pairs. - When transcoding 'descriptive' items to ODT, the term is retrived, typeset in bold, and inserted in front of the 'contents' of the iterm, separated by a tab. - in all "case" constructs where "descriptive-1" and "...-2" occurs, I added "descriptive" too. How *should* it work: I guess the better solution would be to modify the 'org-odt--translate-description-lists' filter in a way to produce the same effect on the parsed tree representation of the document. So nested definition lists would work. Of course a customizable variable, or some per file/per subtree #+ODT tag is needed to switch on demand between the two representations. Best Regards, Georg Lehner - - - diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el index a76f7dd..c8b704c 100644 --- a/lisp/ox-odt.el +++ b/lisp/ox-odt.el @@ -86,7 +86,7 @@ :export-block "ODT" :filters-alist '((:filter-parse-tree . (org-odt--translate-latex-fragments - org-odt--translate-description-lists + ;;org-odt--translate-description-lists org-odt--translate-list-tables))) :menu-entry '(?o "Export to ODT" @@ -157,7 +157,7 @@ and `org-odt-data-dir'.") (eval-when-compile (and (boundp 'org-odt-data-dir) org-odt-data-dir ; see make install (expand-file-name "./styles/" org-odt-data-dir))) - (expand-file-name "../../etc/styles/" org-odt-lib-dir) ; git + (expand-file-name "../etc/styles/" org-odt-lib-dir) ; git (expand-file-name "./etc/styles/" org-odt-lib-dir) ; elpa (expand-file-name "./org/" data-directory) ; system ) @@ -201,7 +201,7 @@ version of org in use and is initialized from from one of: org's own private git repository, GNU ELPA tar or standard Emacs.") -(defconst org-odt-bookmark-prefix "OrgXref.") +(defconst org-odt-bookmark-prefix "__RefHeading__") (defconst org-odt-manifest-file-entry-tag "\n<manifest:file-entry manifest:media-type=\"%s\" manifest:full-path=\"%s\"%s/>") @@ -1064,9 +1064,9 @@ See `org-odt--build-date-styles' for implementation details." (defun org-odt--target (text id) (if (not id) text (concat - (format "\n<text:bookmark-start text:name=\"OrgXref.%s\"/>" id) + (format "\n<text:bookmark-start text:name=\"__RefHeading__%s\"/>" id) (format "\n<text:bookmark text:name=\"%s\"/>" id) text - (format "\n<text:bookmark-end text:name=\"OrgXref.%s\"/>" id)))) + (format "\n<text:bookmark-end text:name=\"__RefHeading__%s\"/>" id)))) ;;;; Textbox @@ -1997,19 +1997,36 @@ contextual information." (concat (org-odt--checkbox item) (org-export-data tag info)))))) (case type - ((ordered unordered descriptive-1 descriptive-2) - (format "\n<text:list-item>\n%s\n%s" - contents - (let* ((--element-has-a-table-p - (function - (lambda (element info) - (loop for el in (org-element-contents element) - thereis (eq (org-element-type el) 'table)))))) - (cond - ((funcall --element-has-a-table-p item info) - "</text:list-header>") - (t "</text:list-item>"))))) - (t (error "Unknown list type: %S" type))))) + ((ordered unordered descriptive-1 descriptive-2 descriptive) + (case type + ((ordered unordered descriptive-1 descriptive-2) + (format "\n<text:list-item>\n%s\n%s" + contents + (let* ((--element-has-a-table-p + (function + (lambda (element info) + (loop for el in (org-element-contents element) + thereis (eq (org-element-type el) 'table)))))) + (cond + ((funcall --element-has-a-table-p item info) + "</text:list-header>") + (t "</text:list-item>"))))) + (descriptive + (format "\n<text:list-item>\n%s\n%s" + (replace-regexp-in-string + "^<text:p ?.*?>" + (format "<text:p text:style-name=\"OrgDefinitionItem\"><text:span text:style-name=\"OrgDefinitionTerm\">%s</text:span><text:tab/>" tag) + contents) + (let* ((--element-has-a-table-p + (function + (lambda (element info) + (loop for el in (org-element-contents element) + thereis (eq (org-element-type el) 'table)))))) + (cond + ((funcall --element-has-a-table-p item info) + "</text:list-header>") + (t "</text:list-item>"))))) + (t (error "Unknown list type: %S" type))))))) ;;;; Keyword @@ -2723,7 +2740,7 @@ Return nil, otherwise." return el))) ;; We found one. (when headline - (format "<text:bookmark-ref text:reference-format=\"chapter\" text:ref-name=\"OrgXref.%s\">%s</text:bookmark-ref>" + (format "<text:bookmark-ref text:reference-format=\"number\" text:ref-name=\"__RefHeading__%s\">%s</text:bookmark-ref>" (org-export-solidify-link-text label) (mapconcat 'number-to-string (org-export-get-headline-number headline info) ".")))) @@ -2735,7 +2752,7 @@ Return nil, otherwise." return el))) ;; We found one. (when headline - (format "<text:bookmark-ref text:reference-format=\"text\" text:ref-name=\"OrgXref.%s\">%s</text:bookmark-ref>" + (format "<text:bookmark-ref text:reference-format=\"text\" text:ref-name=\"__RefHeading__%s\">%s</text:bookmark-ref>" (org-export-solidify-link-text label) (let ((title (org-element-property :title headline))) (org-export-data title info))))) @@ -2781,7 +2798,7 @@ INFO is a plist holding contextual information. See (let ((desc (org-export-data (org-element-contents destination) info)) (href (org-export-solidify-link-text path))) (format - "<text:bookmark-ref text:reference-format=\"text\" text:ref-name=\"OrgXref.%s\">%s</text:bookmark-ref>" + "<text:bookmark-ref text:reference-format=\"text\" text:ref-name=\"__RefHeading__%s\">%s</text:bookmark-ref>" href desc))))) ;; Links pointing to a headline: Find destination and build ;; appropriate referencing command. @@ -2846,7 +2863,7 @@ INFO is a plist holding contextual information. See (format (org-export-get-coderef-format path desc) (format - "<text:bookmark-ref text:reference-format=\"number\" text:ref-name=\"OrgXref.%s\">%s</text:bookmark-ref>" + "<text:bookmark-ref text:reference-format=\"number\" text:ref-name=\"__RefHeading__%s\">%s</text:bookmark-ref>" href line-no)))) ;; Link type is handled by a special function. ((functionp (setq protocol (nth 2 (assoc type org-link-protocols)))) @@ -2920,6 +2937,7 @@ contextual information." (case (org-element-property :type plain-list) (ordered "OrgNumberedList") (unordered "OrgBulletedList") + (descriptive "OrgDescriptionList") (descriptive-1 "OrgDescriptionList") (descriptive-2 "OrgDescriptionList")) ;; If top-level list, re-start numbering. Otherwise, @@ -3559,6 +3577,7 @@ pertaining to indentation here." (case (org-element-property :type el) (ordered "OrgNumberedList") (unordered "OrgBulletedList") + (descriptive "OrgDescriptionList") (descriptive-1 "OrgDescriptionList") (descriptive-2 "OrgDescriptionList")) "text:continue-numbering=\"true\""))) @@ -4092,7 +4111,9 @@ contextual information." ;; Prettify output if needed. (when org-odt-prettify-xml (indent-region (point-min) (point-max))) - (save-buffer 0))))) + ;;;(save-buffer 0) + (write-file (concat org-odt-zip-dir file)) + )))) org-odt-xml-files) ;; Run zip. (let* ((target --out-file) ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: Open Document Exporter 2013-06-27 0:19 ` Georg Lehner @ 2013-06-27 13:58 ` Bastien 2013-06-29 12:43 ` Jambunathan K 1 sibling, 0 replies; 10+ messages in thread From: Bastien @ 2013-06-27 13:58 UTC (permalink / raw) To: Georg Lehner; +Cc: emacs-orgmode Hi Georg, Georg Lehner <jorge-org@magma.com.ni> writes: > diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el > index a76f7dd..c8b704c 100644 This is quite a significant patch. If you want to let us apply it for Org, you will need to sign the FSF copyright assignment: http://orgmode.org/cgit.cgi/org-mode.git/plain/request-assign-future.txt Thanks in advance for your help! -- Bastien ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Open Document Exporter 2013-06-27 0:19 ` Georg Lehner 2013-06-27 13:58 ` Bastien @ 2013-06-29 12:43 ` Jambunathan K 2013-06-29 20:37 ` Georg Lehner 1 sibling, 1 reply; 10+ messages in thread From: Jambunathan K @ 2013-06-29 12:43 UTC (permalink / raw) To: Georg Lehner; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 273 bytes --] I need time to review other issues you are raising. Georg Lehner <jorge-org@magma.com.ni> writes: > 4. LaTeX like definition lists Here is a patch and sample documents. You can pull from my private repo which is at http://repo.or.cz/w/org-mode/org-kjn.git [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-ox-odt-Support-for-typesetting-Description-lists-as-.patch --] [-- Type: text/x-diff, Size: 8746 bytes --] From 7dfa274163fb3a06ff947e1af884af49dca34b0e Mon Sep 17 00:00:00 2001 From: Jambunathan K <kjambunathan@gmail.com> Date: Sat, 29 Jun 2013 17:59:48 +0530 Subject: [PATCH] ox-odt: Support for typesetting Description lists as in LaTeX * etc/styles.OrgOdtStyles.xml (OrgDescriptionTerm) (OrgDescriptionDefinition): New styles for typesetting description lists. * lisp/ox-odt.el (org-odt-description-list-style): New user option. (org-odt--translate-description-lists/html): Renmed from `org-odt--translate-description-lists. Use new style "OrgDescriptionTerm". Update comments. (org-odt--translate-description-lists/latex): New. (org-odt-bold): Add an internal `:style' property. --- etc/styles/OrgOdtStyles.xml | 10 +++ lisp/ox-odt.el | 141 +++++++++++++++++++++++++++++++++++++----- 2 files changed, 134 insertions(+), 17 deletions(-) diff --git a/etc/styles/OrgOdtStyles.xml b/etc/styles/OrgOdtStyles.xml index f41d984..c2c32fa 100644 --- a/etc/styles/OrgOdtStyles.xml +++ b/etc/styles/OrgOdtStyles.xml @@ -729,6 +729,16 @@ </text:list-level-style-number> </text:list-style> + <style:style style:name="OrgDescriptionTerm" style:family="text"> + <style:text-properties fo:font-weight="bold"/> + </style:style> + + <style:style style:name="OrgDescriptionDefinition" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="text"> + <style:paragraph-properties fo:margin-left="0.64cm" fo:margin-right="0cm" fo:text-indent="-0.64cm" style:auto-text-indent="false"> + <style:tab-stops/> + </style:paragraph-properties> + </style:style> + <text:list-style style:name="OrgSrcBlockNumberedLine"> <text:list-level-style-number text:level="1" style:num-format="1"> <style:list-level-properties text:space-before="0.635cm" text:min-label-width="0.635cm" text:min-label-distance="0.101cm" fo:text-align="end"/> diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el index a76f7dd..0eaffcb 100644 --- a/lisp/ox-odt.el +++ b/lisp/ox-odt.el @@ -86,7 +86,7 @@ (org-export-define-backend 'odt :export-block "ODT" :filters-alist '((:filter-parse-tree . (org-odt--translate-latex-fragments - org-odt--translate-description-lists + org-odt--translate-description-lists ; Dummy symbol org-odt--translate-list-tables))) :menu-entry '(?o "Export to ODT" @@ -777,6 +777,22 @@ (defcustom org-odt-pixels-per-inch display-pixels-per-inch :version "24.1") +;;;; Lists + +(defcustom org-odt-description-list-style #'org-odt--translate-description-lists/html + "Specify how description lists are rendered. +Choose one of HTML or LaTeX style." + :type '(choice + (const :tag "Use HTML style" org-odt--translate-description-lists/html ) + (const :tag "Use LaTeX style" org-odt--translate-description-lists/latex )) + :group 'org-export-odt + :set (lambda (symbol value) + "Alias `org-odt--translate-description-lists'." + (set-default symbol value) + (fset 'org-odt--translate-description-lists value)) + :version "24.1") + + ;;;; Src Block (defcustom org-odt-create-custom-styles-for-srcblocks t @@ -1583,7 +1599,11 @@ (defun org-odt-bold (bold contents info) CONTENTS is the text with bold markup. INFO is a plist holding contextual information." (format "<text:span text:style-name=\"%s\">%s</text:span>" - "Bold" contents)) + ;; Internally, `org-odt--translate-description-lists/html' + ;; or `org-odt--translate-description-lists/latex' requests + ;; a custom style for bold. + (or (org-element-property :style bold) "Bold") + contents)) ;;;; Center Block @@ -3650,7 +3670,7 @@ (defun org-odt-table (table contents info) ;; item, but also within description lists and low-level ;; headlines. - ;; See `org-odt-translate-description-lists' and + ;; See `org-odt--translate-description-lists' and ;; `org-odt-translate-low-level-headlines' for how this is ;; tackled. @@ -3869,27 +3889,44 @@ (defun org-odt--translate-latex-fragments (tree backend info) ;; This translator is necessary to handle indented tables in a uniform ;; manner. See comment in `org-odt--table'. -(defun org-odt--translate-description-lists (tree backend info) +;; Depending on user option `org-odt-description-list-style', +;; description lists can be typeset either as in HTML documents or as +;; in LaTeX documents. + +(defun org-odt--translate-description-lists/html (tree backend info) ;; OpenDocument has no notion of a description list. So simulate it ;; using plain lists. Description lists in the exported document ;; are typeset in the same manner as they are in a typical HTML - ;; document. + ;; document. See `org-odt--translate-description-lists/latex' for + ;; yet another way of translation. ;; ;; Specifically, a description list like this: ;; - ;; ,---- - ;; | - term-1 :: definition-1 - ;; | - term-2 :: definition-2 - ;; `---- + ;; ,---- + ;; | - term-1 :: definition-1 + ;; | + ;; | paragraph-1 + ;; | + ;; | - term-2 :: definition-2 + ;; | + ;; | paragraph-2 + ;; `---- ;; ;; gets translated in to the following form: ;; - ;; ,---- - ;; | - term-1 - ;; | - definition-1 - ;; | - term-2 - ;; | - definition-2 - ;; `---- + ;; ,---- + ;; | - term-1 + ;; | + ;; | - definition-1 + ;; | + ;; | paragraph-1 + ;; | + ;; | - term-2 + ;; | + ;; | - definition-2 + ;; | + ;; | paragraph-2 + ;; `---- ;; ;; Further effect is achieved by fixing the OD styles as below: ;; @@ -3912,8 +3949,9 @@ (defun org-odt--translate-description-lists (tree backend info) (org-element-adopt-elements (list 'item (list :checkbox (org-element-property :checkbox item))) - (list 'paragraph (list :style "Text_20_body_20_bold") - (or (org-element-property :tag item) "(no term)")) + (list 'paragraph nil + (list 'bold (list :style "OrgDescriptionTerm") + (or (org-element-property :tag item) "(no term)"))) (org-element-adopt-elements (list 'plain-list (list :type 'descriptive-2)) (apply 'org-element-adopt-elements @@ -3924,6 +3962,75 @@ (defun org-odt--translate-description-lists (tree backend info) info) tree) +(defun org-odt--translate-description-lists/latex (tree backend info) + ;; OpenDocument has no notion of a description list. So simulate it + ;; using plain lists. Description lists in the exported document + ;; are typeset in the same manner as they are in a typical LaTeX + ;; style document. See `org-odt--translate-description-lists/html' + ;; for yet another way of translation. + ;; + ;; Specifically, a description list like this: + ;; + ;; ,---- + ;; | - term-1 :: definition-1 + ;; | + ;; | paragraph-1 + ;; | + ;; | - term-2 :: definition-2 + ;; | + ;; | paragraph-2 + ;; `---- + ;; + ;; gets translated in to the following form: + ;; + ;; ,---- + ;; | - *term-1* definition-1 + ;; | + ;; | - paragraph-1 + ;; | + ;; | - *term-2* definition-2 + ;; | + ;; | - paragraph-2 + ;; `---- + ;; + ;; Further effect is achieved by fixing the OD styles as below: + ;; + ;; 1. Set the :type property of the simulated lists to + ;; `descriptive-1' and `descriptive-2'. Map these to list-styles + ;; that has *no* bullets whatsoever. + ;; + ;; 2. The paragraph containing the definition term is styled to be + ;; use hanging indent. + ;; + (org-element-map tree 'plain-list + (lambda (el) + (when (equal (org-element-property :type el) 'descriptive) + (org-element-set-element + el + (apply 'org-element-adopt-elements + (list 'plain-list (list :type 'descriptive-1)) + (mapcar + (lambda (item) + (let* ((item-contents (org-element-contents item)) + (leading-paragraph (car item-contents)) + (item-contents (cdr item-contents))) + (org-element-adopt-elements + (list 'item (list :checkbox (org-element-property :checkbox item))) + (apply 'org-element-adopt-elements + (list 'paragraph (list :style "OrgDescriptionDefinition")) + (list 'bold (list :style "OrgDescriptionTerm" :post-blank 1) + (or (org-element-property :tag item) "(no term)")) + (org-element-contents leading-paragraph)) + (org-element-adopt-elements + (list 'plain-list (list :type 'descriptive-2)) + (apply 'org-element-adopt-elements + (list 'item nil) + item-contents))))) + (org-element-contents el))))) + nil) + info) + tree) + ;;;; List tables ;; Lists that are marked with attribute `:list-table' are called as -- 1.7.2.5 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #3: dl.org --] [-- Type: text/x-org, Size: 765 bytes --] * One - term-1 :: definition-1 definition-1 definition-1 definition-1 definition-1 definition-1 definition-1 definition-1 definition-1 definition-1 definition-1 definition-1 definition-1 definition-1 definition-1 definition-1 definition-1 definition-1 definition-1 definition-1 definition-1 definition-1 definition-1 definition-1 definition-1 Some paragraph. | a | b | c | | d | e | f | - term-2 :: definition-2 definition-2 definition-2 definition-2 definition-2 definition-2 definition-2 definition-2 definition-2 definition-2 definition-2 definition-2 definition-2 definition-2 definition-2 Another paragraph. [-- Attachment #4: dl.latex.odt --] [-- Type: application/vnd.oasis.opendocument.text, Size: 10530 bytes --] [-- Attachment #5: dl.html.odt --] [-- Type: application/vnd.oasis.opendocument.text, Size: 10523 bytes --] ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: Open Document Exporter 2013-06-29 12:43 ` Jambunathan K @ 2013-06-29 20:37 ` Georg Lehner 0 siblings, 0 replies; 10+ messages in thread From: Georg Lehner @ 2013-06-29 20:37 UTC (permalink / raw) To: emacs-orgmode Hello Jambunathan! This works great for me, Thank You! Best Regards, Georg Lehner On 06/29/2013 02:43 PM, Jambunathan K wrote: > I need time to review other issues you are raising. > > Georg Lehner<jorge-org@magma.com.ni> writes: >> 4. LaTeX like definition lists > Here is a patch and sample documents. You can pull from my private repo > which is at > > http://repo.or.cz/w/org-mode/org-kjn.git ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Open Document Exporter 2013-06-24 21:29 Open Document Exporter Georg Lehner 2013-06-25 1:35 ` Vikas Rawal @ 2013-06-26 9:42 ` Nicolas Goaziou 2013-06-28 21:20 ` Georg Lehner ` (2 subsequent siblings) 4 siblings, 0 replies; 10+ messages in thread From: Nicolas Goaziou @ 2013-06-26 9:42 UTC (permalink / raw) To: Georg Lehner; +Cc: emacs-orgmode Hello, Georg Lehner <jorge-org@magma.com.ni> writes: > In LaTeX export I have the following behaviour: > > [[*Headline][Headline]] converts to a Hyperlink to the respective > headline with description text 'Headline'. > [[*Headline]] converts to the respective headline number > > In ODT export both convert to the headline number. Fixed. > The following patch disables smart-quotes when required so by a ':nil > option. The (when ... clause was missing from the > original code. Fixed. > > 6. Table caption does not translate > ==================== > > I have expanded the 'org-export-dictionary' constant with german (and > spanisch) translations of all keywords. Added. > However my table captions still show the englisch "Table" prefix. With > Figures (alias 'Illustrations' in ODT) things > work fine. This is not fixed yet. Currently, the way ODT exporter handles translations is incompatible with `org-export-dictionary'. I'll have a look at it. Thank you for the report and the patches. Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Open Document Exporter 2013-06-24 21:29 Open Document Exporter Georg Lehner 2013-06-25 1:35 ` Vikas Rawal 2013-06-26 9:42 ` Nicolas Goaziou @ 2013-06-28 21:20 ` Georg Lehner 2013-06-29 13:24 ` Jambunathan K 2013-06-29 13:26 ` Jambunathan K 4 siblings, 0 replies; 10+ messages in thread From: Georg Lehner @ 2013-06-28 21:20 UTC (permalink / raw) To: emacs-orgmode Hello! Here comes another (tiny) patch which fixes generation of external links to relative file paths. Apparently =./Media/logo.png= has to be inserted as =href=../Media/logo.png=. At least on LibreOffice 3 and 4 anything else fails. LibreOffice always shows and uses the absolute path and prefixes the stored relative path with the path to the =.odt= file *including the filename itself*! So the =../= removes the filename and the link gets calculated correctly. Best Regards, Georg Lehner - - - --- /home/jorge/progs/org-mode/lisp/ox-odt.el +++ /home/jorge/emacs/lib/org-mode/lisp/ox-odt.el @@ -2763,7 +2780,7 @@ ((string= type "file") (if (file-name-absolute-p raw-path) (concat "file://" (expand-file-name raw-path)) - (concat "file://" raw-path))) + (concat "file:" "../" raw-path))) (t raw-path))) ;; Convert & to & for correct XML representation (path (replace-regexp-in-string "&" "&" path)) ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Open Document Exporter 2013-06-24 21:29 Open Document Exporter Georg Lehner ` (2 preceding siblings ...) 2013-06-28 21:20 ` Georg Lehner @ 2013-06-29 13:24 ` Jambunathan K 2013-06-29 13:26 ` Jambunathan K 4 siblings, 0 replies; 10+ messages in thread From: Jambunathan K @ 2013-06-29 13:24 UTC (permalink / raw) To: Georg Lehner; +Cc: emacs-orgmode Georg Lehner <jorge-org@magma.com.ni> writes: > 1. content.xml changed on disk > ================== > > At the end of the export process I get the message: > > content.xml changed on disk; really edit the buffer? (y, n, r or C-h) > Please type y, n or r; or ? for help > > After typing 'y', I have to reconfirm with 'yes' and then with 'y' > again to get a valid export. > > Any tips how to fix or avoid this? If you have set up everything correctly, C-c C-e O (capital O) should launch LibreOffice for you. If not, you may have to do some extra configuration. Here is what I do on my Debian. Install xdg-utils. sudo apt-get install xdg-utils Make sure that xdg-open launches LibreOffice. xdg-open file.odt Add this to your .emacs (setcdr (assq 'system org-file-apps-defaults-gnu ) "xdg-open %s") ---------------------------------------------------------------- If you are on Windows machines, make sure that `temporary-file-directory' is configured correctly. Check *Messages* buffer and you will know what the ODT exporter is doing. ---------------------------------------------------------------- ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Open Document Exporter 2013-06-24 21:29 Open Document Exporter Georg Lehner ` (3 preceding siblings ...) 2013-06-29 13:24 ` Jambunathan K @ 2013-06-29 13:26 ` Jambunathan K 4 siblings, 0 replies; 10+ messages in thread From: Jambunathan K @ 2013-06-29 13:26 UTC (permalink / raw) To: Georg Lehner; +Cc: emacs-orgmode Georg Lehner <jorge-org@magma.com.ni> writes: > 2. Blank lines after headlines > ================= > > After each headline I get a blank line. Can these be suppressed? I'd > like to control the separation between > headline and text by styles and not by extra lines. When you say headline do you mean headline or title/subtitle? Show me a sample Org and ODT file. ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2013-06-29 20:40 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-06-24 21:29 Open Document Exporter Georg Lehner 2013-06-25 1:35 ` Vikas Rawal 2013-06-27 0:19 ` Georg Lehner 2013-06-27 13:58 ` Bastien 2013-06-29 12:43 ` Jambunathan K 2013-06-29 20:37 ` Georg Lehner 2013-06-26 9:42 ` Nicolas Goaziou 2013-06-28 21:20 ` Georg Lehner 2013-06-29 13:24 ` Jambunathan K 2013-06-29 13:26 ` Jambunathan K
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.