diff --git a/EXPERIMENTAL/org-e-html.el b/EXPERIMENTAL/org-e-html.el index bb5c80d8f..7e3eb30c0 100644 --- a/EXPERIMENTAL/org-e-html.el +++ b/EXPERIMENTAL/org-e-html.el @@ -56,6 +56,7 @@ (declare-function org-element-parse-secondary-string "org-element" (string restriction &optional buffer)) (defvar org-element-string-restrictions) +(defvar org-element-object-restrictions) (declare-function org-export-clean-table "org-export" (table specialp)) (declare-function org-export-data "org-export" (data backend info)) @@ -1566,10 +1567,13 @@ This function shouldn't be used for floats. See (when (plist-get info :style-include-scripts) org-e-html-scripts))) -(defun org-e-html-mathjax-config (template options in-buffer) +(defun org-e-html-mathjax-config (info) "Insert the user setup into the matchjax template." (when (member (plist-get info :LaTeX-fragments) '(mathjax t)) - (let (name val (yes " ") (no "// ") x) + (let ((template org-e-html-mathjax-template) + (options org-e-html-mathjax-options) + (in-buffer (or (plist-get info :mathjax) "")) + name val (yes " ") (no "// ") x) (mapc (lambda (e) (setq name (car e) val (nth 1 e)) @@ -1725,9 +1729,7 @@ original parsed data. INFO is a plist holding export options."
" (org-e-html-meta-info info) ; meta (org-e-html-style info) ; style - (org-e-html-mathjax-config ; mathjax - org-e-html-mathjax-template org-e-html-mathjax-options - (or (plist-get info :mathjax) "")) + (org-e-html-mathjax-config info) ; mathjax " " @@ -2061,7 +2063,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." (concat ;; Insert separator between two footnotes in a row. (let ((prev (org-export-get-previous-element footnote-reference info))) - (when (and (listp prev) (eq (car prev) 'footnote-reference)) + (when (eq (org-element-type prev) 'footnote-reference) org-e-html-footnote-separator)) (cond ((not (org-export-footnote-first-reference-p footnote-reference info)) @@ -2092,7 +2094,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." "Transcode an HEADLINE element from Org to HTML. CONTENTS holds the contents of the headline. INFO is a plist holding contextual information." - (let* ((numberedp (plist-get info :section-numbers)) + (let* ((numberedp (org-export-numbered-headline-p headline info)) (level (org-export-get-relative-level headline info)) (todo (and (plist-get info :with-todo-keywords) (let ((todo (org-element-property @@ -2126,7 +2128,7 @@ holding contextual information." CONTENTS holds the contents of the headline. INFO is a plist holding contextual information." (let* ((class (plist-get info :latex-class)) - (numberedp (plist-get info :section-numbers)) + (numberedp (org-export-numbered-headline-p headline info)) ;; Get level relative to current parsed data. (level (org-export-get-relative-level headline info)) ;; (class-sectionning (assoc class org-e-html-classes)) @@ -2396,8 +2398,8 @@ CONTENTS is nil. INFO is a plist holding contextual information." (cond ((string= key "latex") value) ((string= key "index") (format "\\index{%s}" value)) - ((string= key "target") - (format "\\label{%s}" (org-export-solidify-link-text value))) + ;; Invisible targets. + ((string= key "target") nil) ; FIXME ((string= key "toc") (let ((value (downcase value))) (cond @@ -2545,50 +2547,58 @@ INFO is a plist holding contextual information. See (cond ;; Image file. (imagep (org-e-html-link--inline-image link info)) - ;; Target or radioed target: replace link with the normalized - ;; custom-id/target name. - ((member type '("target" "radio")) + ;; Radioed target: Target's name is obtained from original raw + ;; link. Path is parsed and transcoded in order to have a proper + ;; display of the contents. + ((string= type "radio") (format "%s" (org-export-solidify-link-text path) - (or desc (org-export-secondary-string path 'e-html info)))) + (org-export-secondary-string + (org-element-parse-secondary-string + path (cdr (assq 'radio-target org-element-object-restrictions))) + 'e-html info))) ;; Links pointing to an headline: Find destination and build - ;; appropriate referencing commanding. + ;; 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)))) - ;; Fuzzy link points to a target. Do as above. (case (org-element-type destination) - (target - (format "%s" - (org-export-solidify-link-text (org-element-property - :raw-value destination)) + ;; Fuzzy link points nowhere. + ('nil + (format "%s" (or desc (org-export-secondary-string (org-element-property :raw-link link) 'e-html info)))) - ;; Fuzzy link points to an headline. If headlines are - ;; numbered and the link has no description, display - ;; headline's number. Otherwise, display description or - ;; headline's title. + ;; Fuzzy link points to an invisible target. + (keyword nil) + ;; LINK points to an headline. If headlines are numbered + ;; and the link has no description, display headline's + ;; number. Otherwise, display description or headline's + ;; title. (headline - (let ((label - (format "sec-%s" - (mapconcat - 'number-to-string - (org-export-get-headline-number destination info) - "-")))) - (if (and (plist-get info :section-numbers) (not desc)) - (format "\\ref{%s}" label) - (format "%s" - label (or desc - (org-export-secondary-string - (org-element-property :title destination) - 'e-html info)))))) - ;; Fuzzy link points nowhere. + (let* ((headline-no (org-export-get-headline-number destination info)) + (label (format "sec-%s" (mapconcat 'number-to-string + headline-no "-"))) + (section-no (mapconcat 'number-to-string headline-no "."))) + (setq desc + (cond + (desc desc) + ((plist-get info :section-numbers) section-no) + (t (org-export-secondary-string + (org-element-property :title destination) + 'e-html info)))) + (format "%s" label desc))) + ;; Fuzzy link points to a target. Do as above. (otherwise - (format "%s" (or desc (org-export-secondary-string - (org-element-property :raw-link link) - 'e-html info))))))) + (let ((path (org-export-solidify-link-text path))) + (unless desc + (setq desc (let ((number (org-export-get-ordinal + destination info))) + (when number + (if (atom number) (number-to-string number) + (mapconcat 'number-to-string number ".")))))) + (format "%s" path (or desc "FIXME"))))))) ;; Coderef: replace link with the reference name or the ;; equivalent line number. ((string= type "coderef") @@ -2635,7 +2645,7 @@ the plist used as a communication channel." (class (cdr (assoc style '((footnote . "footnote") (verse . nil))))) (extra (if class (format " class=\"%s\"" class) "")) - (parent (car (org-export-get-genealogy paragraph info)))) + (parent (org-export-get-parent paragraph info))) (cond ((and (equal (car parent) 'item) (= (org-element-property :begin paragraph) @@ -3060,13 +3070,13 @@ CONTENTS is nil. INFO is a plist holding contextual information." ;;;; Target -(defun org-e-html-target (target text info) +(defun org-e-html-target (target contents info) "Transcode a TARGET object from Org to HTML. -TEXT is the text of the target. INFO is a plist holding -contextual information." +CONTENTS is nil. INFO is a plist holding contextual +information." (let ((id (org-export-solidify-link-text - (org-element-property :raw-value target)))) - (format "%s" id id text))) + (org-element-property :value target)))) + (format "" id id))) ;;;; Time-stamp diff --git a/EXPERIMENTAL/org-e-odt.el b/EXPERIMENTAL/org-e-odt.el index 9cbf9299e..ece643fbe 100644 --- a/EXPERIMENTAL/org-e-odt.el +++ b/EXPERIMENTAL/org-e-odt.el @@ -1838,6 +1838,7 @@ formula file." (declare-function org-element-parse-secondary-string "org-element" (string restriction &optional buffer)) (defvar org-element-string-restrictions) +(defvar org-element-object-restrictions) (declare-function org-export-clean-table "org-export" (table specialp)) (declare-function org-export-data "org-export" (data backend info)) @@ -3488,7 +3489,8 @@ CONTENTS is nil. INFO is a plist holding contextual information." (defun org-e-odt-footnote-def (raw info) ; FIXME (if (equal (org-element-type raw) 'org-data) - (org-trim (org-export-data raw 'e-odt info)) + (org-trim (org-export-data raw 'e-odt info)) ; fix paragraph + ; style (org-odt-format-stylized-paragraph 'footnote (org-trim (org-export-secondary-string raw 'e-odt info))))) @@ -3501,7 +3503,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." (concat ;; Insert separator between two footnotes in a row. (let ((prev (org-export-get-previous-element footnote-reference info))) - (when (and (listp prev) (eq (car prev) 'footnote-reference)) + (when (eq (org-element-type prev) 'footnote-reference) org-e-odt-footnote-separator)) (cond ((not (org-export-footnote-first-reference-p footnote-reference info)) @@ -3536,7 +3538,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." "Transcode an HEADLINE element from Org to HTML. CONTENTS holds the contents of the headline. INFO is a plist holding contextual information." - (let* ((numberedp (plist-get info :section-numbers)) + (let* ((numberedp (org-export-numbered-headline-p headline info)) (level (org-export-get-relative-level headline info)) (todo (and (plist-get info :with-todo-keywords) (let ((todo (org-element-property @@ -3570,7 +3572,7 @@ holding contextual information." CONTENTS holds the contents of the headline. INFO is a plist holding contextual information." (let* ((class (plist-get info :latex-class)) - (numberedp (plist-get info :section-numbers)) + (numberedp (org-export-numbered-headline-p headline info)) ;; Get level relative to current parsed data. (level (org-export-get-relative-level headline info)) ;; (class-sectionning (assoc class org-e-odt-classes)) @@ -3789,8 +3791,9 @@ CONTENTS is nil. INFO is a plist holding contextual information." (cond ((string= key "latex") value) ((string= key "index") (format "\\index{%s}" value)) - ((string= key "target") - (format "\\label{%s}" (org-export-solidify-link-text value))) + ((string= key "target") nil ; FIXME + ;; (format "\\label{%s}" (org-export-solidify-link-text value)) + ) ((string= key "toc") (let ((value (downcase value))) (cond @@ -3942,53 +3945,58 @@ INFO is a plist holding contextual information. See (cond ;; Image file. (imagep (org-e-odt-link--inline-image link info)) - ;; Target or radioed target: replace link with the normalized - ;; custom-id/target name. - ((member type '("target" "radio")) + ;; Radioed target: Target's name is obtained from original raw + ;; link. Path is parsed and transcoded in order to have a proper + ;; display of the contents. + ((string= type "radio") (org-e-odt-format-internal-link - (or desc (org-export-secondary-string path 'e-odt info)) + (org-export-secondary-string + (org-element-parse-secondary-string + path (cdr (assq 'radio-target org-element-object-restrictions))) + 'e-odt info) (org-export-solidify-link-text path))) ;; Links pointing to an headline: Find destination and build - ;; appropriate referencing commanding. + ;; 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)))) - ;; Fuzzy link points to a target. Do as above. (case (org-element-type destination) - (target - (org-e-odt-format-internal-link - (or desc - (org-export-secondary-string - (org-element-property :raw-link link) - 'e-odt info)) - (org-export-solidify-link-text - (org-element-property :raw-value destination)))) - ;; Fuzzy link points to an headline. If headlines are - ;; numbered and the link has no description, display - ;; headline's number. Otherwise, display description or - ;; headline's title. - (headline - (let ((label - (format "sec-%s" - (mapconcat - 'number-to-string - (org-export-get-headline-number destination info) - "-")))) - (if (and (plist-get info :section-numbers) (not desc)) - (format "\\ref{%s}" label) - (org-e-odt-format-internal-link - (or desc - (org-export-secondary-string - (org-element-property :title destination) - 'e-odt info)) label)))) ;; Fuzzy link points nowhere. - (otherwise + ('nil (org-e-odt-format-fontify - (or desc - (org-export-secondary-string - (org-element-property :raw-link link) - 'e-odt info)) 'emphasis))))) + (or desc (org-export-secondary-string + (org-element-property :raw-link link) + 'e-odt info)) 'emphasis)) + ;; Fuzzy link points to an invisible target. + (keyword nil) + ;; LINK points to an headline. If headlines are numbered + ;; and the link has no description, display headline's + ;; number. Otherwise, display description or headline's + ;; title. + (headline + (let* ((headline-no (org-export-get-headline-number destination info)) + (label (format "sec-%s" (mapconcat 'number-to-string + headline-no "-"))) + (section-no (mapconcat 'number-to-string headline-no "."))) + (setq desc + (cond + (desc desc) + ((plist-get info :section-numbers) section-no) + (t (org-export-secondary-string + (org-element-property :title destination) + 'e-odt info)))) + (org-e-odt-format-internal-link desc label))) + ;; Fuzzy link points to a target. Do as above. + (otherwise + (let ((path (org-export-solidify-link-text path))) + (unless desc + (setq desc (let ((number (org-export-get-ordinal + destination info))) + (when number + (if (atom number) (number-to-string number) + (mapconcat 'number-to-string number ".")))))) + (org-e-odt-format-internal-link (or desc "FIXME") path)))))) ;; Coderef: replace link with the reference name or the ;; equivalent line number. ((string= type "coderef") @@ -4032,7 +4040,7 @@ the plist used as a communication channel." (class (cdr (assoc style '((footnote . "footnote") (verse . nil))))) (extra (if class (format " class=\"%s\"" class) "")) - (parent (car (org-export-get-genealogy paragraph info))) + (parent (org-export-get-parent paragraph info)) (parent-type (org-element-type parent)) (style (case parent-type (quote-block 'quote) @@ -4384,13 +4392,12 @@ CONTENTS is nil. INFO is a plist holding contextual information." ;;;; Target -(defun org-e-odt-target (target text info) +(defun org-e-odt-target (target contents info) "Transcode a TARGET object from Org to HTML. -TEXT is the text of the target. INFO is a plist holding -contextual information." +CONTENTS is nil. INFO is a plist holding contextual +information." (org-e-odt-format-anchor - text (org-export-solidify-link-text - (org-element-property :raw-value target)))) + "" (org-export-solidify-link-text (org-element-property :value target)))) ;;;; Time-stamp diff --git a/doc/org.texi b/doc/org.texi index f529a7d25..33ffe28ea 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -14098,6 +14098,14 @@ evaluation. If @code{:noweb no}, the default, then the reference is not expanded before evaluation. See the @ref{noweb-ref} header argument for a more flexible way to resolve noweb references. +It is possible to include the @emph{results} of a code block rather than the +body. This is done by appending parenthesis to the code block name which may +optionally contain arguments to the code block as shown below. + +@example +<