forked from mirrors/org-mode
export-back-ends: Apply changes from b692064e621acbc93876670585f8a4b0fd6a7ffa
* lisp/ox-beamer.el (org-beamer--get-label, org-beamer--frame-level, org-beamer--format-section, org-beamer--format-frame, org-beamer--format-block, org-beamer-headline): Apply changes to properties. * lisp/ox-html.el (org-html-headline, org-html-link, org-html-section): Apply changes to properties. * lisp/ox-icalendar.el (org-icalendar-create-uid, org-icalendar-blocked-headline-p, org-icalendar-entry, org-icalendar--valarm): Apply changes to properties. * lisp/ox-odt.el (org-odt-headline): Apply changes * lisp/ox-publish.el (org-publish-collect-index): Apply changes to properties. * lisp/ox-texinfo.el (org-texinfo--generate-menu-list, org-texinfo--generate-menu-items, org-texinfo-template, org-texinfo-headline, org-texinfo-link): Apply changes to properties. * lisp/ox.el (org-export-resolve-id-link, org-export-get-category): Apply changes to properties. (org-export-get-node-property): Update docstring. * testing/lisp/test-ox.el: Update tests.
This commit is contained in:
parent
ae5932282d
commit
324a2cb3f9
|
@ -378,7 +378,7 @@ INFO is a plist used as a communication channel.
|
|||
The value is either the label specified in \"BEAMER_opt\"
|
||||
property, or a fallback value built from headline's number. This
|
||||
function assumes HEADLINE will be treated as a frame."
|
||||
(let ((opt (org-element-property :beamer-opt headline)))
|
||||
(let ((opt (org-element-property :BEAMER_OPT headline)))
|
||||
(if (and (org-string-nw-p opt)
|
||||
(string-match "\\(?:^\\|,\\)label=\\(.*?\\)\\(?:$\\|,\\)" opt))
|
||||
(match-string 1 opt)
|
||||
|
@ -395,19 +395,19 @@ INFO is a plist used as a communication channel."
|
|||
;; farthest.
|
||||
(catch 'exit
|
||||
(mapc (lambda (parent)
|
||||
(let ((env (org-element-property :beamer-env parent)))
|
||||
(let ((env (org-element-property :BEAMER_ENV parent)))
|
||||
(when (and env (member (downcase env) '("frame" "fullframe")))
|
||||
(throw 'exit (org-export-get-relative-level parent info)))))
|
||||
(nreverse (org-export-get-genealogy headline)))
|
||||
nil)
|
||||
;; 2. Look for "frame" environment in HEADLINE.
|
||||
(let ((env (org-element-property :beamer-env headline)))
|
||||
(let ((env (org-element-property :BEAMER_ENV headline)))
|
||||
(and env (member (downcase env) '("frame" "fullframe"))
|
||||
(org-export-get-relative-level headline info)))
|
||||
;; 3. Look for "frame" environment in sub-tree.
|
||||
(org-element-map headline 'headline
|
||||
(lambda (hl)
|
||||
(let ((env (org-element-property :beamer-env hl)))
|
||||
(let ((env (org-element-property :BEAMER_ENV hl)))
|
||||
(when (and env (member (downcase env) '("frame" "fullframe")))
|
||||
(org-export-get-relative-level hl info))))
|
||||
info 'first-match)
|
||||
|
@ -421,7 +421,7 @@ used as a communication channel."
|
|||
;; Use `latex' back-end output, inserting overlay specifications
|
||||
;; if possible.
|
||||
(let ((latex-headline (org-export-with-backend 'latex headline contents info))
|
||||
(mode-specs (org-element-property :beamer-act headline)))
|
||||
(mode-specs (org-element-property :BEAMER_ACT headline)))
|
||||
(if (and mode-specs
|
||||
(string-match "\\`\\\\\\(.*?\\)\\(?:\\*\\|\\[.*\\]\\)?{"
|
||||
latex-headline))
|
||||
|
@ -443,14 +443,14 @@ used as a communication channel."
|
|||
;; Overlay specification, if any. When surrounded by
|
||||
;; square brackets, consider it as a default
|
||||
;; specification.
|
||||
(let ((action (org-element-property :beamer-act headline)))
|
||||
(let ((action (org-element-property :BEAMER_ACT headline)))
|
||||
(cond
|
||||
((not action) "")
|
||||
((string-match "\\`\\[.*\\]\\'" action )
|
||||
(org-beamer--normalize-argument action 'defaction))
|
||||
(t (org-beamer--normalize-argument action 'action))))
|
||||
;; Options, if any.
|
||||
(let* ((beamer-opt (org-element-property :beamer-opt headline))
|
||||
(let* ((beamer-opt (org-element-property :BEAMER_OPT headline))
|
||||
(options
|
||||
;; Collect options from default value and headline's
|
||||
;; properties. Also add a label for links.
|
||||
|
@ -479,7 +479,7 @@ used as a communication channel."
|
|||
",")
|
||||
'option))
|
||||
;; Title.
|
||||
(let ((env (org-element-property :beamer-env headline)))
|
||||
(let ((env (org-element-property :BEAMER_ENV headline)))
|
||||
(format "{%s}"
|
||||
(if (and env (equal (downcase env) "fullframe")) ""
|
||||
(org-export-data
|
||||
|
@ -500,12 +500,12 @@ used as a communication channel."
|
|||
"Format HEADLINE as a block.
|
||||
CONTENTS holds the contents of the headline. INFO is a plist
|
||||
used as a communication channel."
|
||||
(let* ((column-width (org-element-property :beamer-col headline))
|
||||
(let* ((column-width (org-element-property :BEAMER_COL headline))
|
||||
;; ENVIRONMENT defaults to "block" if none is specified and
|
||||
;; there is no column specification. If there is a column
|
||||
;; specified but still no explicit environment, ENVIRONMENT
|
||||
;; is "column".
|
||||
(environment (let ((env (org-element-property :beamer-env headline)))
|
||||
(environment (let ((env (org-element-property :BEAMER_ENV headline)))
|
||||
(cond
|
||||
;; "block" is the fallback environment.
|
||||
((and (not env) (not column-width)) "block")
|
||||
|
@ -519,14 +519,14 @@ used as a communication channel."
|
|||
org-beamer-environments-extra
|
||||
org-beamer-environments-default))))
|
||||
(title (org-export-data (org-element-property :title headline) info))
|
||||
(options (let ((options (org-element-property :beamer-opt headline)))
|
||||
(options (let ((options (org-element-property :BEAMER_OPT headline)))
|
||||
(if (not options) ""
|
||||
(org-beamer--normalize-argument options 'option))))
|
||||
;; Start a "columns" environment when explicitly requested or
|
||||
;; when there is no previous headline or the previous
|
||||
;; headline do not have a BEAMER_column property.
|
||||
(parent-env (org-element-property
|
||||
:beamer-env (org-export-get-parent-headline headline)))
|
||||
:BEAMER_ENV (org-export-get-parent-headline headline)))
|
||||
(start-columns-p
|
||||
(or (equal environment "columns")
|
||||
(and column-width
|
||||
|
@ -534,7 +534,7 @@ used as a communication channel."
|
|||
(equal (downcase parent-env) "columns")))
|
||||
(or (org-export-first-sibling-p headline info)
|
||||
(not (org-element-property
|
||||
:beamer-col
|
||||
:BEAMER_COL
|
||||
(org-export-get-previous-element
|
||||
headline info)))))))
|
||||
;; End the "columns" environment when explicitly requested or
|
||||
|
@ -547,7 +547,7 @@ used as a communication channel."
|
|||
(equal (downcase parent-env) "columns")))
|
||||
(or (org-export-last-sibling-p headline info)
|
||||
(not (org-element-property
|
||||
:beamer-col
|
||||
:BEAMER_COL
|
||||
(org-export-get-next-element headline info))))))))
|
||||
(concat
|
||||
(when start-columns-p
|
||||
|
@ -571,7 +571,7 @@ used as a communication channel."
|
|||
;; brackets, it is a default overlay specification and
|
||||
;; overlay specification is empty. Otherwise, it is an
|
||||
;; overlay specification and the default one is nil.
|
||||
(let ((action (org-element-property :beamer-act headline)))
|
||||
(let ((action (org-element-property :BEAMER_ACT headline)))
|
||||
(cond
|
||||
((not action) (list (cons "a" "") (cons "A" "")))
|
||||
((string-match "\\`\\[.*\\]\\'" action)
|
||||
|
@ -599,25 +599,25 @@ as a communication channel."
|
|||
(unless (org-element-property :footnote-section-p headline)
|
||||
(let ((level (org-export-get-relative-level headline info))
|
||||
(frame-level (org-beamer--frame-level headline info))
|
||||
(environment (let ((env (org-element-property :beamer-env headline)))
|
||||
(environment (let ((env (org-element-property :BEAMER_ENV headline)))
|
||||
(if (stringp env) (downcase env) "block"))))
|
||||
(cond
|
||||
;; Case 1: Resume frame specified by "BEAMER_ref" property.
|
||||
((equal environment "againframe")
|
||||
(let ((ref (org-element-property :beamer-ref headline)))
|
||||
(let ((ref (org-element-property :BEAMER_REF headline)))
|
||||
;; Reference to frame being resumed is mandatory. Ignore
|
||||
;; the whole headline if it isn't provided.
|
||||
(when (org-string-nw-p ref)
|
||||
(concat "\\againframe"
|
||||
;; Overlay specification.
|
||||
(let ((overlay (org-element-property :beamer-act headline)))
|
||||
(let ((overlay (org-element-property :BEAMER_ACT headline)))
|
||||
(when overlay
|
||||
(org-beamer--normalize-argument
|
||||
overlay
|
||||
(if (string-match "^\\[.*\\]$" overlay) 'defaction
|
||||
'action))))
|
||||
;; Options.
|
||||
(let ((options (org-element-property :beamer-opt headline)))
|
||||
(let ((options (org-element-property :BEAMER_OPT headline)))
|
||||
(when options
|
||||
(org-beamer--normalize-argument options 'option)))
|
||||
;; Resolve reference provided by "BEAMER_ref"
|
||||
|
@ -642,7 +642,7 @@ as a communication channel."
|
|||
;; Case 2: Creation of an appendix is requested.
|
||||
((equal environment "appendix")
|
||||
(concat "\\appendix"
|
||||
(org-element-property :beamer-act headline)
|
||||
(org-element-property :BEAMER_ACT headline)
|
||||
"\n"
|
||||
(make-string (org-element-property :pre-blank headline) ?\n)
|
||||
contents))
|
||||
|
|
|
@ -1839,9 +1839,9 @@ holding contextual information."
|
|||
(org-export-get-headline-number
|
||||
headline info) "-"))
|
||||
(ids (remove 'nil
|
||||
(list (org-element-property :custom-id headline)
|
||||
(list (org-element-property :CUSTOM_ID headline)
|
||||
(concat "sec-" section-number)
|
||||
(org-element-property :id headline))))
|
||||
(org-element-property :ID headline))))
|
||||
(preferred-id (car ids))
|
||||
(extra-ids (cdr ids))
|
||||
(extra-class (org-element-property :html-container-class headline))
|
||||
|
@ -2238,7 +2238,7 @@ INFO is a plist holding contextual information. See
|
|||
;; Case 1: Headline is linked via it's CUSTOM_ID
|
||||
;; property. Use CUSTOM_ID.
|
||||
((string= type "custom-id")
|
||||
(org-element-property :custom-id destination))
|
||||
(org-element-property :CUSTOM_ID destination))
|
||||
;; Case 2: Headline is linked via it's ID property
|
||||
;; or through other means. Use the default href.
|
||||
((member type '("id" "fuzzy"))
|
||||
|
@ -2479,7 +2479,7 @@ holding contextual information."
|
|||
;; Build return value.
|
||||
(format "<div class=\"outline-text-%d\" id=\"text-%s\">\n%s</div>"
|
||||
class-num
|
||||
(or (org-element-property :custom-id parent) section-number)
|
||||
(or (org-element-property :CUSTOM_ID parent) section-number)
|
||||
contents)))))
|
||||
|
||||
;;;; Radio Target
|
||||
|
|
|
@ -293,7 +293,7 @@ a message if the file was modified."
|
|||
(org-map-entries
|
||||
(lambda ()
|
||||
(let ((entry (org-element-at-point)))
|
||||
(unless (org-element-property :id entry)
|
||||
(unless (org-element-property :ID entry)
|
||||
(org-id-get-create)
|
||||
(setq modified-flag t)
|
||||
(forward-line))
|
||||
|
@ -330,7 +330,7 @@ An headline is blocked when either:
|
|||
(cond
|
||||
((not (org-element-property :todo-keyword parent))
|
||||
(throw 'blockedp nil))
|
||||
((org-not-nil (org-element-property :ordered parent))
|
||||
((org-not-nil (org-element-property :ORDERED parent))
|
||||
(let ((sibling current))
|
||||
(while (setq sibling (org-export-get-previous-element
|
||||
sibling info))
|
||||
|
@ -527,20 +527,20 @@ inlinetask within the section."
|
|||
(cons nil (org-element-contents first))))))))
|
||||
(concat
|
||||
(unless (and (plist-get info :icalendar-agenda-view)
|
||||
(not (org-element-property :icalendar-mark entry)))
|
||||
(not (org-element-property :ICALENDAR-MARK entry)))
|
||||
(let ((todo-type (org-element-property :todo-type entry))
|
||||
(uid (or (org-element-property :id entry) (org-id-new)))
|
||||
(uid (or (org-element-property :ID entry) (org-id-new)))
|
||||
(summary (org-icalendar-cleanup-string
|
||||
(or (org-element-property :summary entry)
|
||||
(or (org-element-property :SUMMARY entry)
|
||||
(org-export-data
|
||||
(org-element-property :title entry) info))))
|
||||
(loc (org-icalendar-cleanup-string
|
||||
(org-element-property :location entry)))
|
||||
(org-element-property :LOCATION entry)))
|
||||
;; Build description of the entry from associated
|
||||
;; section (headline) or contents (inlinetask).
|
||||
(desc
|
||||
(org-icalendar-cleanup-string
|
||||
(or (org-element-property :description entry)
|
||||
(or (org-element-property :DESCRIPTION entry)
|
||||
(let ((contents (org-export-data inside info)))
|
||||
(cond
|
||||
((not (org-string-nw-p contents)) nil)
|
||||
|
@ -729,7 +729,7 @@ Return VALARM component as a string, or nil if it isn't allowed."
|
|||
;; (c) only a DISPLAY action is defined. [ESF]
|
||||
(let ((alarm-time
|
||||
(let ((warntime
|
||||
(org-element-property :appt-warntime entry)))
|
||||
(org-element-property :APPT_WARNTIME entry)))
|
||||
(if warntime (string-to-number warntime) 0))))
|
||||
(and (or (> alarm-time 0) (> org-icalendar-alarm-time 0))
|
||||
(org-element-property :hour-start timestamp)
|
||||
|
|
|
@ -1834,8 +1834,8 @@ holding contextual information."
|
|||
(org-export-get-headline-number
|
||||
headline info) "-")))
|
||||
;; Get user-specified labels for the headline.
|
||||
(extra-ids (list (org-element-property :custom-id headline)
|
||||
(org-element-property :id headline)))
|
||||
(extra-ids (list (org-element-property :CUSTOM_ID headline)
|
||||
(org-element-property :ID headline)))
|
||||
;; Extra targets.
|
||||
(extra-targets
|
||||
(mapconcat (lambda (x)
|
||||
|
|
|
@ -930,9 +930,9 @@ its CDR is a string."
|
|||
file
|
||||
(cond
|
||||
((not parent) nil)
|
||||
((let ((id (org-element-property :id parent)))
|
||||
((let ((id (org-element-property :ID parent)))
|
||||
(and id (cons 'id id))))
|
||||
((let ((id (org-element-property :custom-id parent)))
|
||||
((let ((id (org-element-property :CUSTOM-ID parent)))
|
||||
(and id (cons 'custom-id id))))
|
||||
(t (cons 'name
|
||||
(org-element-property :raw-value parent))))))))
|
||||
|
|
|
@ -538,7 +538,7 @@ contextual information."
|
|||
(lambda (head)
|
||||
(and (= (org-export-get-relative-level head info) level)
|
||||
;; Do not take note of footnotes or copying headlines.
|
||||
(not (org-element-property :copying head))
|
||||
(not (org-element-property :COPYING head))
|
||||
(not (org-element-property :footnote-section-p head))
|
||||
;; Collect headline.
|
||||
head))
|
||||
|
@ -556,13 +556,13 @@ menu using `org-texinfo--format-menu'."
|
|||
(loop for headline in items collect
|
||||
(let* ((menu-title (org-texinfo--sanitize-menu
|
||||
(org-export-data
|
||||
(org-element-property :texinfo-menu-title headline)
|
||||
(org-element-property :TEXINFO_MENU_TITLE headline)
|
||||
info)))
|
||||
(title (org-texinfo--sanitize-menu
|
||||
(org-texinfo--sanitize-headline
|
||||
(org-element-property :title headline) info)))
|
||||
(descr (org-export-data
|
||||
(org-element-property :description headline)
|
||||
(org-element-property :DESCRIPTION headline)
|
||||
info))
|
||||
(menu-entry (if (string= "" menu-title) title menu-title))
|
||||
(len (length menu-entry))
|
||||
|
@ -636,7 +636,7 @@ holding export options."
|
|||
(header (nth 1 (assoc class org-texinfo-classes)))
|
||||
(copying
|
||||
(org-element-map (plist-get info :parse-tree) 'headline
|
||||
(lambda (hl) (and (org-element-property :copying hl) hl)) info t))
|
||||
(lambda (hl) (and (org-element-property :COPYING hl) hl)) info t))
|
||||
(dircat (plist-get info :texinfo-dircat))
|
||||
(dirtitle (plist-get info :texinfo-dirtitle))
|
||||
(dirdesc (plist-get info :texinfo-dirdesc))
|
||||
|
@ -899,7 +899,7 @@ holding contextual information."
|
|||
;; Retrieve custom menu title (if any)
|
||||
(menu-title (org-texinfo--sanitize-menu
|
||||
(org-export-data
|
||||
(org-element-property :texinfo-menu-title headline)
|
||||
(org-element-property :TEXINFO_MENU_TITLE headline)
|
||||
info)))
|
||||
;; Retrieve headline text
|
||||
(text (org-texinfo--sanitize-headline
|
||||
|
@ -998,7 +998,7 @@ holding contextual information."
|
|||
((org-element-property :footnote-section-p headline) nil)
|
||||
;; Case 2: This is the `copying' section: ignore it
|
||||
;; This is used elsewhere.
|
||||
((org-element-property :copying headline) nil)
|
||||
((org-element-property :COPYING headline) nil)
|
||||
;; Case 3: An index. If it matches one of the known indexes,
|
||||
;; print it as such following the contents, otherwise
|
||||
;; print the contents and leave the index up to the user.
|
||||
|
@ -1180,7 +1180,7 @@ INFO is a plist holding contextual information. See
|
|||
;; LINK points to an headline. Use the headline as the NODE target
|
||||
(headline
|
||||
(format "@ref{%s,%s}"
|
||||
(or (org-element-property :texinfo-menu-title destination)
|
||||
(or (org-element-property :TEXINFO_MENU_TITLE destination)
|
||||
(org-element-property :title destination))
|
||||
(or desc "")))
|
||||
(otherwise
|
||||
|
@ -1203,7 +1203,7 @@ INFO is a plist holding contextual information. See
|
|||
;; LINK points to an headline. Use the headline as the NODE target
|
||||
(headline
|
||||
(format "@ref{%s,%s}"
|
||||
(or (org-element-property :texinfo-menu-title destination)
|
||||
(or (org-element-property :TEXINFO_MENU_TITLE destination)
|
||||
(org-element-property :title destination))
|
||||
(or desc "")))
|
||||
(otherwise
|
||||
|
|
10
lisp/ox.el
10
lisp/ox.el
|
@ -3498,7 +3498,7 @@ inherited from parent headlines and FILETAGS keywords."
|
|||
(defun org-export-get-node-property (property blob &optional inherited)
|
||||
"Return node PROPERTY value for BLOB.
|
||||
|
||||
PROPERTY is normalized symbol (i.e. `:cookie-data'). BLOB is an
|
||||
PROPERTY is an upcase symbol (i.e. `:COOKIE_DATA'). BLOB is an
|
||||
element or object.
|
||||
|
||||
If optional argument INHERITED is non-nil, the value can be
|
||||
|
@ -3526,13 +3526,13 @@ fail, the fall-back value is \"???\"."
|
|||
(or (let ((headline (if (eq (org-element-type blob) 'headline) blob
|
||||
(org-export-get-parent-headline blob))))
|
||||
;; Almost like `org-export-node-property', but we cannot trust
|
||||
;; `plist-member' as every headline has a `:category'
|
||||
;; `plist-member' as every headline has a `:CATEGORY'
|
||||
;; property, would it be nil or equal to "???" (which has the
|
||||
;; same meaning).
|
||||
(let ((parent headline) value)
|
||||
(catch 'found
|
||||
(while parent
|
||||
(let ((category (org-element-property :category parent)))
|
||||
(let ((category (org-element-property :CATEGORY parent)))
|
||||
(and category (not (equal "???" category))
|
||||
(throw 'found category)))
|
||||
(setq parent (org-element-property :parent parent))))))
|
||||
|
@ -3743,8 +3743,8 @@ tree, a file name or nil. Assume LINK type is either \"id\" or
|
|||
;; First check if id is within the current parse tree.
|
||||
(or (org-element-map (plist-get info :parse-tree) 'headline
|
||||
(lambda (headline)
|
||||
(when (or (string= (org-element-property :id headline) id)
|
||||
(string= (org-element-property :custom-id headline) id))
|
||||
(when (or (string= (org-element-property :ID headline) id)
|
||||
(string= (org-element-property :CUSTOM_ID headline) id))
|
||||
headline))
|
||||
info 'first-match)
|
||||
;; Otherwise, look for external files.
|
||||
|
|
|
@ -1064,7 +1064,7 @@ Paragraph[fn:1]"
|
|||
:prop: value
|
||||
:END:"
|
||||
(org-export-get-node-property
|
||||
:prop (org-element-map tree 'headline 'identity nil t)))))
|
||||
:PROP (org-element-map tree 'headline 'identity nil t)))))
|
||||
;; Test inheritance.
|
||||
(should
|
||||
(equal "value"
|
||||
|
@ -1075,7 +1075,7 @@ Paragraph[fn:1]"
|
|||
** Headline
|
||||
Paragraph"
|
||||
(org-export-get-node-property
|
||||
:prop (org-element-map tree 'paragraph 'identity nil t) t))))
|
||||
:PROP (org-element-map tree 'paragraph 'identity nil t) t))))
|
||||
;; Cannot return a value before the first headline.
|
||||
(should-not
|
||||
(org-test-with-parsed-data "Paragraph
|
||||
|
@ -1084,7 +1084,7 @@ Paragraph[fn:1]"
|
|||
:prop: value
|
||||
:END:"
|
||||
(org-export-get-node-property
|
||||
:prop (org-element-map tree 'paragraph 'identity nil t)))))
|
||||
:PROP (org-element-map tree 'paragraph 'identity nil t)))))
|
||||
|
||||
(ert-deftest test-org-export/get-category ()
|
||||
"Test `org-export-get-category' specifications."
|
||||
|
@ -1406,7 +1406,7 @@ Another text. (ref:text)
|
|||
;; 1. Regular test for custom-id link.
|
||||
(org-test-with-parsed-data "* Headline1
|
||||
:PROPERTIES:
|
||||
:CUSTOM-ID: test
|
||||
:CUSTOM_ID: test
|
||||
:END:
|
||||
* Headline 2
|
||||
\[[#test]]"
|
||||
|
@ -1416,7 +1416,7 @@ Another text. (ref:text)
|
|||
;; 2. Failing test for custom-id link.
|
||||
(org-test-with-parsed-data "* Headline1
|
||||
:PROPERTIES:
|
||||
:CUSTOM-ID: test
|
||||
:CUSTOM_ID: test
|
||||
:END:
|
||||
* Headline 2
|
||||
\[[#no-match]]"
|
||||
|
|
Loading…
Reference in New Issue