From b4f90c687d647e401e59e0dba88042d410105e51 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Tue, 25 Jun 2013 08:35:25 +0200 Subject: [PATCH 1/5] ox-odt: Allow to turn smart quotes off * lisp/ox-odt.el (org-odt-plain-text): Allow to turn smart quotes off. Patch suggested by Georg Lehner. --- lisp/ox-odt.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el index 7e1390ef0..a2a28f86a 100644 --- a/lisp/ox-odt.el +++ b/lisp/ox-odt.el @@ -2966,7 +2966,8 @@ contextual information." (setq output (org-odt--encode-plain-text output t)) ;; Handle smart quotes. Be sure to provide original string since ;; OUTPUT may have been modified. - (setq output (org-export-activate-smart-quotes output :utf-8 info text)) + (when (plist-get info :with-smart-quotes) + (setq output (org-export-activate-smart-quotes output :utf-8 info text))) ;; Convert special strings. (when (plist-get info :with-special-strings) (mapc From 41a0f2fa9ee42c686f583ef06afd67411b283dba Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Tue, 25 Jun 2013 09:05:46 +0200 Subject: [PATCH 2/5] ox-odt: Links to headlines are more consistent with other back-ends * lisp/ox-odt.el (org-odt-link): Fuzzy links to an headline with a description always use that description, even if the description is the same as the headline title. Reported by Georg Lehner. --- lisp/ox-odt.el | 103 +++++++++++++++++++++++-------------------------- 1 file changed, 49 insertions(+), 54 deletions(-) diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el index a2a28f86a..bb1ebbf0b 100644 --- a/lisp/ox-odt.el +++ b/lisp/ox-odt.el @@ -2785,63 +2785,58 @@ INFO is a plist holding contextual information. See ;; Links pointing to a headline: Find destination and build ;; appropriate referencing command. ((member type '("custom-id" "fuzzy" "id")) - (let* ((destination (if (string= type "fuzzy") - (org-export-resolve-fuzzy-link link info) - (org-export-resolve-id-link link info)))) - (or - ;; Case 1: Fuzzy link points nowhere. - (when (null (org-element-type destination)) + (let ((destination (if (string= type "fuzzy") + (org-export-resolve-fuzzy-link link info) + (org-export-resolve-id-link link info)))) + (case (org-element-type destination) + ;; Case 1: Fuzzy link points nowhere. + ('nil (format "%s" - "Emphasis" (or desc (org-export-data - (org-element-property - :raw-link link) info)))) - ;; Case 2: Fuzzy link points to an invisible target. Strip it. - (when (eq (org-element-type destination) 'keyword) "") - ;; Case 3: LINK points to a headline. - (when (eq (org-element-type destination) 'headline) - ;; Case 3.1: LINK has a custom description that is - ;; different from headline's title. Create a hyperlink. - (when (and desc - (let ((link-desc (org-element-contents link))) - (not (string= (org-element-interpret-data link-desc) - (org-element-property :raw-value - destination))))) - (let* ((headline-no (org-export-get-headline-number - destination info)) - (label (format "sec-%s" (mapconcat 'number-to-string - headline-no "-")))) - (format "%s" - label desc)))) - ;; Case 4: LINK points to an Inline image, Math formula or a Table. - (let ((label-reference (ignore-errors (org-odt-format-label - destination info 'reference)))) - (when label-reference - (cond - ;; Case 4.1: LINK has no description. Create a - ;; cross-reference showing entity's sequence number. - ((not desc) label-reference) - ;; Case 4.2: LINK has description. Insert a hyperlink - ;; with user-provided description. - (t (let* ((caption-from (case (org-element-type destination) - (link (org-export-get-parent-element - destination)) - (t destination))) - ;; Get label and caption. - (label (org-element-property :name caption-from))) - (format "%s" - (org-export-solidify-link-text label) desc)))))) - ;; Case 5: Fuzzy link points to a TARGET. - (when (eq (org-element-type destination) 'target) - ;; Case 5.1: LINK has description. Create a hyperlink. - (when desc + "Emphasis" + (or desc + (org-export-data (org-element-property :raw-link link) + info)))) + ;; Case 2: Fuzzy link points to a headline. + (headline + ;; If there's a description, create a hyperlink. + ;; Otherwise, try to provide a meaningful description. + (if (not desc) (org-odt-link--infer-description destination info) + (let* ((headline-no + (org-export-get-headline-number destination info)) + (label + (format "sec-%s" + (mapconcat 'number-to-string headline-no "-")))) + (format + "%s" + label desc)))) + ;; Case 3: Fuzzy link points to a target. + (target + ;; If there's a description, create a hyperlink. + ;; Otherwise, try to provide a meaningful description. + (if (not desc) (org-odt-link--infer-description destination info) (let ((label (org-element-property :value destination))) (format "%s" - (org-export-solidify-link-text label) desc)))) - ;; LINK has no description. It points to either a HEADLINE or - ;; an ELEMENT with a #+NAME: LABEL attached to it. LINK to - ;; DESTINATION, but make a best effort to provide - ;; a *meaningful* description. - (org-odt-link--infer-description destination info)))) + (org-export-solidify-link-text label) + desc)))) + ;; Case 4: Fuzzy link points to some element (e.g., an + ;; inline image, a math formula or a table). + (otherwise + (let ((label-reference + (ignore-errors (org-odt-format-label + destination info 'reference)))) + (cond ((not label-reference) + (org-odt-link--infer-description destination info)) + ;; LINK has no description. Create + ;; a cross-reference showing entity's sequence + ;; number. + ((not desc) label-reference) + ;; LINK has description. Insert a hyperlink with + ;; user-provided description. + (t + (let ((label (org-element-property :name destination))) + (format "%s" + (org-export-solidify-link-text label) + desc))))))))) ;; Coderef: replace link with the reference name or the ;; equivalent line number. ((string= type "coderef") From 42a9473aedfdc112846c9a54f09b9cfb9fec08e1 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Tue, 25 Jun 2013 09:15:24 +0200 Subject: [PATCH 3/5] ox: Add spanish and german translations * lisp/ox.el (org-export-dictionary): Add spanish and german translations. Patch suggested by Georg Lehner. --- lisp/ox.el | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/lisp/ox.el b/lisp/ox.el index f656af5ad..7a2f157f6 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -5260,15 +5260,19 @@ them." ("zh-CN" :html "日期" :utf-8 "日期") ("zh-TW" :html "日期" :utf-8 "日期")) ("Equation" + ("de" :default "Gleichung") + ("es" :html "Ecuación" :default "Ecuación") ("fr" :ascii "Equation" :default "Équation")) - ("Figure") + ("Figure" + ("de" :default "Abbildung") + ("es" :default "Figura")) ("Footnotes" ("ca" :html "Peus de pàgina") ("cs" :default "Pozn\xe1mky pod carou") ("da" :default "Fodnoter") - ("de" :html "Fußnoten") + ("de" :html "Fußnoten" :default "Fußnoten") ("eo" :default "Piednotoj") - ("es" :html "Pies de página") + ("es" :html "Nota al pie de página" :default "Nota al pie de página") ("fi" :default "Alaviitteet") ("fr" :default "Notes de bas de page") ("hu" :html "Lábjegyzet") @@ -5287,10 +5291,16 @@ them." ("zh-CN" :html "脚注" :utf-8 "脚注") ("zh-TW" :html "腳註" :utf-8 "腳註")) ("List of Listings" + ("de" :default "Programmauflistungsverzeichnis") + ("es" :default "Indice de Listados de programas") ("fr" :default "Liste des programmes")) ("List of Tables" + ("de" :default "Tabellenverzeichnis") + ("es" :default "Indice de tablas") ("fr" :default "Liste des tableaux")) ("Listing %d:" + ("de" :default "Programmlisting %d") + ("es" :default "Listado de programa %d") ("fr" :ascii "Programme %d :" :default "Programme nº %d :" :latin1 "Programme %d :")) @@ -5299,11 +5309,17 @@ them." :ascii "Programme %d : %s" :default "Programme nº %d : %s" :latin1 "Programme %d : %s")) ("See section %s" + ("de" :default "siehe Abschnitt %s") + ("es" :default "vea seccion %s") ("fr" :default "cf. section %s")) ("Table %d:" + ("de" :default "Tabelle %d") + ("es" :default "Tabla %d") ("fr" :ascii "Tableau %d :" :default "Tableau nº %d :" :latin1 "Tableau %d :")) ("Table %d: %s" + ("de" :default "Tabelle %d: %s") + ("es" :default "Tabla %d: %s") ("fr" :ascii "Tableau %d : %s" :default "Tableau nº %d : %s" :latin1 "Tableau %d : %s")) @@ -5332,6 +5348,8 @@ them." ("zh-CN" :html "目录" :utf-8 "目录") ("zh-TW" :html "目錄" :utf-8 "目錄")) ("Unknown reference" + ("de" :default "Unbekannter Verweis") + ("es" :default "referencia desconocida") ("fr" :ascii "Destination inconnue" :default "Référence inconnue"))) "Dictionary for export engine. From a52a35779f973ccd2333103e3ed0661cb354ffdf Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Tue, 25 Jun 2013 09:29:18 +0200 Subject: [PATCH 4/5] ox: Remove useless dictionary entries * lisp/ox.el (org-export-dictionary): Remove useless dictionary entries. * lisp/ox-ascii.el (org-ascii--build-caption): Apply removal. --- lisp/ox-ascii.el | 8 +++++--- lisp/ox.el | 10 ---------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/lisp/ox-ascii.el b/lisp/ox-ascii.el index 188406153..59d015237 100644 --- a/lisp/ox-ascii.el +++ b/lisp/ox-ascii.el @@ -665,11 +665,13 @@ caption keyword." element info nil 'org-ascii--has-caption-p)) (title-fmt (org-ascii--translate (case (org-element-type element) - (table "Table %d: %s") - (src-block "Listing %d: %s")) + (table "Table %d:") + (src-block "Listing %d:")) info))) (org-ascii--fill-string - (format title-fmt reference (org-export-data caption info)) + (concat (format title-fmt reference) + " " + (org-export-data caption info)) (org-ascii--current-text-width element info) info))))) (defun org-ascii--build-toc (info &optional n keyword) diff --git a/lisp/ox.el b/lisp/ox.el index 7a2f157f6..472b9eb03 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -5304,10 +5304,6 @@ them." ("fr" :ascii "Programme %d :" :default "Programme nº %d :" :latin1 "Programme %d :")) - ("Listing %d: %s" - ("fr" - :ascii "Programme %d : %s" :default "Programme nº %d : %s" - :latin1 "Programme %d : %s")) ("See section %s" ("de" :default "siehe Abschnitt %s") ("es" :default "vea seccion %s") @@ -5317,12 +5313,6 @@ them." ("es" :default "Tabla %d") ("fr" :ascii "Tableau %d :" :default "Tableau nº %d :" :latin1 "Tableau %d :")) - ("Table %d: %s" - ("de" :default "Tabelle %d: %s") - ("es" :default "Tabla %d: %s") - ("fr" - :ascii "Tableau %d : %s" :default "Tableau nº %d : %s" - :latin1 "Tableau %d : %s")) ("Table of Contents" ("ca" :html "Índex") ("cs" :default "Obsah") From 95b16b1aa544f724d716e6d16e722f9f1473f864 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Tue, 25 Jun 2013 09:30:18 +0200 Subject: [PATCH 5/5] ox-odt: Fix internationalization of "Table" and "Listing" * lisp/ox-odt.el (org-odt-category-map-alist): Fix internationalization of "Table" and "Listing". Bug reported by Georg Lehner. --- lisp/ox-odt.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el index bb1ebbf0b..771d63b0f 100644 --- a/lisp/ox-odt.el +++ b/lisp/ox-odt.el @@ -308,11 +308,11 @@ specifiers - %e and %n. %e is replaced with the CATEGORY-NAME. `org-odt-format-label-reference'.") (defvar org-odt-category-map-alist - '(("__Table__" "Table" "value" "Table" org-odt--enumerable-p) + '(("__Table__" "Table" "value" "Table %d:" org-odt--enumerable-p) ("__Figure__" "Illustration" "value" "Figure" org-odt--enumerable-image-p) ("__MathFormula__" "Text" "math-formula" "Equation" org-odt--enumerable-formula-p) ("__DvipngImage__" "Equation" "value" "Equation" org-odt--enumerable-latex-image-p) - ("__Listing__" "Listing" "value" "Listing" org-odt--enumerable-p) + ("__Listing__" "Listing" "value" "Listing %d:" org-odt--enumerable-p) ;; ("__Table__" "Table" "category-and-value") ;; ("__Figure__" "Figure" "category-and-value") ;; ("__DvipngImage__" "Equation" "category-and-value")