Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2013-06-25 09:33:39 +02:00
commit ec8f3f987e
3 changed files with 77 additions and 71 deletions

View File

@ -665,11 +665,13 @@ caption keyword."
element info nil 'org-ascii--has-caption-p)) element info nil 'org-ascii--has-caption-p))
(title-fmt (org-ascii--translate (title-fmt (org-ascii--translate
(case (org-element-type element) (case (org-element-type element)
(table "Table %d: %s") (table "Table %d:")
(src-block "Listing %d: %s")) (src-block "Listing %d:"))
info))) info)))
(org-ascii--fill-string (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))))) (org-ascii--current-text-width element info) info)))))
(defun org-ascii--build-toc (info &optional n keyword) (defun org-ascii--build-toc (info &optional n keyword)

View File

@ -308,11 +308,11 @@ specifiers - %e and %n. %e is replaced with the CATEGORY-NAME.
`org-odt-format-label-reference'.") `org-odt-format-label-reference'.")
(defvar org-odt-category-map-alist (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) ("__Figure__" "Illustration" "value" "Figure" org-odt--enumerable-image-p)
("__MathFormula__" "Text" "math-formula" "Equation" org-odt--enumerable-formula-p) ("__MathFormula__" "Text" "math-formula" "Equation" org-odt--enumerable-formula-p)
("__DvipngImage__" "Equation" "value" "Equation" org-odt--enumerable-latex-image-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") ;; ("__Table__" "Table" "category-and-value")
;; ("__Figure__" "Figure" "category-and-value") ;; ("__Figure__" "Figure" "category-and-value")
;; ("__DvipngImage__" "Equation" "category-and-value") ;; ("__DvipngImage__" "Equation" "category-and-value")
@ -2786,63 +2786,58 @@ INFO is a plist holding contextual information. See
;; Links pointing to a headline: Find destination and build ;; Links pointing to a headline: Find destination and build
;; appropriate referencing command. ;; appropriate referencing command.
((member type '("custom-id" "fuzzy" "id")) ((member type '("custom-id" "fuzzy" "id"))
(let* ((destination (if (string= type "fuzzy") (let ((destination (if (string= type "fuzzy")
(org-export-resolve-fuzzy-link link info) (org-export-resolve-fuzzy-link link info)
(org-export-resolve-id-link link info)))) (org-export-resolve-id-link link info))))
(or (case (org-element-type destination)
;; Case 1: Fuzzy link points nowhere. ;; Case 1: Fuzzy link points nowhere.
(when (null (org-element-type destination)) ('nil
(format "<text:span text:style-name=\"%s\">%s</text:span>" (format "<text:span text:style-name=\"%s\">%s</text:span>"
"Emphasis" (or desc (org-export-data "Emphasis"
(org-element-property (or desc
:raw-link link) info)))) (org-export-data (org-element-property :raw-link link)
;; Case 2: Fuzzy link points to an invisible target. Strip it. info))))
(when (eq (org-element-type destination) 'keyword) "") ;; Case 2: Fuzzy link points to a headline.
;; Case 3: LINK points to a headline. (headline
(when (eq (org-element-type destination) 'headline) ;; If there's a description, create a hyperlink.
;; Case 3.1: LINK has a custom description that is ;; Otherwise, try to provide a meaningful description.
;; different from headline's title. Create a hyperlink. (if (not desc) (org-odt-link--infer-description destination info)
(when (and desc (let* ((headline-no
(let ((link-desc (org-element-contents link))) (org-export-get-headline-number destination info))
(not (string= (org-element-interpret-data link-desc) (label
(org-element-property :raw-value (format "sec-%s"
destination))))) (mapconcat 'number-to-string headline-no "-"))))
(let* ((headline-no (org-export-get-headline-number (format
destination info)) "<text:a xlink:type=\"simple\" xlink:href=\"#%s\">%s</text:a>"
(label (format "sec-%s" (mapconcat 'number-to-string label desc))))
headline-no "-")))) ;; Case 3: Fuzzy link points to a target.
(format "<text:a xlink:type=\"simple\" xlink:href=\"#%s\">%s</text:a>" (target
label desc)))) ;; If there's a description, create a hyperlink.
;; Case 4: LINK points to an Inline image, Math formula or a Table. ;; Otherwise, try to provide a meaningful description.
(let ((label-reference (ignore-errors (org-odt-format-label (if (not desc) (org-odt-link--infer-description destination info)
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 "<text:a xlink:type=\"simple\" xlink:href=\"#%s\">%s</text:a>"
(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
(let ((label (org-element-property :value destination))) (let ((label (org-element-property :value destination)))
(format "<text:a xlink:type=\"simple\" xlink:href=\"#%s\">%s</text:a>" (format "<text:a xlink:type=\"simple\" xlink:href=\"#%s\">%s</text:a>"
(org-export-solidify-link-text label) desc)))) (org-export-solidify-link-text label)
;; LINK has no description. It points to either a HEADLINE or desc))))
;; an ELEMENT with a #+NAME: LABEL attached to it. LINK to ;; Case 4: Fuzzy link points to some element (e.g., an
;; DESTINATION, but make a best effort to provide ;; inline image, a math formula or a table).
;; a *meaningful* description. (otherwise
(org-odt-link--infer-description destination info)))) (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 "<text:a xlink:type=\"simple\" xlink:href=\"#%s\">%s</text:a>"
(org-export-solidify-link-text label)
desc)))))))))
;; Coderef: replace link with the reference name or the ;; Coderef: replace link with the reference name or the
;; equivalent line number. ;; equivalent line number.
((string= type "coderef") ((string= type "coderef")
@ -2967,7 +2962,8 @@ contextual information."
(setq output (org-odt--encode-plain-text output t)) (setq output (org-odt--encode-plain-text output t))
;; Handle smart quotes. Be sure to provide original string since ;; Handle smart quotes. Be sure to provide original string since
;; OUTPUT may have been modified. ;; 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. ;; Convert special strings.
(when (plist-get info :with-special-strings) (when (plist-get info :with-special-strings)
(mapc (mapc

View File

@ -5260,15 +5260,19 @@ them."
("zh-CN" :html "&#26085;&#26399;" :utf-8 "日期") ("zh-CN" :html "&#26085;&#26399;" :utf-8 "日期")
("zh-TW" :html "&#26085;&#26399;" :utf-8 "日期")) ("zh-TW" :html "&#26085;&#26399;" :utf-8 "日期"))
("Equation" ("Equation"
("de" :default "Gleichung")
("es" :html "Ecuaci&oacute;n" :default "Ecuación")
("fr" :ascii "Equation" :default "Équation")) ("fr" :ascii "Equation" :default "Équation"))
("Figure") ("Figure"
("de" :default "Abbildung")
("es" :default "Figura"))
("Footnotes" ("Footnotes"
("ca" :html "Peus de p&agrave;gina") ("ca" :html "Peus de p&agrave;gina")
("cs" :default "Pozn\xe1mky pod carou") ("cs" :default "Pozn\xe1mky pod carou")
("da" :default "Fodnoter") ("da" :default "Fodnoter")
("de" :html "Fu&szlig;noten") ("de" :html "Fu&szlig;noten" :default "Fußnoten")
("eo" :default "Piednotoj") ("eo" :default "Piednotoj")
("es" :html "Pies de p&aacute;gina") ("es" :html "Nota al pie de p&aacute;gina" :default "Nota al pie de página")
("fi" :default "Alaviitteet") ("fi" :default "Alaviitteet")
("fr" :default "Notes de bas de page") ("fr" :default "Notes de bas de page")
("hu" :html "L&aacute;bjegyzet") ("hu" :html "L&aacute;bjegyzet")
@ -5287,26 +5291,28 @@ them."
("zh-CN" :html "&#33050;&#27880;" :utf-8 "脚注") ("zh-CN" :html "&#33050;&#27880;" :utf-8 "脚注")
("zh-TW" :html "&#33139;&#35387;" :utf-8 "腳註")) ("zh-TW" :html "&#33139;&#35387;" :utf-8 "腳註"))
("List of Listings" ("List of Listings"
("de" :default "Programmauflistungsverzeichnis")
("es" :default "Indice de Listados de programas")
("fr" :default "Liste des programmes")) ("fr" :default "Liste des programmes"))
("List of Tables" ("List of Tables"
("de" :default "Tabellenverzeichnis")
("es" :default "Indice de tablas")
("fr" :default "Liste des tableaux")) ("fr" :default "Liste des tableaux"))
("Listing %d:" ("Listing %d:"
("de" :default "Programmlisting %d")
("es" :default "Listado de programa %d")
("fr" ("fr"
:ascii "Programme %d :" :default "Programme nº %d :" :ascii "Programme %d :" :default "Programme nº %d :"
:latin1 "Programme %d :")) :latin1 "Programme %d :"))
("Listing %d: %s"
("fr"
:ascii "Programme %d : %s" :default "Programme nº %d : %s"
:latin1 "Programme %d : %s"))
("See section %s" ("See section %s"
("de" :default "siehe Abschnitt %s")
("es" :default "vea seccion %s")
("fr" :default "cf. section %s")) ("fr" :default "cf. section %s"))
("Table %d:" ("Table %d:"
("de" :default "Tabelle %d")
("es" :default "Tabla %d")
("fr" ("fr"
:ascii "Tableau %d :" :default "Tableau nº %d :" :latin1 "Tableau %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"))
("Table of Contents" ("Table of Contents"
("ca" :html "&Iacute;ndex") ("ca" :html "&Iacute;ndex")
("cs" :default "Obsah") ("cs" :default "Obsah")
@ -5332,6 +5338,8 @@ them."
("zh-CN" :html "&#30446;&#24405;" :utf-8 "目录") ("zh-CN" :html "&#30446;&#24405;" :utf-8 "目录")
("zh-TW" :html "&#30446;&#37636;" :utf-8 "目錄")) ("zh-TW" :html "&#30446;&#37636;" :utf-8 "目錄"))
("Unknown reference" ("Unknown reference"
("de" :default "Unbekannter Verweis")
("es" :default "referencia desconocida")
("fr" :ascii "Destination inconnue" :default "Référence inconnue"))) ("fr" :ascii "Destination inconnue" :default "Référence inconnue")))
"Dictionary for export engine. "Dictionary for export engine.