forked from mirrors/org-mode
Merge branch 'maint'
This commit is contained in:
commit
15baadd8af
96
lisp/ox.el
96
lisp/ox.el
|
@ -117,7 +117,7 @@
|
||||||
(:section-numbers nil "num" org-export-with-section-numbers)
|
(:section-numbers nil "num" org-export-with-section-numbers)
|
||||||
(:select-tags "SELECT_TAGS" nil org-export-select-tags split)
|
(:select-tags "SELECT_TAGS" nil org-export-select-tags split)
|
||||||
(:time-stamp-file nil "timestamp" org-export-time-stamp-file)
|
(:time-stamp-file nil "timestamp" org-export-time-stamp-file)
|
||||||
(:title "TITLE" nil nil space)
|
(:title "TITLE" nil org-export--default-title space)
|
||||||
(:with-archived-trees nil "arch" org-export-with-archived-trees)
|
(:with-archived-trees nil "arch" org-export-with-archived-trees)
|
||||||
(:with-author nil "author" org-export-with-author)
|
(:with-author nil "author" org-export-with-author)
|
||||||
(:with-clocks nil "c" org-export-with-clocks)
|
(:with-clocks nil "c" org-export-with-clocks)
|
||||||
|
@ -1707,51 +1707,47 @@ Assume buffer is in Org mode. Narrowing, if any, is ignored."
|
||||||
|
|
||||||
(defun org-export--get-buffer-attributes ()
|
(defun org-export--get-buffer-attributes ()
|
||||||
"Return properties related to buffer attributes, as a plist."
|
"Return properties related to buffer attributes, as a plist."
|
||||||
(let ((visited-file (buffer-file-name (buffer-base-buffer))))
|
;; Store full path of input file name, or nil. For internal use.
|
||||||
(list
|
(list :input-file (buffer-file-name (buffer-base-buffer))))
|
||||||
;; Store full path of input file name, or nil. For internal use.
|
|
||||||
:input-file visited-file
|
(defvar org-export--default-title) ; Dynamically scoped.
|
||||||
:title (or (and visited-file
|
(defun org-export-store-default-title ()
|
||||||
(file-name-sans-extension
|
"Return default title for current document, as a string.
|
||||||
(file-name-nondirectory visited-file)))
|
Title is extracted from associated file name, if any, or buffer's
|
||||||
(buffer-name (buffer-base-buffer))))))
|
name."
|
||||||
|
(setq org-export--default-title
|
||||||
|
(or (let ((visited-file (buffer-file-name (buffer-base-buffer))))
|
||||||
|
(and visited-file
|
||||||
|
(file-name-sans-extension
|
||||||
|
(file-name-nondirectory visited-file))))
|
||||||
|
(buffer-name (buffer-base-buffer)))))
|
||||||
|
|
||||||
(defun org-export--get-global-options (&optional backend)
|
(defun org-export--get-global-options (&optional backend)
|
||||||
"Return global export options as a plist.
|
"Return global export options as a plist.
|
||||||
|
|
||||||
Optional argument BACKEND, if non-nil, is a symbol specifying
|
Optional argument BACKEND, if non-nil, is a symbol specifying
|
||||||
which back-end specific export options should also be read in the
|
which back-end specific export options should also be read in the
|
||||||
process."
|
process."
|
||||||
(let ((all
|
(let (plist
|
||||||
;; Priority is given to back-end specific options.
|
;; Priority is given to back-end specific options.
|
||||||
(append (and backend (org-export-backend-options backend))
|
(all (append (and backend (org-export-backend-options backend))
|
||||||
org-export-options-alist))
|
org-export-options-alist)))
|
||||||
plist)
|
(dolist (cell all plist)
|
||||||
(mapc
|
(let ((prop (car cell)))
|
||||||
(lambda (cell)
|
(unless (plist-member plist prop)
|
||||||
(let ((prop (car cell)))
|
(setq plist
|
||||||
(unless (plist-member plist prop)
|
(plist-put
|
||||||
(let ((value (eval (nth 3 cell))))
|
plist
|
||||||
;; Only set property if default value is non-nil.
|
prop
|
||||||
(when value
|
;; Eval default value provided. If keyword is
|
||||||
(setq plist
|
;; a member of `org-element-document-properties',
|
||||||
(plist-put
|
;; parse it as a secondary string before storing it.
|
||||||
plist
|
(let ((value (eval (nth 3 cell))))
|
||||||
prop
|
(if (not (stringp value)) value
|
||||||
;; If keyword belongs to
|
(let ((keyword (nth 1 cell)))
|
||||||
;; `org-element-document-properties', parse
|
(if (member keyword org-element-document-properties)
|
||||||
;; default value as a secondary string before
|
(org-element-parse-secondary-string
|
||||||
;; storing it.
|
value (org-element-restriction 'keyword))
|
||||||
(if (not (stringp value)) value
|
value)))))))))))
|
||||||
(let ((keyword (nth 1 cell)))
|
|
||||||
(if (not (member keyword
|
|
||||||
org-element-document-properties))
|
|
||||||
value
|
|
||||||
(org-element-parse-secondary-string
|
|
||||||
value (org-element-restriction 'keyword))))))))))))
|
|
||||||
all)
|
|
||||||
;; Return value.
|
|
||||||
plist))
|
|
||||||
|
|
||||||
(defun org-export--list-bound-variables ()
|
(defun org-export--list-bound-variables ()
|
||||||
"Return variables bound from BIND keywords in current buffer.
|
"Return variables bound from BIND keywords in current buffer.
|
||||||
|
@ -2929,14 +2925,18 @@ Return code as a string."
|
||||||
(narrow-to-region (point) (point-max))))
|
(narrow-to-region (point) (point-max))))
|
||||||
;; Initialize communication channel with original buffer
|
;; Initialize communication channel with original buffer
|
||||||
;; attributes, unavailable in its copy.
|
;; attributes, unavailable in its copy.
|
||||||
(let ((info (org-combine-plists
|
(let* ((info (org-combine-plists
|
||||||
(list :export-options
|
(list :export-options
|
||||||
(delq nil
|
(delq nil
|
||||||
(list (and subtreep 'subtree)
|
(list (and subtreep 'subtree)
|
||||||
(and visible-only 'visible-only)
|
(and visible-only 'visible-only)
|
||||||
(and body-only 'body-only))))
|
(and body-only 'body-only))))
|
||||||
(org-export--get-buffer-attributes)))
|
(org-export--get-buffer-attributes)))
|
||||||
tree)
|
tree)
|
||||||
|
;; Store default title in `org-export--default-title' so that
|
||||||
|
;; `org-export-get-environment' can access it from buffer's
|
||||||
|
;; copy and then add it properly to communication channel.
|
||||||
|
(org-export-store-default-title)
|
||||||
;; Update communication channel and get parse tree. Buffer
|
;; Update communication channel and get parse tree. Buffer
|
||||||
;; isn't parsed directly. Instead, a temporary copy is
|
;; isn't parsed directly. Instead, a temporary copy is
|
||||||
;; created, where include keywords, macros are expanded and
|
;; created, where include keywords, macros are expanded and
|
||||||
|
|
|
@ -279,7 +279,8 @@ Paragraph"
|
||||||
(let (org-export-registered-backends)
|
(let (org-export-registered-backends)
|
||||||
(org-export-define-backend 'test
|
(org-export-define-backend 'test
|
||||||
'((template . (lambda (text info)
|
'((template . (lambda (text info)
|
||||||
(org-export-data (plist-get info :title) info)))))
|
(org-element-interpret-data
|
||||||
|
(plist-get info :title) info)))))
|
||||||
(list (org-export-as 'test)
|
(list (org-export-as 'test)
|
||||||
(file-name-nondirectory
|
(file-name-nondirectory
|
||||||
(file-name-sans-extension (buffer-file-name))))))))
|
(file-name-sans-extension (buffer-file-name))))))))
|
||||||
|
@ -293,7 +294,8 @@ Paragraph"
|
||||||
(let (org-export-registered-backends)
|
(let (org-export-registered-backends)
|
||||||
(org-export-define-backend 'test
|
(org-export-define-backend 'test
|
||||||
'((template . (lambda (text info)
|
'((template . (lambda (text info)
|
||||||
(org-export-data (plist-get info :title) info)))))
|
(org-element-interpret-data
|
||||||
|
(plist-get info :title) info)))))
|
||||||
(list (org-export-as 'test) (buffer-name))))))
|
(list (org-export-as 'test) (buffer-name))))))
|
||||||
;; If a title is specified, use it.
|
;; If a title is specified, use it.
|
||||||
(should
|
(should
|
||||||
|
@ -304,7 +306,8 @@ Paragraph"
|
||||||
(let (org-export-registered-backends)
|
(let (org-export-registered-backends)
|
||||||
(org-export-define-backend 'test
|
(org-export-define-backend 'test
|
||||||
'((template . (lambda (text info)
|
'((template . (lambda (text info)
|
||||||
(org-export-data (plist-get info :title) info)))))
|
(org-element-interpret-data
|
||||||
|
(plist-get info :title) info)))))
|
||||||
(org-export-as 'test)))))
|
(org-export-as 'test)))))
|
||||||
;; If an empty title is specified, do not set it.
|
;; If an empty title is specified, do not set it.
|
||||||
(should
|
(should
|
||||||
|
@ -315,7 +318,8 @@ Paragraph"
|
||||||
(let (org-export-registered-backends)
|
(let (org-export-registered-backends)
|
||||||
(org-export-define-backend 'test
|
(org-export-define-backend 'test
|
||||||
'((template . (lambda (text info)
|
'((template . (lambda (text info)
|
||||||
(org-export-data (plist-get info :title) info)))))
|
(org-element-interpret-data
|
||||||
|
(plist-get info :title) info)))))
|
||||||
(org-export-as 'test))))))
|
(org-export-as 'test))))))
|
||||||
|
|
||||||
(ert-deftest test-org-export/handle-options ()
|
(ert-deftest test-org-export/handle-options ()
|
||||||
|
|
Loading…
Reference in a new issue