mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2025-02-08 21:38:10 +00:00
org-element: Rename accessors
* contrib/lisp/org-element.el (org-element-property, org-element-contents): New functions, renamed from, respecively `org-element-get-property' and `org-element-get-contents'. (org-element-link-successor): Small refactoring. (org-element-drawer-interpreter, org-element-dynamic-block-interpreter, org-element-footnote-definition-interpreter, org-element-headline-interpreter, org-element-inlinetask-interpreter, org-element-item-interpreter, org-element-special-block-interpreter, org-element-babel-call-interpreter, org-element-comment-interpreter, org-element-comment-block-interpreter, org-element-example-block-interpreter, org-element-export-block-interpreter, org-element-fixed-width-interpreter, org-element-keyword-interpreter, org-element-latex-environment-interpreter, org-element-property-drawer-interpreter, org-element-quote-section-interpreter, org-element-src-block-interpreter, org-element-table-interpreter, org-element-verse-block-interpreter, org-element-emphasis-interpreter, org-element-entity-interpreter, org-element-export-snippet-interpreter, org-element-footnote-reference-interpreter, org-element-inline-babel-call-interpreter, org-element-inline-src-block-interpreter, org-element-latex-fragment-interpreter, org-element-link-interpreter, org-element-macro-interpreter, org-element-statistics-cookie-interpreter, org-element-subscript-interpreter, org-element-superscript-interpreter, org-element-time-stamp-interpreter, org-element-verbatim-interpreter, org-element-map, org-element-parse-elements, org-element-parse-objects, org-element-interpret-data, org-element-interpret--affiliated-keywords, org-element-normalize-contents, org-element-swap-A-B, org-element-backward, org-element-drag-backward, org-element-drag-forward, org-element-forward, org-element-mark-element, org-narrow-to-element, org-transpose-elements, org-element-unindent-buffer, org-element-up): Use new names. * contrib/lisp/org-export.el (org-export-get-inbuffer-options, org-export-use-select-tags-p, org-export-get-min-level, org-export-data, org-export-skip-p, org-export-interpret-p, org-export-collect-footnote-definitions, org-export-footnote-first-reference-p, org-export-get-footnote-number, org-export-get-relative-level, org-export-last-sibling-p, org-export-inline-image-p, org-export-resolve-fuzzy-link, org-export-resolve-id-link, org-export-resolve-ref-link, org-export-resolve-coderef, org-export-expand-macro, org-export-get-loc, org-export-handle-code, org-export-collect-elements, org-export-get-genealogy, org-export-get-previous-element): Use new names. * EXPERIMENTAL/org-e-ascii.el (org-e-ascii--current-text-width, org-e-ascii--build-title, org-e-ascii--build-caption, org-e-ascii--list-listings, org-e-ascii--list-tables, org-e-ascii--unique-links, org-e-ascii--describe-links, org-e-ascii-template, org-e-ascii-drawer, org-e-ascii-emphasis, org-e-ascii-entity, org-e-ascii-export-snippet, org-e-ascii-export-block, org-e-ascii-fixed-width, org-e-ascii-headline, org-e-ascii-horizontal-rule, org-e-ascii-inline-src-block, org-e-ascii-inlinetask, org-e-ascii-item, org-e-ascii-keyword, org-e-ascii-latex-environment, org-e-ascii-latex-fragment, org-e-ascii-link, org-e-ascii-paragraph, org-e-ascii-quote-section, org-e-ascii-statistics-cookie, org-e-ascii-subscript, org-e-ascii-superscript, org-e-ascii-table, org-e-ascii-verbatim, org-e-ascii-verse-block): Use new names * EXPERIMENTAL/org-e-latex.el (org-e-latex--wrap-label, org-e-latex-drawer, org-e-latex-emphasis, org-e-latex-entity, org-e-latex-example-block, org-e-latex-export-snippet, org-e-latex-export-block, org-e-latex-fixed-width, org-e-latex-footnote-reference, org-e-latex-headline, org-e-latex-link--inline-image, org-e-latex-latex-fragment, org-e-latex-latex-environment, org-e-latex-keyword, org-e-latex-item, org-e-latex-inlinetask, org-e-latex-inline-src-block, org-e-latex-special-block, org-e-latex-radio-target, org-e-latex-quote-section, org-e-latex-plain-list, org-e-latex-src-block, org-e-latex-statistics-cookie, org-e-latex-table--format-string, org-e-latex-target, org-e-latex-time-stamp, org-e-latex-verbatim): Use new names * EXPERIMENTAL/org-e-publish.el (org-e-publish-collect-index, org-e-publish-index-generate-theindex): Use new names.
This commit is contained in:
parent
0ff3d47d13
commit
60caccc7e9
@ -34,8 +34,8 @@
|
||||
|
||||
(eval-when-compile (require 'cl))
|
||||
|
||||
(declare-function org-element-get-contents "org-element" (element))
|
||||
(declare-function org-element-get-property "org-element" (property element))
|
||||
(declare-function org-element-contents "org-element" (element))
|
||||
(declare-function org-element-property "org-element" (property element))
|
||||
(declare-function org-element-normalize-string "org-element" (s))
|
||||
(declare-function org-element-map "org-element"
|
||||
(data types fun &optional info first-match))
|
||||
@ -559,8 +559,8 @@ INFO is a plist used as a communication channel."
|
||||
;; the list and current item bullet's length. Also
|
||||
;; remove tag length (for description lists) or bullet
|
||||
;; length.
|
||||
(let ((struct (org-element-get-property :structure parent-item))
|
||||
(beg-item (org-element-get-property :begin parent-item)))
|
||||
(let ((struct (org-element-property :structure parent-item))
|
||||
(beg-item (org-element-property :begin parent-item)))
|
||||
(+ (- (org-list-get-ind beg-item struct)
|
||||
(org-list-get-ind
|
||||
(org-list-get-top-point struct) struct))
|
||||
@ -598,19 +598,19 @@ title."
|
||||
(org-export-get-headline-number element info) ".")
|
||||
" ")))
|
||||
(text (org-export-secondary-string
|
||||
(org-element-get-property :title element) 'e-ascii info))
|
||||
(org-element-property :title element) 'e-ascii info))
|
||||
(todo
|
||||
(and (plist-get info :with-todo-keywords)
|
||||
(let ((todo (org-element-get-property :todo-keyword element)))
|
||||
(let ((todo (org-element-property :todo-keyword element)))
|
||||
(and todo
|
||||
(concat (org-export-secondary-string todo 'e-ascii info)
|
||||
" ")))))
|
||||
(tags (and (not notags)
|
||||
(plist-get info :with-tags)
|
||||
(org-element-get-property :tags element)))
|
||||
(org-element-property :tags element)))
|
||||
(priority
|
||||
(and (plist-get info :with-priority)
|
||||
(concat (org-element-get-property :priority element) " ")))
|
||||
(concat (org-element-property :priority element) " ")))
|
||||
(first-part (concat numbers todo priority text)))
|
||||
(concat
|
||||
first-part
|
||||
@ -640,16 +640,16 @@ The caption string contains the sequence number of ELEMENT if it
|
||||
has a name affiliated keyword, along with the real caption, if
|
||||
any. Return nil when ELEMENT has no affiliated caption or name
|
||||
keyword."
|
||||
(let ((caption (org-element-get-property :caption element))
|
||||
(name (org-element-get-property :name element)))
|
||||
(let ((caption (org-element-property :caption element))
|
||||
(name (org-element-property :name element)))
|
||||
(when (or caption name)
|
||||
;; Get sequence number of current src-block among every
|
||||
;; src-block with either a caption or a name.
|
||||
(let ((reference
|
||||
(org-export-get-ordinal
|
||||
element info nil nil
|
||||
(lambda (el) (or (org-element-get-property :caption el)
|
||||
(org-element-get-property :name el)))))
|
||||
(lambda (el) (or (org-element-property :caption el)
|
||||
(org-element-property :name el)))))
|
||||
(title-fmt (org-e-ascii--translate
|
||||
(case (org-element-type element)
|
||||
(table "Table %d: %s")
|
||||
@ -721,8 +721,8 @@ generation. INFO is a plist used as a communication channel."
|
||||
(org-trim
|
||||
(org-e-ascii--indent-string
|
||||
(org-e-ascii--fill-string
|
||||
(let ((caption (org-element-get-property :caption src-block)))
|
||||
(if (not caption) (org-element-get-property :name src-block)
|
||||
(let ((caption (org-element-property :caption src-block)))
|
||||
(if (not caption) (org-element-property :name src-block)
|
||||
(org-export-secondary-string
|
||||
;; Use short name in priority, if available.
|
||||
(or (cdr caption) (car caption)) 'e-ascii info)))
|
||||
@ -760,8 +760,8 @@ generation. INFO is a plist used as a communication channel."
|
||||
(org-trim
|
||||
(org-e-ascii--indent-string
|
||||
(org-e-ascii--fill-string
|
||||
(let ((caption (org-element-get-property :caption table)))
|
||||
(if (not caption) (org-element-get-property :name table)
|
||||
(let ((caption (org-element-property :caption table)))
|
||||
(if (not caption) (org-element-property :name table)
|
||||
;; Use short name in priority, if available.
|
||||
(org-export-secondary-string
|
||||
(or (cdr caption) (car caption)) 'e-ascii info)))
|
||||
@ -784,8 +784,8 @@ the following section and in any inlinetask's title there."
|
||||
;; Update SEEN links along the way.
|
||||
(lambda (link)
|
||||
(let ((footprint
|
||||
(cons (org-element-get-property :raw-link link)
|
||||
(org-element-get-contents link))))
|
||||
(cons (org-element-property :raw-link link)
|
||||
(org-element-contents link))))
|
||||
(unless (member footprint seen)
|
||||
(push footprint seen) link)))))
|
||||
(harvest-links-in-title
|
||||
@ -794,13 +794,13 @@ the following section and in any inlinetask's title there."
|
||||
;; may be an headline or an inlinetask element.
|
||||
(lambda (element)
|
||||
(let (acc)
|
||||
(dolist (obj (org-element-get-property :title element) acc)
|
||||
(dolist (obj (org-element-property :title element) acc)
|
||||
(when (eq (org-element-type obj) 'link)
|
||||
(let ((link (funcall unique-link-p obj)))
|
||||
(and link (push link acc)))))))))
|
||||
;; Retrieve HEADLINE's section, if it exists.
|
||||
(section (if (eq (org-element-type element) 'section) element
|
||||
(let ((sec (car (org-element-get-contents element))))
|
||||
(let ((sec (car (org-element-contents element))))
|
||||
(and (eq (org-element-type sec) 'section) sec))))
|
||||
(headline (if (eq (org-element-type element) 'headline) element
|
||||
(org-export-get-parent-headline element info))))
|
||||
@ -820,10 +820,9 @@ the output string. INFO is a plist used as a communication
|
||||
channel."
|
||||
(mapconcat
|
||||
(lambda (link)
|
||||
(let ((type (org-element-get-property :type link))
|
||||
(anchor (let ((desc (org-element-get-contents link)))
|
||||
(if (not desc)
|
||||
(org-element-get-property :raw-link link)
|
||||
(let ((type (org-element-property :type link))
|
||||
(anchor (let ((desc (org-element-contents link)))
|
||||
(if (not desc) (org-element-property :raw-link link)
|
||||
(org-export-secondary-string desc 'e-ascii info)))))
|
||||
(cond
|
||||
;; Coderefs, radio links and ref links are ignored.
|
||||
@ -851,11 +850,11 @@ channel."
|
||||
;; Do not add a link that cannot be resolved and doesn't have
|
||||
;; any description: destination is already visible in the
|
||||
;; paragraph.
|
||||
((not (org-element-get-contents link)) nil)
|
||||
((not (org-element-contents link)) nil)
|
||||
(t
|
||||
(concat
|
||||
(org-e-ascii--fill-string
|
||||
(format "[%s] %s" anchor (org-element-get-property :raw-link link))
|
||||
(format "[%s] %s" anchor (org-element-property :raw-link link))
|
||||
width info)
|
||||
"\n\n")))))
|
||||
links ""))
|
||||
@ -979,7 +978,7 @@ holding export options."
|
||||
;; inserted inside the first parsed paragraph
|
||||
;; (FIRST), if any, to be sure filling will
|
||||
;; take it into consideration.
|
||||
(let ((first (car (org-element-get-contents def))))
|
||||
(let ((first (car (org-element-contents def))))
|
||||
(if (not (eq (org-element-type first) 'paragraph))
|
||||
(concat id "\n" (org-export-data def 'e-ascii info))
|
||||
(push id (nthcdr 2 first))
|
||||
@ -1048,7 +1047,7 @@ holding contextual information."
|
||||
"Transcode a DRAWER element from Org to ASCII.
|
||||
CONTENTS holds the contents of the block. INFO is a plist
|
||||
holding contextual information."
|
||||
(let ((name (org-element-get-property :drawer-name drawer))
|
||||
(let ((name (org-element-property :drawer-name drawer))
|
||||
(width (org-e-ascii--current-text-width drawer info)))
|
||||
(if (functionp org-e-ascii-format-drawer-function)
|
||||
(funcall org-e-ascii-format-drawer-function name contents width)
|
||||
@ -1073,7 +1072,7 @@ holding contextual information. See
|
||||
"Transcode EMPHASIS from Org to ASCII.
|
||||
CONTENTS is the contents of the emphasized text. INFO is a plist
|
||||
holding contextual information.."
|
||||
(let ((marker (org-element-get-property :marker emphasis)))
|
||||
(let ((marker (org-element-property :marker emphasis)))
|
||||
;; Leave emphasis markers as-is.
|
||||
(concat marker contents marker)))
|
||||
|
||||
@ -1084,7 +1083,7 @@ holding contextual information.."
|
||||
"Transcode an ENTITY object from Org to ASCII.
|
||||
CONTENTS are the definition itself. INFO is a plist holding
|
||||
contextual information."
|
||||
(org-element-get-property
|
||||
(org-element-property
|
||||
(intern (concat ":" (symbol-name (plist-get info :ascii-charset))))
|
||||
entity))
|
||||
|
||||
@ -1102,7 +1101,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(defun org-e-ascii-export-snippet (export-snippet contents info)
|
||||
"Transcode a EXPORT-SNIPPET object from Org to ASCII.
|
||||
CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(org-element-get-property :value export-snippet))
|
||||
(org-element-property :value export-snippet))
|
||||
|
||||
|
||||
;;;; Export Block
|
||||
@ -1110,8 +1109,8 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(defun org-e-ascii-export-block (export-block contents info)
|
||||
"Transcode a EXPORT-BLOCK element from Org to ASCII.
|
||||
CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(when (string= (org-element-get-property :type export-block) "ascii")
|
||||
(org-remove-indentation (org-element-get-property :value export-block))))
|
||||
(when (string= (org-element-property :type export-block) "ascii")
|
||||
(org-remove-indentation (org-element-property :value export-block))))
|
||||
|
||||
|
||||
;;;; Fixed Width
|
||||
@ -1121,7 +1120,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(org-e-ascii--box-string
|
||||
(replace-regexp-in-string
|
||||
"^[ \t]*: ?" "" (org-element-get-property :value fixed-width)) info))
|
||||
"^[ \t]*: ?" "" (org-element-property :value fixed-width)) info))
|
||||
|
||||
|
||||
;;;; Footnote Definition
|
||||
@ -1146,7 +1145,7 @@ CONTENTS holds the contents of the headline. INFO is a plist
|
||||
holding contextual information."
|
||||
;; Don't export footnote section, which will be handled at the end
|
||||
;; of the template.
|
||||
(unless (org-element-get-property :footnote-section-p headline)
|
||||
(unless (org-element-property :footnote-section-p headline)
|
||||
(let* ((low-level-rank (org-export-low-level-p headline info))
|
||||
(width (org-e-ascii--current-text-width headline info))
|
||||
;; Blank lines between headline and its contents.
|
||||
@ -1155,11 +1154,11 @@ holding contextual information."
|
||||
(pre-blanks
|
||||
(make-string
|
||||
(if org-e-ascii-headline-spacing (car org-e-ascii-headline-spacing)
|
||||
(org-element-get-property :pre-blank headline)) ?\n))
|
||||
(org-element-property :pre-blank headline)) ?\n))
|
||||
;; Even if HEADLINE has no section, there might be some
|
||||
;; links in its title that we shouldn't forget to describe.
|
||||
(links
|
||||
(unless (eq (caar (org-element-get-contents headline)) 'section)
|
||||
(unless (eq (caar (org-element-contents headline)) 'section)
|
||||
(org-e-ascii--describe-links
|
||||
(org-e-ascii--unique-links headline info) width info))))
|
||||
;; Deep subtree: export it as a list item.
|
||||
@ -1198,7 +1197,7 @@ information."
|
||||
"(%s)"
|
||||
(mapconcat
|
||||
#'identity
|
||||
(org-element-get-property :attr_ascii horizontal-rule)
|
||||
(org-element-property :attr_ascii horizontal-rule)
|
||||
" ")))))
|
||||
(make-string (or (and (wholenump (plist-get attr :width))
|
||||
(plist-get attr :width))
|
||||
@ -1218,7 +1217,7 @@ information."
|
||||
CONTENTS holds the contents of the item. INFO is a plist holding
|
||||
contextual information."
|
||||
(format org-e-ascii-verbatim-format
|
||||
(org-element-get-property :value inline-src-block)))
|
||||
(org-element-property :value inline-src-block)))
|
||||
|
||||
|
||||
;;;; Inlinetask
|
||||
@ -1229,17 +1228,17 @@ CONTENTS holds the contents of the block. INFO is a plist
|
||||
holding contextual information."
|
||||
(let ((width (org-e-ascii--current-text-width inlinetask info))
|
||||
(title (org-export-secondary-string
|
||||
(org-element-get-property :title inlinetask) 'e-ascii info))
|
||||
(org-element-property :title inlinetask) 'e-ascii info))
|
||||
(todo (and (plist-get info :with-todo-keywords)
|
||||
(let ((todo (org-element-get-property
|
||||
(let ((todo (org-element-property
|
||||
:todo-keyword inlinetask)))
|
||||
(and todo
|
||||
(org-export-secondary-string todo 'e-ascii info)))))
|
||||
(todo-type (org-element-get-property :todo-type inlinetask))
|
||||
(todo-type (org-element-property :todo-type inlinetask))
|
||||
(tags (and (plist-get info :with-tags)
|
||||
(org-element-get-property :tags inlinetask)))
|
||||
(org-element-property :tags inlinetask)))
|
||||
(priority (and (plist-get info :with-priority)
|
||||
(org-element-get-property :priority inlinetask))))
|
||||
(org-element-property :priority inlinetask))))
|
||||
;; If `org-e-ascii-format-inlinetask-function' is provided, call it
|
||||
;; with appropriate arguments.
|
||||
(if (functionp org-e-ascii-format-inlinetask-function)
|
||||
@ -1280,27 +1279,27 @@ contextual information."
|
||||
;; First parent of ITEM is always the plain-list. Get
|
||||
;; `:type' property from it.
|
||||
(org-list-bullet-string
|
||||
(let ((type (org-element-get-property
|
||||
(let ((type (org-element-property
|
||||
:type (car (plist-get info :genealogy)))))
|
||||
(cond
|
||||
((eq type 'descriptive)
|
||||
(concat
|
||||
(org-export-secondary-string
|
||||
(org-element-get-property :tag item) 'e-ascii info) ": "))
|
||||
(org-element-property :tag item) 'e-ascii info) ": "))
|
||||
((eq type 'ordered)
|
||||
;; Return correct number for ITEM, paying attention to
|
||||
;; counters.
|
||||
(let* ((struct (org-element-get-property :structure item))
|
||||
(bul (org-element-get-property :bullet item))
|
||||
(let* ((struct (org-element-property :structure item))
|
||||
(bul (org-element-property :bullet item))
|
||||
(num
|
||||
(number-to-string
|
||||
(car (last (org-list-get-item-number
|
||||
(org-element-get-property :begin item)
|
||||
(org-element-property :begin item)
|
||||
struct
|
||||
(org-list-prevs-alist struct)
|
||||
(org-list-parents-alist struct)))))))
|
||||
(replace-regexp-in-string "[0-9]+" num bul)))
|
||||
(t (let ((bul (org-element-get-property :bullet item)))
|
||||
(t (let ((bul (org-element-property :bullet item)))
|
||||
;; Change bullets into more visible form if UTF-8 is active.
|
||||
(if (not (eq (plist-get info :ascii-charset) 'utf-8)) bul
|
||||
(replace-regexp-in-string
|
||||
@ -1314,7 +1313,7 @@ contextual information."
|
||||
;; already taken care of at the paragraph level so they don't
|
||||
;; interfere with indentation.
|
||||
(let ((contents (org-e-ascii--indent-string contents (length bullet))))
|
||||
(if (eq (caar (org-element-get-contents item)) 'paragraph)
|
||||
(if (eq (caar (org-element-contents item)) 'paragraph)
|
||||
(org-trim contents)
|
||||
(concat "\n" contents))))))
|
||||
|
||||
@ -1325,8 +1324,8 @@ contextual information."
|
||||
"Transcode a KEYWORD element from Org to ASCII.
|
||||
CONTENTS is nil. INFO is a plist holding contextual
|
||||
information."
|
||||
(let ((key (downcase (org-element-get-property :key keyword)))
|
||||
(value (org-element-get-property :value keyword)))
|
||||
(let ((key (downcase (org-element-property :key keyword)))
|
||||
(value (org-element-property :value keyword)))
|
||||
(cond
|
||||
((string= key "ascii") value)
|
||||
((string= key "toc")
|
||||
@ -1350,7 +1349,7 @@ information."
|
||||
"Transcode a LATEX-ENVIRONMENT element from Org to ASCII.
|
||||
CONTENTS is nil. INFO is a plist holding contextual
|
||||
information."
|
||||
(org-remove-indentation (org-element-get-property :value latex-environment)))
|
||||
(org-remove-indentation (org-element-property :value latex-environment)))
|
||||
|
||||
|
||||
;;;; Latex Fragment
|
||||
@ -1359,7 +1358,7 @@ information."
|
||||
"Transcode a LATEX-FRAGMENT object from Org to ASCII.
|
||||
CONTENTS is nil. INFO is a plist holding contextual
|
||||
information."
|
||||
(org-element-get-property :value latex-fragment))
|
||||
(org-element-property :value latex-fragment))
|
||||
|
||||
|
||||
;;;; Line Break
|
||||
@ -1377,11 +1376,11 @@ CONTENTS is nil. INFO is a plist holding contextual
|
||||
|
||||
DESC is the description part of the link, or the empty string.
|
||||
INFO is a plist holding contextual information."
|
||||
(let ((raw-link (org-element-get-property :raw-link link))
|
||||
(type (org-element-get-property :type link)))
|
||||
(let ((raw-link (org-element-property :raw-link link))
|
||||
(type (org-element-property :type link)))
|
||||
(cond
|
||||
((string= type "coderef")
|
||||
(let ((ref (org-element-get-property :path link)))
|
||||
(let ((ref (org-element-property :path link)))
|
||||
(format (org-export-get-coderef-format ref desc)
|
||||
(org-export-resolve-coderef ref info))))
|
||||
;; Do not apply a special syntax on radio links. Though, parse
|
||||
@ -1389,7 +1388,7 @@ INFO is a plist holding contextual information."
|
||||
((string= type "radio")
|
||||
(org-export-secondary-string
|
||||
(org-element-parse-secondary-string
|
||||
(org-element-get-property :path link)
|
||||
(org-element-property :path link)
|
||||
(cdr (assq 'radio-target org-element-object-restrictions)))
|
||||
'e-ascii info))
|
||||
;; Ref link: If there's no description (DESC, return link's
|
||||
@ -1401,15 +1400,15 @@ INFO is a plist holding contextual information."
|
||||
(org-export-get-ordinal
|
||||
(org-export-resolve-ref-link link info)
|
||||
info nil nil
|
||||
(lambda (el) (or (org-element-get-property :caption el)
|
||||
(org-element-get-property :name el)))))))
|
||||
(lambda (el) (or (org-element-property :caption el)
|
||||
(org-element-property :name el)))))))
|
||||
;; Do not apply a special syntax on fuzzy links pointing to
|
||||
;; targets.
|
||||
((and (string= type "fuzzy")
|
||||
(let ((path (org-element-get-property :path link)))
|
||||
(let ((path (org-element-property :path link)))
|
||||
(loop for target in (plist-get info :target-list)
|
||||
thereis (string=
|
||||
(org-element-get-property :raw-value target)
|
||||
(org-element-property :raw-value target)
|
||||
path))))
|
||||
(if (org-string-nw-p desc) desc raw-link))
|
||||
(t
|
||||
@ -1438,9 +1437,9 @@ the plist used as a communication channel."
|
||||
;; add the check-box in front of it, before any filling. Later,
|
||||
;; it would interfere with line width.
|
||||
(if (and (eq (org-element-type parent) 'item)
|
||||
(equal (car (org-element-get-contents parent)) paragraph))
|
||||
(equal (car (org-element-contents parent)) paragraph))
|
||||
(let ((utf8p (eq (plist-get info :ascii-charset) 'utf-8)))
|
||||
(concat (case (org-element-get-property :checkbox parent)
|
||||
(concat (case (org-element-property :checkbox parent)
|
||||
(on (if utf8p "☑ " "[X] "))
|
||||
(off (if utf8p "☐ " "[ ] "))
|
||||
(trans (if utf8p "☒ " "[-] ")))
|
||||
@ -1507,7 +1506,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(value
|
||||
(org-export-secondary-string
|
||||
(org-remove-indentation
|
||||
(org-element-get-property :value quote-section)) 'e-ascii info)))
|
||||
(org-element-property :value quote-section)) 'e-ascii info)))
|
||||
(org-e-ascii--indent-string
|
||||
value
|
||||
(+ org-e-ascii-quote-margin
|
||||
@ -1574,7 +1573,7 @@ contextual information."
|
||||
(defun org-e-ascii-statistics-cookie (statistics-cookie contents info)
|
||||
"Transcode a STATISTICS-COOKIE object from Org to ASCII.
|
||||
CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(org-element-get-property :value statistics-cookie))
|
||||
(org-element-property :value statistics-cookie))
|
||||
|
||||
|
||||
;;;; Subscript
|
||||
@ -1583,7 +1582,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
"Transcode a SUBSCRIPT object from Org to ASCII.
|
||||
CONTENTS is the contents of the object. INFO is a plist holding
|
||||
contextual information."
|
||||
(if (org-element-get-property :use-brackets-p subscript)
|
||||
(if (org-element-property :use-brackets-p subscript)
|
||||
(format "_{%s}" contents)
|
||||
(format "_%s" contents)))
|
||||
|
||||
@ -1594,7 +1593,7 @@ contextual information."
|
||||
"Transcode a SUPERSCRIPT object from Org to ASCII.
|
||||
CONTENTS is the contents of the object. INFO is a plist holding
|
||||
contextual information."
|
||||
(if (org-element-get-property :use-brackets-p superscript)
|
||||
(if (org-element-property :use-brackets-p superscript)
|
||||
(format "_{%s}" contents)
|
||||
(format "_%s" contents)))
|
||||
|
||||
@ -1618,13 +1617,13 @@ contextual information."
|
||||
(defun org-e-ascii-table (table contents info)
|
||||
"Transcode a TABLE element from Org to ASCII.
|
||||
CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(let ((raw-table (org-element-get-property :raw-table table))
|
||||
(let ((raw-table (org-element-property :raw-table table))
|
||||
(caption (org-e-ascii--build-caption table info)))
|
||||
(concat
|
||||
;; Possibly add a caption string above.
|
||||
(when (and caption org-e-ascii-caption-above) (concat caption "\n"))
|
||||
;; Insert table. Note: "table.el" tables are left unmodified.
|
||||
(if (eq (org-element-get-property :type table) 'table.el) raw-table
|
||||
(if (eq (org-element-property :type table) 'table.el) raw-table
|
||||
(let* ((utf8p (eq (plist-get info :ascii-charset) 'utf-8))
|
||||
;; Extract information out of the raw table (TABLE-INFO)
|
||||
;; and clean it (CLEAN-TABLE).
|
||||
@ -1874,7 +1873,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
"Return a VERBATIM object from Org to ASCII.
|
||||
CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(format org-e-ascii-verbatim-format
|
||||
(org-element-get-property :value verbatim)))
|
||||
(org-element-property :value verbatim)))
|
||||
|
||||
|
||||
;;;; Verse Block
|
||||
@ -1886,7 +1885,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(org-e-ascii--indent-string
|
||||
(org-e-ascii--justify-string
|
||||
(org-export-secondary-string
|
||||
(org-element-get-property :value verse-block) 'e-ascii info)
|
||||
(org-element-property :value verse-block) 'e-ascii info)
|
||||
verse-width 'left)
|
||||
org-e-ascii-quote-margin)))
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
(defvar org-export-latex-default-packages-alist)
|
||||
(defvar org-export-latex-packages-alist)
|
||||
|
||||
(declare-function org-element-get-property "org-element" (property element))
|
||||
(declare-function org-element-property "org-element" (property element))
|
||||
(declare-function org-element-normalize-string "org-element" (s))
|
||||
(declare-function org-element-parse-secondary-string
|
||||
"org-element" (string restriction &optional buffer))
|
||||
@ -790,7 +790,7 @@ is a plist used as a communication channel."
|
||||
"Wrap label associated to ELEMENT around OUTPUT, if appropriate.
|
||||
This function shouldn't be used for floats. See
|
||||
`org-e-latex--caption/label-string'."
|
||||
(let ((label (org-element-get-property :name element)))
|
||||
(let ((label (org-element-property :name element)))
|
||||
(if (or (not output) (not label) (string= output "") (string= label ""))
|
||||
output
|
||||
(concat (format "\\label{%s}\n" label) output))))
|
||||
@ -915,7 +915,7 @@ holding contextual information."
|
||||
"Transcode a DRAWER element from Org to LaTeX.
|
||||
CONTENTS holds the contents of the block. INFO is a plist
|
||||
holding contextual information."
|
||||
(let* ((name (org-element-get-property :drawer-name drawer))
|
||||
(let* ((name (org-element-property :drawer-name drawer))
|
||||
(output (if (functionp org-e-latex-format-drawer-function)
|
||||
(funcall org-e-latex-format-drawer-function
|
||||
name contents)
|
||||
@ -941,7 +941,7 @@ holding contextual information. See
|
||||
"Transcode EMPHASIS from Org to LaTeX.
|
||||
CONTENTS is the contents of the emphasized text. INFO is a plist
|
||||
holding contextual information.."
|
||||
(format (cdr (assoc (org-element-get-property :marker emphasis)
|
||||
(format (cdr (assoc (org-element-property :marker emphasis)
|
||||
org-e-latex-emphasis-alist))
|
||||
contents))
|
||||
|
||||
@ -952,10 +952,8 @@ holding contextual information.."
|
||||
"Transcode an ENTITY object from Org to LaTeX.
|
||||
CONTENTS are the definition itself. INFO is a plist holding
|
||||
contextual information."
|
||||
(let ((ent (org-element-get-property :latex entity)))
|
||||
(if (org-element-get-property :latex-math-p entity)
|
||||
(format "$%s$" ent)
|
||||
ent)))
|
||||
(let ((ent (org-element-property :latex entity)))
|
||||
(if (org-element-property :latex-math-p entity) (format "$%s$" ent) ent)))
|
||||
|
||||
|
||||
;;;; Example Block
|
||||
@ -963,7 +961,7 @@ contextual information."
|
||||
(defun org-e-latex-example-block (example-block contents info)
|
||||
"Transcode a EXAMPLE-BLOCK element from Org to LaTeX.
|
||||
CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(let* ((options (or (org-element-get-property :options example-block) ""))
|
||||
(let* ((options (or (org-element-property :options example-block) ""))
|
||||
(value (org-export-handle-code example-block info)))
|
||||
(org-e-latex--wrap-label
|
||||
example-block (format "\\begin{verbatim}\n%s\\end{verbatim}" value))))
|
||||
@ -974,7 +972,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(defun org-e-latex-export-snippet (export-snippet contents info)
|
||||
"Transcode a EXPORT-SNIPPET object from Org to LaTeX.
|
||||
CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(org-element-get-property :value export-snippet))
|
||||
(org-element-property :value export-snippet))
|
||||
|
||||
|
||||
;;;; Export Block
|
||||
@ -982,8 +980,8 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(defun org-e-latex-export-block (export-block contents info)
|
||||
"Transcode a EXPORT-BLOCK element from Org to LaTeX.
|
||||
CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(when (string= (org-element-get-property :type export-block) "latex")
|
||||
(org-remove-indentation (org-element-get-property :value export-block))))
|
||||
(when (string= (org-element-property :type export-block) "latex")
|
||||
(org-remove-indentation (org-element-property :value export-block))))
|
||||
|
||||
|
||||
;;;; Fixed Width
|
||||
@ -994,7 +992,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(let* ((value (org-element-normalize-string
|
||||
(replace-regexp-in-string
|
||||
"^[ \t]*: ?" ""
|
||||
(org-element-get-property :value fixed-width)))))
|
||||
(org-element-property :value fixed-width)))))
|
||||
(org-e-latex--wrap-label
|
||||
fixed-width (format "\\begin{verbatim}\n%s\\end{verbatim}" value))))
|
||||
|
||||
@ -1021,7 +1019,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(format "\\footnotemark[%s]"
|
||||
(org-export-get-footnote-number footnote-reference info)))
|
||||
;; Inline definitions are secondary strings.
|
||||
((eq (org-element-get-property :type footnote-reference) 'inline)
|
||||
((eq (org-element-property :type footnote-reference) 'inline)
|
||||
(format "\\footnote{%s}"
|
||||
(org-trim
|
||||
(org-export-secondary-string
|
||||
@ -1071,17 +1069,16 @@ holding contextual information."
|
||||
(concat (car sec) "\n%s" (nth 1 sec))
|
||||
(concat (nth 2 sec) "\n%s" (nth 3 sec)))))))
|
||||
(text (org-export-secondary-string
|
||||
(org-element-get-property :title headline) 'e-latex info))
|
||||
(todo (and (plist-get info :with-todo-keywords)
|
||||
(let ((todo (org-element-get-property
|
||||
:todo-keyword headline)))
|
||||
(and todo
|
||||
(org-export-secondary-string todo 'e-latex info)))))
|
||||
(todo-type (and todo (org-element-get-property :todo-type headline)))
|
||||
(org-element-property :title headline) 'e-latex info))
|
||||
(todo
|
||||
(and (plist-get info :with-todo-keywords)
|
||||
(let ((todo (org-element-property :todo-keyword headline)))
|
||||
(and todo (org-export-secondary-string todo 'e-latex info)))))
|
||||
(todo-type (and todo (org-element-property :todo-type headline)))
|
||||
(tags (and (plist-get info :with-tags)
|
||||
(org-element-get-property :tags headline)))
|
||||
(org-element-property :tags headline)))
|
||||
(priority (and (plist-get info :with-priority)
|
||||
(org-element-get-property :priority headline)))
|
||||
(org-element-property :priority headline)))
|
||||
;; Create the headline text.
|
||||
(full-text (if (functionp org-e-latex-format-headline-function)
|
||||
;; User-defined formatting function.
|
||||
@ -1100,11 +1097,11 @@ holding contextual information."
|
||||
(mapconcat 'number-to-string
|
||||
(org-export-get-headline-number headline info)
|
||||
"-")))
|
||||
(pre-blanks (make-string
|
||||
(org-element-get-property :pre-blank headline) 10)))
|
||||
(pre-blanks
|
||||
(make-string (org-element-property :pre-blank headline) 10)))
|
||||
(cond
|
||||
;; Case 1: This is a footnote section: ignore it.
|
||||
((org-element-get-property :footnote-section-p headline) nil)
|
||||
((org-element-property :footnote-section-p headline) nil)
|
||||
;; Case 2. This is a deep sub-tree: export it as a list item.
|
||||
;; Also export as items headlines for which no section
|
||||
;; format has been found.
|
||||
@ -1136,7 +1133,7 @@ holding contextual information."
|
||||
"Transcode an HORIZONTAL-RULE object from Org to LaTeX.
|
||||
CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(let ((attr (mapconcat #'identity
|
||||
(org-element-get-property :attr_latex horizontal-rule)
|
||||
(org-element-property :attr_latex horizontal-rule)
|
||||
" ")))
|
||||
(org-e-latex--wrap-label horizontal-rule (concat "\\hrule " attr))))
|
||||
|
||||
@ -1152,7 +1149,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
"Transcode an INLINE-SRC-BLOCK element from Org to LaTeX.
|
||||
CONTENTS holds the contents of the item. INFO is a plist holding
|
||||
contextual information."
|
||||
(let* ((code (org-element-get-property :value inline-src-block))
|
||||
(let* ((code (org-element-property :value inline-src-block))
|
||||
(separator (org-e-latex--find-verb-separator code)))
|
||||
(cond
|
||||
;; Do not use a special package: transcode it verbatim.
|
||||
@ -1160,7 +1157,7 @@ contextual information."
|
||||
(concat "\\verb" separator code separator))
|
||||
;; Use minted package.
|
||||
((eq org-e-latex-listings 'minted)
|
||||
(let* ((org-lang (org-element-get-property :language inline-src-block))
|
||||
(let* ((org-lang (org-element-property :language inline-src-block))
|
||||
(mint-lang (or (cadr (assq (intern org-lang)
|
||||
org-e-latex-minted-langs))
|
||||
org-lang))
|
||||
@ -1173,7 +1170,7 @@ contextual information."
|
||||
;; Use listings package.
|
||||
(t
|
||||
;; Maybe translate language's name.
|
||||
(let* ((org-lang (org-element-get-property :language inline-src-block))
|
||||
(let* ((org-lang (org-element-property :language inline-src-block))
|
||||
(lst-lang (or (cadr (assq (intern org-lang)
|
||||
org-e-latex-listings-langs))
|
||||
org-lang))
|
||||
@ -1191,17 +1188,17 @@ contextual information."
|
||||
CONTENTS holds the contents of the block. INFO is a plist
|
||||
holding contextual information."
|
||||
(let ((title (org-export-secondary-string
|
||||
(org-element-get-property :title inlinetask) 'e-latex info))
|
||||
(org-element-property :title inlinetask) 'e-latex info))
|
||||
(todo (and (plist-get info :with-todo-keywords)
|
||||
(let ((todo (org-element-get-property
|
||||
(let ((todo (org-element-property
|
||||
:todo-keyword inlinetask)))
|
||||
(and todo
|
||||
(org-export-secondary-string todo 'e-latex info)))))
|
||||
(todo-type (org-element-get-property :todo-type inlinetask))
|
||||
(todo-type (org-element-property :todo-type inlinetask))
|
||||
(tags (and (plist-get info :with-tags)
|
||||
(org-element-get-property :tags inlinetask)))
|
||||
(org-element-property :tags inlinetask)))
|
||||
(priority (and (plist-get info :with-priority)
|
||||
(org-element-get-property :priority inlinetask))))
|
||||
(org-element-property :priority inlinetask))))
|
||||
;; If `org-e-latex-format-inlinetask-function' is provided, call it
|
||||
;; with appropriate arguments.
|
||||
(if (functionp org-e-latex-format-inlinetask-function)
|
||||
@ -1236,19 +1233,19 @@ CONTENTS holds the contents of the item. INFO is a plist holding
|
||||
contextual information."
|
||||
;; Grab `:level' from plain-list properties, which is always the
|
||||
;; first element above current item.
|
||||
(let* ((level (org-element-get-property
|
||||
(let* ((level (org-element-property
|
||||
:level (car (plist-get info :genealogy))))
|
||||
(counter (let ((count (org-element-get-property :counter item)))
|
||||
(counter (let ((count (org-element-property :counter item)))
|
||||
(and count
|
||||
(< level 4)
|
||||
(format "\\setcounter{enum%s}{%s}\n"
|
||||
(nth level '("i" "ii" "iii" "iv"))
|
||||
(1- count)))))
|
||||
(checkbox (let ((checkbox (org-element-get-property :checkbox item)))
|
||||
(checkbox (let ((checkbox (org-element-property :checkbox item)))
|
||||
(cond ((eq checkbox 'on) "$\\boxtimes$ ")
|
||||
((eq checkbox 'off) "$\\Box$ ")
|
||||
((eq checkbox 'trans) "$\\boxminus$ "))))
|
||||
(tag (let ((tag (org-element-get-property :tag item)))
|
||||
(tag (let ((tag (org-element-property :tag item)))
|
||||
(and tag
|
||||
(format "[%s]" (org-export-secondary-string
|
||||
tag 'e-latex info))))))
|
||||
@ -1260,8 +1257,8 @@ contextual information."
|
||||
(defun org-e-latex-keyword (keyword contents info)
|
||||
"Transcode a KEYWORD element from Org to LaTeX.
|
||||
CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(let ((key (downcase (org-element-get-property :key keyword)))
|
||||
(value (org-element-get-property :value keyword)))
|
||||
(let ((key (downcase (org-element-property :key keyword)))
|
||||
(value (org-element-property :value keyword)))
|
||||
(cond
|
||||
((string= key "latex") value)
|
||||
((string= key "index") (format "\\index{%s}" value))
|
||||
@ -1294,9 +1291,9 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(defun org-e-latex-latex-environment (latex-environment contents info)
|
||||
"Transcode a LATEX-ENVIRONMENT element from Org to LaTeX.
|
||||
CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(let ((label (org-element-get-property :name latex-environment))
|
||||
(let ((label (org-element-property :name latex-environment))
|
||||
(value (org-remove-indentation
|
||||
(org-element-get-property :value latex-environment))))
|
||||
(org-element-property :value latex-environment))))
|
||||
(if (not (org-string-nw-p label)) value
|
||||
;; Environment is labelled: label must be within the environment
|
||||
;; (otherwise, a reference pointing to that element will count
|
||||
@ -1314,7 +1311,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(defun org-e-latex-latex-fragment (latex-fragment contents info)
|
||||
"Transcode a LATEX-FRAGMENT object from Org to LaTeX.
|
||||
CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(org-element-get-property :value latex-fragment))
|
||||
(org-element-property :value latex-fragment))
|
||||
|
||||
|
||||
;;;; Line Break
|
||||
@ -1332,17 +1329,17 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
LINK is the link pointing to the inline image. INFO is a plist
|
||||
used as a communication channel."
|
||||
(let* ((parent (org-export-get-parent-paragraph link info))
|
||||
(path (let ((raw-path (org-element-get-property :path link)))
|
||||
(path (let ((raw-path (org-element-property :path link)))
|
||||
(if (not (file-name-absolute-p raw-path)) raw-path
|
||||
(expand-file-name raw-path))))
|
||||
(caption (org-e-latex--caption/label-string
|
||||
(org-element-get-property :caption parent)
|
||||
(org-element-get-property :name parent)
|
||||
(org-element-property :caption parent)
|
||||
(org-element-property :name parent)
|
||||
info))
|
||||
;; Retrieve latex attributes from the element around.
|
||||
(attr (let ((raw-attr
|
||||
(mapconcat #'identity
|
||||
(org-element-get-property :attr_latex parent)
|
||||
(org-element-property :attr_latex parent)
|
||||
" ")))
|
||||
(unless (string= raw-attr "") raw-attr)))
|
||||
(disposition
|
||||
@ -1393,8 +1390,8 @@ used as a communication channel."
|
||||
DESC is the description part of the link, or the empty string.
|
||||
INFO is a plist holding contextual information. See
|
||||
`org-export-data'."
|
||||
(let* ((type (org-element-get-property :type link))
|
||||
(raw-path (org-element-get-property :path link))
|
||||
(let* ((type (org-element-property :type link))
|
||||
(raw-path (org-element-property :path link))
|
||||
;; Ensure DESC really exists, or set it to nil.
|
||||
(desc (and (not (string= desc "")) desc))
|
||||
(imagep (org-export-inline-image-p
|
||||
@ -1442,10 +1439,10 @@ INFO is a plist holding contextual information. See
|
||||
(target
|
||||
(format "\\hyperref[%s]{%s}"
|
||||
(org-export-solidify-link-text
|
||||
(org-element-get-property :raw-value destination))
|
||||
(org-element-property :raw-value destination))
|
||||
(or desc
|
||||
(org-export-secondary-string
|
||||
(org-element-get-property :raw-link link)
|
||||
(org-element-property :raw-link link)
|
||||
'e-latex info))))
|
||||
;; Fuzzy link points to an headline. If headlines are
|
||||
;; numbered and the link has no description, display
|
||||
@ -1463,14 +1460,14 @@ INFO is a plist holding contextual information. See
|
||||
(format "\\hyperref[%s]{%s}" label
|
||||
(or desc
|
||||
(org-export-secondary-string
|
||||
(org-element-get-property :title destination)
|
||||
(org-element-property :title destination)
|
||||
'e-latex info))))))
|
||||
;; Fuzzy link points nowhere.
|
||||
(otherwise
|
||||
(format "\\texttt{%s}"
|
||||
(or desc
|
||||
(org-export-secondary-string
|
||||
(org-element-get-property :raw-link link)
|
||||
(org-element-property :raw-link link)
|
||||
'e-latex info)))))))
|
||||
;; Coderef: replace link with the reference name or the
|
||||
;; equivalent line number.
|
||||
@ -1517,7 +1514,7 @@ the plist used as a communication channel."
|
||||
"Transcode a PLAIN-LIST element from Org to LaTeX.
|
||||
CONTENTS is the contents of the list. INFO is a plist holding
|
||||
contextual information."
|
||||
(let* ((type (org-element-get-property :type plain-list))
|
||||
(let* ((type (org-element-property :type plain-list))
|
||||
(paralist-types '("inparaenum" "asparaenum" "inparaitem" "asparaitem"
|
||||
"inparadesc" "asparadesc"))
|
||||
(paralist-regexp (concat
|
||||
@ -1525,7 +1522,7 @@ contextual information."
|
||||
(mapconcat 'identity paralist-types "\\|")
|
||||
"\\)"))
|
||||
(attr (mapconcat #'identity
|
||||
(org-element-get-property :attr_latex plain-list)
|
||||
(org-element-property :attr_latex plain-list)
|
||||
" "))
|
||||
(latex-type (cond
|
||||
((and attr
|
||||
@ -1614,7 +1611,7 @@ holding contextual information."
|
||||
"Transcode a QUOTE-SECTION element from Org to LaTeX.
|
||||
CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(let ((value (org-remove-indentation
|
||||
(org-element-get-property :value quote-section))))
|
||||
(org-element-property :value quote-section))))
|
||||
(when value (format "\\begin{verbatim}\n%s\\end{verbatim}" value))))
|
||||
|
||||
|
||||
@ -1635,7 +1632,7 @@ TEXT is the text of the target. INFO is a plist holding
|
||||
contextual information."
|
||||
(format "\\label{%s}%s"
|
||||
(org-export-solidify-link-text
|
||||
(org-element-get-property :raw-value radio-target))
|
||||
(org-element-property :raw-value radio-target))
|
||||
text))
|
||||
|
||||
|
||||
@ -1645,7 +1642,7 @@ contextual information."
|
||||
"Transcode a SPECIAL-BLOCK element from Org to LaTeX.
|
||||
CONTENTS holds the contents of the block. INFO is a plist
|
||||
holding contextual information."
|
||||
(let ((type (downcase (org-element-get-property :type special-block))))
|
||||
(let ((type (downcase (org-element-property :type special-block))))
|
||||
(org-e-latex--wrap-label
|
||||
special-block
|
||||
(format "\\begin{%s}\n%s\\end{%s}" type contents type))))
|
||||
@ -1657,10 +1654,10 @@ holding contextual information."
|
||||
"Transcode a SRC-BLOCK element from Org to LaTeX.
|
||||
CONTENTS holds the contents of the item. INFO is a plist holding
|
||||
contextual information."
|
||||
(let* ((lang (org-element-get-property :language src-block))
|
||||
(let* ((lang (org-element-property :language src-block))
|
||||
(code (org-export-handle-code src-block info))
|
||||
(caption (org-element-get-property :caption src-block))
|
||||
(label (org-element-get-property :name src-block))
|
||||
(caption (org-element-property :caption src-block))
|
||||
(label (org-element-property :name src-block))
|
||||
(custom-env (and lang
|
||||
(cadr (assq (intern lang)
|
||||
org-e-latex-custom-lang-environments)))))
|
||||
@ -1718,7 +1715,7 @@ contextual information."
|
||||
(defun org-e-latex-statistics-cookie (statistics-cookie contents info)
|
||||
"Transcode a STATISTICS-COOKIE object from Org to LaTeX.
|
||||
CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(org-element-get-property :value statistics-cookie))
|
||||
(org-element-property :value statistics-cookie))
|
||||
|
||||
|
||||
;;;; Subscript
|
||||
@ -1750,11 +1747,11 @@ used as a communication channel.
|
||||
|
||||
The format string leaves one placeholder for the body of the
|
||||
table."
|
||||
(let* ((label (org-element-get-property :name table))
|
||||
(let* ((label (org-element-property :name table))
|
||||
(caption (org-e-latex--caption/label-string
|
||||
(org-element-get-property :caption table) label info))
|
||||
(org-element-property :caption table) label info))
|
||||
(attr (mapconcat 'identity
|
||||
(org-element-get-property :attr_latex table)
|
||||
(org-element-property :attr_latex table)
|
||||
" "))
|
||||
;; Determine alignment string.
|
||||
(alignment (org-e-latex-table--align-string attr table-info))
|
||||
@ -1839,9 +1836,9 @@ as returned by `org-export-table-format-info'."
|
||||
"Transcode a TABLE element from Org to LaTeX.
|
||||
CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(let ((attr (mapconcat #'identity
|
||||
(org-element-get-property :attr_latex table)
|
||||
(org-element-property :attr_latex table)
|
||||
" "))
|
||||
(raw-table (org-element-get-property :raw-table table)))
|
||||
(raw-table (org-element-property :raw-table table)))
|
||||
(cond
|
||||
;; Case 1: verbatim table.
|
||||
((or org-e-latex-tables-verbatim
|
||||
@ -1852,7 +1849,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
(plist-get (org-export-table-format-info raw-table)
|
||||
:special-column-p))))
|
||||
;; Case 2: table.el table. Convert it using appropriate tools.
|
||||
((eq (org-element-get-property :type table) 'table.el)
|
||||
((eq (org-element-property :type table) 'table.el)
|
||||
(require 'table)
|
||||
;; Ensure "*org-export-table*" buffer is empty.
|
||||
(with-current-buffer (get-buffer-create "*org-export-table*")
|
||||
@ -1950,7 +1947,7 @@ TEXT is the text of the target. INFO is a plist holding
|
||||
contextual information."
|
||||
(format "\\label{%s}%s"
|
||||
(org-export-solidify-link-text
|
||||
(org-element-get-property :raw-value target))
|
||||
(org-element-property :raw-value target))
|
||||
text))
|
||||
|
||||
|
||||
@ -1960,9 +1957,9 @@ contextual information."
|
||||
"Transcode a TIME-STAMP object from Org to LaTeX.
|
||||
CONTENTS is nil. INFO is a plist holding contextual
|
||||
information."
|
||||
(let ((value (org-element-get-property :value time-stamp))
|
||||
(type (org-element-get-property :type time-stamp))
|
||||
(appt-type (org-element-get-property :appt-type time-stamp)))
|
||||
(let ((value (org-element-property :value time-stamp))
|
||||
(type (org-element-property :type time-stamp))
|
||||
(appt-type (org-element-property :appt-type time-stamp)))
|
||||
(concat (cond ((eq appt-type 'scheduled)
|
||||
(format "\\textbf{\\textsc{%s}} " org-scheduled-string))
|
||||
((eq appt-type 'deadline)
|
||||
@ -1983,9 +1980,9 @@ information."
|
||||
"Transcode a VERBATIM object from Org to LaTeX.
|
||||
CONTENTS is nil. INFO is a plist used as a communication
|
||||
channel."
|
||||
(let ((fmt (cdr (assoc (org-element-get-property :marker verbatim)
|
||||
(let ((fmt (cdr (assoc (org-element-property :marker verbatim)
|
||||
org-e-latex-emphasis-alist)))
|
||||
(value (org-element-get-property :value verbatim)))
|
||||
(value (org-element-property :value verbatim)))
|
||||
(cond
|
||||
;; Handle the `verb' special case.
|
||||
((eq 'verb fmt)
|
||||
@ -2033,7 +2030,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
||||
"\\(\\\\\\\\\\)?[ \t]*\n" " \\\\\\\\\n"
|
||||
(org-remove-indentation
|
||||
(org-export-secondary-string
|
||||
(org-element-get-property :value verse-block)
|
||||
(org-element-property :value verse-block)
|
||||
'e-latex info)))))
|
||||
(while (string-match "^[ \t]+" contents)
|
||||
(let ((new-str (format "\\hspace*{%dem}"
|
||||
|
@ -41,7 +41,7 @@
|
||||
(eval-when-compile (require 'cl))
|
||||
(require 'format-spec)
|
||||
|
||||
(declare-function org-element-get-property "org-element" (property element))
|
||||
(declare-function org-element-property "org-element" (property element))
|
||||
(declare-function org-element-map "org-element"
|
||||
(data types fun &optional info first-match))
|
||||
|
||||
@ -976,9 +976,9 @@ keyword."
|
||||
(org-element-map
|
||||
tree 'keyword
|
||||
(lambda (k local)
|
||||
(when (string= (downcase (org-element-get-property :key k))
|
||||
(when (string= (downcase (org-element-property :key k))
|
||||
"index")
|
||||
(let ((index (org-element-get-property :value k))
|
||||
(let ((index (org-element-property :value k))
|
||||
(parent (org-export-get-parent-headline k local)))
|
||||
(list index (plist-get info :input-file) parent))))
|
||||
info)))
|
||||
@ -1040,14 +1040,12 @@ publishing directory."
|
||||
;; Destination.
|
||||
(cond
|
||||
((not target) (format "file:%s" file))
|
||||
((let ((id (org-element-get-property :id target)))
|
||||
((let ((id (org-element-property :id target)))
|
||||
(and id (format "id:%s" id))))
|
||||
((let ((id (org-element-get-property
|
||||
:custom-id target)))
|
||||
((let ((id (org-element-property :custom-id target)))
|
||||
(and id (format "file:%s::#%s" file id))))
|
||||
(t (format
|
||||
"file:%s::*%s" file
|
||||
(org-element-get-property :raw-value target))))
|
||||
(t (format "file:%s::*%s" file
|
||||
(org-element-property :raw-value target))))
|
||||
;; Description.
|
||||
(car (last entry)))))
|
||||
"\n"))))
|
||||
|
@ -81,8 +81,8 @@
|
||||
|
||||
;; The next two parts introduce three accessors and a function
|
||||
;; retrieving the smallest element containing point (respectively
|
||||
;; `org-element-type', `org-element-get-property',
|
||||
;; `org-element-get-contents' and `org-element-at-point').
|
||||
;; `org-element-type', `org-element-property', `org-element-contents'
|
||||
;; and `org-element-at-point').
|
||||
|
||||
;; The following part creates a fully recursive buffer parser. It
|
||||
;; also provides a tool to map a function to elements or objects
|
||||
@ -211,7 +211,7 @@ Assume point is at beginning of drawer."
|
||||
"Interpret DRAWER element as Org syntax.
|
||||
CONTENTS is the contents of the element."
|
||||
(format ":%s:\n%s:END:"
|
||||
(org-element-get-property :drawer-name drawer)
|
||||
(org-element-property :drawer-name drawer)
|
||||
contents))
|
||||
|
||||
|
||||
@ -255,8 +255,8 @@ Assume point is at beginning of dynamic block."
|
||||
"Interpret DYNAMIC-BLOCK element as Org syntax.
|
||||
CONTENTS is the contents of the element."
|
||||
(format "#+BEGIN: %s%s\n%s#+END:"
|
||||
(org-element-get-property :block-name dynamic-block)
|
||||
(let ((args (org-element-get-property :arguments dynamic-block)))
|
||||
(org-element-property :block-name dynamic-block)
|
||||
(let ((args (org-element-property :arguments dynamic-block)))
|
||||
(and arg (concat " " args)))
|
||||
contents))
|
||||
|
||||
@ -295,7 +295,7 @@ a plist containing `:label', `:begin' `:end', `:contents-begin',
|
||||
(defun org-element-footnote-definition-interpreter (footnote-definition contents)
|
||||
"Interpret FOOTNOTE-DEFINITION element as Org syntax.
|
||||
CONTENTS is the contents of the footnote-definition."
|
||||
(concat (format "[%s]" (org-element-get-property :label footnote-definition))
|
||||
(concat (format "[%s]" (org-element-property :label footnote-definition))
|
||||
" "
|
||||
contents))
|
||||
|
||||
@ -407,27 +407,27 @@ Assume point is at beginning of the headline."
|
||||
(defun org-element-headline-interpreter (headline contents)
|
||||
"Interpret HEADLINE element as Org syntax.
|
||||
CONTENTS is the contents of the element."
|
||||
(let* ((level (org-element-get-property :level headline))
|
||||
(todo (org-element-get-property :todo-keyword headline))
|
||||
(priority (org-element-get-property :priority headline))
|
||||
(title (org-element-get-property :raw-value headline))
|
||||
(tags (let ((tag-string (org-element-get-property :tags headline))
|
||||
(archivedp (org-element-get-property :archivedp headline)))
|
||||
(let* ((level (org-element-property :level headline))
|
||||
(todo (org-element-property :todo-keyword headline))
|
||||
(priority (org-element-property :priority headline))
|
||||
(title (org-element-property :raw-value headline))
|
||||
(tags (let ((tag-string (org-element-property :tags headline))
|
||||
(archivedp (org-element-property :archivedp headline)))
|
||||
(cond
|
||||
((and (not tag-string) archivedp)
|
||||
(format ":%s:" org-archive-tag))
|
||||
(archivedp (concat ":" org-archive-tag tag-string))
|
||||
(t tag-string))))
|
||||
(commentedp (org-element-get-property :commentedp headline))
|
||||
(quotedp (org-element-get-property :quotedp headline))
|
||||
(pre-blank (org-element-get-property :pre-blank headline))
|
||||
(commentedp (org-element-property :commentedp headline))
|
||||
(quotedp (org-element-property :quotedp headline))
|
||||
(pre-blank (org-element-property :pre-blank headline))
|
||||
(heading (concat (make-string level ?*)
|
||||
(and todo (concat " " todo))
|
||||
(and quotedp (concat " " org-quote-string))
|
||||
(and commentedp (concat " " org-comment-string))
|
||||
(and priority (concat " " priority))
|
||||
(cond ((and org-footnote-section
|
||||
(org-element-get-property
|
||||
(org-element-property
|
||||
:footnote-section-p headline))
|
||||
(concat " " org-footnote-section))
|
||||
(title (concat " " title)))))
|
||||
@ -526,11 +526,11 @@ Assume point is at beginning of the inline task."
|
||||
(defun org-element-inlinetask-interpreter (inlinetask contents)
|
||||
"Interpret INLINETASK element as Org syntax.
|
||||
CONTENTS is the contents of inlinetask."
|
||||
(let* ((level (org-element-get-property :level inlinetask))
|
||||
(todo (org-element-get-property :todo-keyword inlinetask))
|
||||
(priority (org-element-get-property :priority inlinetask))
|
||||
(title (org-element-get-property :raw-value inlinetask))
|
||||
(tags (org-element-get-property :tags inlinetask))
|
||||
(let* ((level (org-element-property :level inlinetask))
|
||||
(todo (org-element-property :todo-keyword inlinetask))
|
||||
(priority (org-element-property :priority inlinetask))
|
||||
(title (org-element-property :raw-value inlinetask))
|
||||
(tags (org-element-property :tags inlinetask))
|
||||
(task (concat (make-string level ?*)
|
||||
(and todo (concat " " todo))
|
||||
(and priority (concat " " priority))
|
||||
@ -622,10 +622,10 @@ Assume point is at the beginning of the item."
|
||||
"Interpret ITEM element as Org syntax.
|
||||
CONTENTS is the contents of the element."
|
||||
(let* ((bullet
|
||||
(let* ((beg (org-element-get-property :begin item))
|
||||
(struct (org-element-get-property :structure item))
|
||||
(let* ((beg (org-element-property :begin item))
|
||||
(struct (org-element-property :structure item))
|
||||
(pre (org-list-prevs-alist struct))
|
||||
(bul (org-element-get-property :bullet item)))
|
||||
(bul (org-element-property :bullet item)))
|
||||
(org-list-bullet-string
|
||||
(if (not (eq (org-list-get-list-type beg struct pre) 'ordered)) "-"
|
||||
(let ((num
|
||||
@ -637,9 +637,9 @@ CONTENTS is the contents of the element."
|
||||
num
|
||||
(if (eq org-plain-list-ordered-item-terminator ?\)) ")"
|
||||
".")))))))
|
||||
(checkbox (org-element-get-property :checkbox item))
|
||||
(counter (org-element-get-property :counter item))
|
||||
(tag (org-element-get-property :raw-tag item))
|
||||
(checkbox (org-element-property :checkbox item))
|
||||
(counter (org-element-property :counter item))
|
||||
(tag (org-element-property :raw-tag item))
|
||||
;; Compute indentation.
|
||||
(ind (make-string (length bullet) 32)))
|
||||
;; Indent contents.
|
||||
@ -830,7 +830,7 @@ Assume point is at beginning or end of the block."
|
||||
(defun org-element-special-block-interpreter (special-block contents)
|
||||
"Interpret SPECIAL-BLOCK element as Org syntax.
|
||||
CONTENTS is the contents of the element."
|
||||
(let ((block-type (org-element-get-property :type special-block)))
|
||||
(let ((block-type (org-element-property :type special-block)))
|
||||
(format "#+begin_%s\n%s#+end_%s" block-type contents block-type)))
|
||||
|
||||
|
||||
@ -874,7 +874,7 @@ keywords."
|
||||
(defun org-element-babel-call-interpreter (inline-babel-call contents)
|
||||
"Interpret INLINE-BABEL-CALL object as Org syntax.
|
||||
CONTENTS is nil."
|
||||
(let* ((babel-info (org-element-get-property :info inline-babel-call))
|
||||
(let* ((babel-info (org-element-property :info inline-babel-call))
|
||||
(main-source (car babel-info))
|
||||
(post-options (nth 1 babel-info)))
|
||||
(concat "#+call: "
|
||||
@ -936,7 +936,7 @@ keywords."
|
||||
(defun org-element-comment-interpreter (comment contents)
|
||||
"Interpret COMMENT element as Org syntax.
|
||||
CONTENTS is nil."
|
||||
(org-element-get-property :value comment))
|
||||
(org-element-property :value comment))
|
||||
|
||||
|
||||
;;;; Comment Block
|
||||
@ -976,7 +976,7 @@ containing `:begin', `:end', `:hiddenp', `:value' and
|
||||
CONTENTS is nil."
|
||||
(concat "#+begin_comment\n"
|
||||
(org-remove-indentation
|
||||
(org-element-get-property :value comment-block))
|
||||
(org-element-property :value comment-block))
|
||||
"#+begin_comment"))
|
||||
|
||||
|
||||
@ -1018,10 +1018,10 @@ containing `:begin', `:end', `:options', `:hiddenp', `:value' and
|
||||
(defun org-element-example-block-interpreter (example-block contents)
|
||||
"Interpret EXAMPLE-BLOCK element as Org syntax.
|
||||
CONTENTS is nil."
|
||||
(let ((options (org-element-get-property :options example-block)))
|
||||
(let ((options (org-element-property :options example-block)))
|
||||
(concat "#+begin_example" (and options (concat " " options)) "\n"
|
||||
(org-remove-indentation
|
||||
(org-element-get-property :value example-block))
|
||||
(org-element-property :value example-block))
|
||||
"#+end_example")))
|
||||
|
||||
|
||||
@ -1064,9 +1064,9 @@ containing `:begin', `:end', `:type', `:hiddenp', `:value' and
|
||||
(defun org-element-export-block-interpreter (export-block contents)
|
||||
"Interpret EXPORT-BLOCK element as Org syntax.
|
||||
CONTENTS is nil."
|
||||
(let ((type (org-element-get-property :type export-block)))
|
||||
(let ((type (org-element-property :type export-block)))
|
||||
(concat (format "#+begin_%s\n" type)
|
||||
(org-element-get-property :value export-block)
|
||||
(org-element-property :value export-block)
|
||||
(format "#+end_%s" type))))
|
||||
|
||||
|
||||
@ -1116,7 +1116,7 @@ keywords."
|
||||
(defun org-element-fixed-width-interpreter (fixed-width contents)
|
||||
"Interpret FIXED-WIDTH element as Org syntax.
|
||||
CONTENTS is nil."
|
||||
(org-remove-indentation (org-element-get-property :value fixed-width)))
|
||||
(org-remove-indentation (org-element-property :value fixed-width)))
|
||||
|
||||
|
||||
;;;; Horizontal Rule
|
||||
@ -1174,8 +1174,8 @@ keywords."
|
||||
"Interpret KEYWORD element as Org syntax.
|
||||
CONTENTS is nil."
|
||||
(format "#+%s: %s"
|
||||
(org-element-get-property :key keyword)
|
||||
(org-element-get-property :value keyword)))
|
||||
(org-element-property :key keyword)
|
||||
(org-element-property :value keyword)))
|
||||
|
||||
|
||||
;;;; Latex Environment
|
||||
@ -1207,7 +1207,7 @@ containing `:begin', `:end', `:value' and `:post-blank' keywords."
|
||||
(defun org-element-latex-environment-interpreter (latex-environment contents)
|
||||
"Interpret LATEX-ENVIRONMENT element as Org syntax.
|
||||
CONTENTS is nil."
|
||||
(org-element-get-property :value latex-environment))
|
||||
(org-element-property :value latex-environment))
|
||||
|
||||
|
||||
;;;; Paragraph
|
||||
@ -1289,7 +1289,7 @@ containing `:begin', `:end', `:hiddenp', `:contents-begin',
|
||||
(defun org-element-property-drawer-interpreter (property-drawer contents)
|
||||
"Interpret PROPERTY-DRAWER element as Org syntax.
|
||||
CONTENTS is nil."
|
||||
(let ((props (org-element-get-property :properties property-drawer)))
|
||||
(let ((props (org-element-property :properties property-drawer)))
|
||||
(concat
|
||||
":PROPERTIES:\n"
|
||||
(mapconcat (lambda (p)
|
||||
@ -1325,7 +1325,7 @@ Assume point is at beginning of the section."
|
||||
(defun org-element-quote-section-interpreter (quote-section contents)
|
||||
"Interpret QUOTE-SECTION element as Org syntax.
|
||||
CONTENTS is nil."
|
||||
(org-element-get-property :value quote-section))
|
||||
(org-element-property :value quote-section))
|
||||
|
||||
|
||||
;;;; Src Block
|
||||
@ -1389,10 +1389,10 @@ and `:post-blank' keywords."
|
||||
(defun org-element-src-block-interpreter (src-block contents)
|
||||
"Interpret SRC-BLOCK element as Org syntax.
|
||||
CONTENTS is nil."
|
||||
(let ((lang (org-element-get-property :language src-block))
|
||||
(switches (org-element-get-property :switches src-block))
|
||||
(params (org-element-get-property :parameters src-block))
|
||||
(value (let ((val (org-element-get-property :value src-block)))
|
||||
(let ((lang (org-element-property :language src-block))
|
||||
(switches (org-element-property :switches src-block))
|
||||
(params (org-element-property :parameters src-block))
|
||||
(value (let ((val (org-element-property :value src-block)))
|
||||
(cond
|
||||
(org-src-preserve-indentation val)
|
||||
((zerop org-edit-src-content-indentation)
|
||||
@ -1445,7 +1445,7 @@ Return a list whose car is `table' and cdr is a plist containing
|
||||
(defun org-element-table-interpreter (table contents)
|
||||
"Interpret TABLE element as Org syntax.
|
||||
CONTENTS is nil."
|
||||
(org-element-get-property :raw-table table))
|
||||
(org-element-property :raw-table table))
|
||||
|
||||
|
||||
;;;; Verse Block
|
||||
@ -1492,7 +1492,7 @@ Assume point is at beginning or end of the block."
|
||||
CONTENTS is nil."
|
||||
(format "#+begin_verse\n%s#+end_verse"
|
||||
(org-remove-indentation
|
||||
(org-element-get-property :raw-value verse-block))))
|
||||
(org-element-property :raw-value verse-block))))
|
||||
|
||||
|
||||
|
||||
@ -1551,7 +1551,7 @@ Assume point is at the first emphasis marker."
|
||||
(defun org-element-emphasis-interpreter (emphasis contents)
|
||||
"Interpret EMPHASIS object as Org syntax.
|
||||
CONTENTS is the contents of the object."
|
||||
(let ((marker (org-element-get-property :marker emphasis)))
|
||||
(let ((marker (org-element-property :marker emphasis)))
|
||||
(concat marker contents marker)))
|
||||
|
||||
(defun org-element-text-markup-successor (limit)
|
||||
@ -1606,8 +1606,8 @@ Assume point is at the beginning of the entity."
|
||||
"Interpret ENTITY object as Org syntax.
|
||||
CONTENTS is nil."
|
||||
(concat "\\"
|
||||
(org-element-get-property :name entity)
|
||||
(when (org-element-get-property :use-brackets-p entity) "{}")))
|
||||
(org-element-property :name entity)
|
||||
(when (org-element-property :use-brackets-p entity) "{}")))
|
||||
|
||||
(defun org-element-latex-or-entity-successor (limit)
|
||||
"Search for the next latex-fragment or entity object.
|
||||
@ -1674,8 +1674,8 @@ Assume point is at the beginning of the snippet."
|
||||
"Interpret EXPORT-SNIPPET object as Org syntax.
|
||||
CONTENTS is nil."
|
||||
(format "@%s{%s}"
|
||||
(org-element-get-property :back-end export-snippet)
|
||||
(org-element-get-property :value export-snippet)))
|
||||
(org-element-property :back-end export-snippet)
|
||||
(org-element-property :value export-snippet)))
|
||||
|
||||
(defun org-element-export-snippet-successor (limit)
|
||||
"Search for the next export-snippet object.
|
||||
@ -1727,11 +1727,10 @@ with `:label', `:type', `:definition', `:begin', `:end' and
|
||||
(defun org-element-footnote-reference-interpreter (footnote-reference contents)
|
||||
"Interpret FOOTNOTE-REFERENCE object as Org syntax.
|
||||
CONTENTS is nil."
|
||||
(let ((label (or (org-element-get-property :label footnote-reference)
|
||||
"fn:"))
|
||||
(def (let ((raw (org-element-get-property
|
||||
:raw-definition footnote-reference)))
|
||||
(if raw (concat ":" raw) ""))))
|
||||
(let ((label (or (org-element-property :label footnote-reference) "fn:"))
|
||||
(def
|
||||
(let ((raw (org-element-property :raw-definition footnote-reference)))
|
||||
(if raw (concat ":" raw) ""))))
|
||||
(format "[%s]" (concat label def))))
|
||||
|
||||
(defun org-element-footnote-reference-successor (limit)
|
||||
@ -1772,7 +1771,7 @@ Assume point is at the beginning of the babel call."
|
||||
(defun org-element-inline-babel-call-interpreter (inline-babel-call contents)
|
||||
"Interpret INLINE-BABEL-CALL object as Org syntax.
|
||||
CONTENTS is nil."
|
||||
(let* ((babel-info (org-element-get-property :info inline-babel-call))
|
||||
(let* ((babel-info (org-element-property :info inline-babel-call))
|
||||
(main-source (car babel-info))
|
||||
(post-options (nth 1 babel-info)))
|
||||
(concat "call_"
|
||||
@ -1830,9 +1829,9 @@ Assume point is at the beginning of the inline src block."
|
||||
(defun org-element-inline-src-block-interpreter (inline-src-block contents)
|
||||
"Interpret INLINE-SRC-BLOCK object as Org syntax.
|
||||
CONTENTS is nil."
|
||||
(let ((language (org-element-get-property :language inline-src-block))
|
||||
(arguments (org-element-get-property :parameters inline-src-block))
|
||||
(body (org-element-get-property :value inline-src-block)))
|
||||
(let ((language (org-element-property :language inline-src-block))
|
||||
(arguments (org-element-property :parameters inline-src-block))
|
||||
(body (org-element-property :value inline-src-block)))
|
||||
(format "src_%s%s{%s}"
|
||||
language
|
||||
(if arguments (format "[%s]" arguments) "")
|
||||
@ -1888,7 +1887,7 @@ Assume point is at the beginning of the latex fragment."
|
||||
(defun org-element-latex-fragment-interpreter (latex-fragment contents)
|
||||
"Interpret LATEX-FRAGMENT object as Org syntax.
|
||||
CONTENTS is nil."
|
||||
(org-element-get-property :value latex-fragment))
|
||||
(org-element-property :value latex-fragment))
|
||||
|
||||
;;;; Line Break
|
||||
|
||||
@ -2007,13 +2006,12 @@ Assume point is at the beginning of the link."
|
||||
(defun org-element-link-interpreter (link contents)
|
||||
"Interpret LINK object as Org syntax.
|
||||
CONTENTS is the contents of the object."
|
||||
(let ((type (org-element-get-property :type link))
|
||||
(raw-link (org-element-get-property :raw-link link)))
|
||||
(cond
|
||||
((string= type "radio") raw-link)
|
||||
(t (format "[[%s]%s]"
|
||||
raw-link
|
||||
(if (string= contents "") "" (format "[%s]" contents)))))))
|
||||
(let ((type (org-element-property :type link))
|
||||
(raw-link (org-element-property :raw-link link)))
|
||||
(if (string= type "radio") raw-link
|
||||
(format "[[%s]%s]"
|
||||
raw-link
|
||||
(if (string= contents "") "" (format "[%s]" contents))))))
|
||||
|
||||
(defun org-element-link-successor (limit)
|
||||
"Search for the next link object.
|
||||
@ -2024,9 +2022,8 @@ Return value is a cons cell whose car is `link' and cdr is
|
||||
beginning position."
|
||||
(save-excursion
|
||||
(let ((link-regexp
|
||||
(if org-target-link-regexp
|
||||
(concat org-any-link-re "\\|" org-target-link-regexp)
|
||||
org-any-link-re)))
|
||||
(if (not org-target-link-regexp) org-any-link-re
|
||||
(concat org-any-link-re "\\|" org-target-link-regexp))))
|
||||
(when (re-search-forward link-regexp limit t)
|
||||
(cons 'link (match-beginning 0))))))
|
||||
|
||||
@ -2071,7 +2068,7 @@ Assume point is at the macro."
|
||||
(defun org-element-macro-interpreter (macro contents)
|
||||
"Interpret MACRO object as Org syntax.
|
||||
CONTENTS is nil."
|
||||
(org-element-get-property :value macro))
|
||||
(org-element-property :value macro))
|
||||
|
||||
(defun org-element-macro-successor (limit)
|
||||
"Search for the next macro object.
|
||||
@ -2157,7 +2154,7 @@ Assume point is at the beginning of the statistics-cookie."
|
||||
(defun org-element-statistics-cookie-interpreter (statistics-cookie contents)
|
||||
"Interpret STATISTICS-COOKIE object as Org syntax.
|
||||
CONTENTS is nil."
|
||||
(org-element-get-property :value statistics-cookie))
|
||||
(org-element-property :value statistics-cookie))
|
||||
|
||||
(defun org-element-statistics-cookie-successor (limit)
|
||||
"Search for the next statistics cookie object.
|
||||
@ -2205,7 +2202,7 @@ Assume point is at the underscore."
|
||||
"Interpret SUBSCRIPT object as Org syntax.
|
||||
CONTENTS is the contents of the object."
|
||||
(format
|
||||
(if (org-element-get-property :use-brackets-p subscript) "_{%s}" "_%s")
|
||||
(if (org-element-property :use-brackets-p subscript) "_{%s}" "_%s")
|
||||
contents))
|
||||
|
||||
(defun org-element-sub/superscript-successor (limit)
|
||||
@ -2255,7 +2252,7 @@ Assume point is at the caret."
|
||||
"Interpret SUPERSCRIPT object as Org syntax.
|
||||
CONTENTS is the contents of the object."
|
||||
(format
|
||||
(if (org-element-get-property :use-brackets-p superscript) "^{%s}" "^%s")
|
||||
(if (org-element-property :use-brackets-p superscript) "^{%s}" "^%s")
|
||||
contents))
|
||||
|
||||
|
||||
@ -2353,11 +2350,11 @@ Assume point is at the beginning of the time-stamp."
|
||||
"Interpret TIME-STAMP object as Org syntax.
|
||||
CONTENTS is nil."
|
||||
(concat
|
||||
(case (org-element-get-property :appt-type time-stamp)
|
||||
(case (org-element-property :appt-type time-stamp)
|
||||
(closed (concat org-closed-string " "))
|
||||
(deadline (concat org-deadline-string " "))
|
||||
(scheduled (concat org-scheduled-string " ")))
|
||||
(org-element-get-property :value time-stamp)))
|
||||
(org-element-property :value time-stamp)))
|
||||
|
||||
(defun org-element-time-stamp-successor (limit)
|
||||
"Search for the next time-stamp object.
|
||||
@ -2407,8 +2404,8 @@ Assume point is at the first verbatim marker."
|
||||
(defun org-element-verbatim-interpreter (verbatim contents)
|
||||
"Interpret VERBATIM object as Org syntax.
|
||||
CONTENTS is nil."
|
||||
(let ((marker (org-element-get-property :marker verbatim))
|
||||
(value (org-element-get-property :value verbatim)))
|
||||
(let ((marker (org-element-property :marker verbatim))
|
||||
(value (org-element-property :value verbatim)))
|
||||
(concat marker value marker)))
|
||||
|
||||
|
||||
@ -2593,8 +2590,8 @@ its type is listed here.")
|
||||
|
||||
;;; Accessors
|
||||
;;
|
||||
;; Provide three accessors: `org-element-type',
|
||||
;; `org-element-get-property' and `org-element-get-contents'.
|
||||
;; Provide three accessors: `org-element-type', `org-element-property'
|
||||
;; and `org-element-contents'.
|
||||
|
||||
(defun org-element-type (element)
|
||||
"Return type of element ELEMENT.
|
||||
@ -2608,11 +2605,11 @@ It can also return the following special value:
|
||||
((not (consp element)) (and (stringp element) 'plain-text))
|
||||
((symbolp (car element)) (car element))))
|
||||
|
||||
(defun org-element-get-property (property element)
|
||||
(defun org-element-property (property element)
|
||||
"Extract the value from the PROPERTY of an ELEMENT."
|
||||
(plist-get (nth 1 element) property))
|
||||
|
||||
(defun org-element-get-contents (element)
|
||||
(defun org-element-contents (element)
|
||||
"Extract contents from an ELEMENT."
|
||||
(nthcdr 2 element))
|
||||
|
||||
@ -3052,7 +3049,7 @@ Nil values returned from FUN are ignored in the result."
|
||||
--walk-tree
|
||||
`(org-data
|
||||
nil
|
||||
,@(org-element-get-property
|
||||
,@(org-element-property
|
||||
(cdr (assq --type org-element-secondary-value-alist))
|
||||
--blob))
|
||||
--local))
|
||||
@ -3079,7 +3076,7 @@ Nil values returned from FUN are ignored in the result."
|
||||
((and info
|
||||
(eq --type 'headline)
|
||||
(eq (plist-get info :with-archived-trees) 'headline)
|
||||
(org-element-get-property :archivedp --blob))
|
||||
(org-element-property :archivedp --blob))
|
||||
(funcall --check-blob --type types fun --blob --local))
|
||||
;; Limiting recursion to greater elements, and --BLOB
|
||||
;; isn't one.
|
||||
@ -3105,7 +3102,7 @@ Nil values returned from FUN are ignored in the result."
|
||||
--local
|
||||
`(:genealogy
|
||||
,(cons --blob (plist-get --local :genealogy)))))))))
|
||||
(org-element-get-contents --data))))))
|
||||
(org-element-contents --data))))))
|
||||
(catch 'first-match
|
||||
(funcall --walk-tree data info)
|
||||
;; Return value in a proper order.
|
||||
@ -3170,23 +3167,23 @@ Elements are accumulated into ACC."
|
||||
;; directly, skipping `org-element-current-element'.
|
||||
(if (eq special 'item)
|
||||
(let ((element (org-element-item-parser structure)))
|
||||
(goto-char (org-element-get-property :end element))
|
||||
(goto-char (org-element-property :end element))
|
||||
(org-element-parse-elements
|
||||
(org-element-get-property :contents-begin element)
|
||||
(org-element-get-property :contents-end element)
|
||||
(org-element-property :contents-begin element)
|
||||
(org-element-property :contents-end element)
|
||||
nil structure granularity visible-only (reverse element)))
|
||||
;; 2. When ITEM is nil, find current element's type and parse
|
||||
;; it accordingly to its category.
|
||||
(let ((element (org-element-current-element special structure)))
|
||||
(goto-char (org-element-get-property :end element))
|
||||
(goto-char (org-element-property :end element))
|
||||
(cond
|
||||
;; Case 1. ELEMENT is a paragraph. Parse objects inside,
|
||||
;; if GRANULARITY allows it.
|
||||
((and (eq (org-element-type element) 'paragraph)
|
||||
(or (not granularity) (eq granularity 'object)))
|
||||
(org-element-parse-objects
|
||||
(org-element-get-property :contents-begin element)
|
||||
(org-element-get-property :contents-end element)
|
||||
(org-element-property :contents-begin element)
|
||||
(org-element-property :contents-end element)
|
||||
(reverse element) nil))
|
||||
;; Case 2. ELEMENT is recursive: parse it between
|
||||
;; `contents-begin' and `contents-end'. Make sure
|
||||
@ -3199,19 +3196,19 @@ Elements are accumulated into ACC."
|
||||
(memq granularity '(element object))
|
||||
(eq (org-element-type element) 'headline))
|
||||
(not (and visible-only
|
||||
(org-element-get-property :hiddenp element))))
|
||||
(org-element-property :hiddenp element))))
|
||||
(org-element-parse-elements
|
||||
(org-element-get-property :contents-begin element)
|
||||
(org-element-get-property :contents-end element)
|
||||
(org-element-property :contents-begin element)
|
||||
(org-element-property :contents-end element)
|
||||
;; At a plain list, switch to item mode. At an
|
||||
;; headline, switch to section mode. Any other
|
||||
;; element turns off special modes.
|
||||
(case (org-element-type element)
|
||||
(plain-list 'item)
|
||||
(headline (if (org-element-get-property :quotedp element)
|
||||
(headline (if (org-element-property :quotedp element)
|
||||
'quote-section
|
||||
'section)))
|
||||
(org-element-get-property :structure element)
|
||||
(org-element-property :structure element)
|
||||
granularity visible-only (reverse element)))
|
||||
;; Case 3. Else, just accumulate ELEMENT.
|
||||
(t element))))
|
||||
@ -3371,15 +3368,15 @@ allowed in the current object."
|
||||
end restriction candidates))
|
||||
(setq next-object (funcall get-next-object candidates))
|
||||
;; 1. Text before any object. Untabify it.
|
||||
(let ((obj-beg (org-element-get-property :begin next-object)))
|
||||
(let ((obj-beg (org-element-property :begin next-object)))
|
||||
(unless (= (point) obj-beg)
|
||||
(push (replace-regexp-in-string
|
||||
"\t" (make-string tab-width ? )
|
||||
(buffer-substring-no-properties (point) obj-beg))
|
||||
acc)))
|
||||
;; 2. Object...
|
||||
(let ((obj-end (org-element-get-property :end next-object))
|
||||
(cont-beg (org-element-get-property :contents-begin next-object)))
|
||||
(let ((obj-end (org-element-property :end next-object))
|
||||
(cont-beg (org-element-property :contents-begin next-object)))
|
||||
(push (if (and (memq (car next-object) org-element-recursive-objects)
|
||||
cont-beg)
|
||||
;; ... recursive. The CONT-BEG check is for
|
||||
@ -3388,7 +3385,7 @@ allowed in the current object."
|
||||
(save-restriction
|
||||
(narrow-to-region
|
||||
cont-beg
|
||||
(org-element-get-property :contents-end next-object))
|
||||
(org-element-property :contents-end next-object))
|
||||
(org-element-parse-objects
|
||||
(point-min) (point-max) (reverse next-object)
|
||||
;; Restrict allowed objects. This is the
|
||||
@ -3527,12 +3524,11 @@ Return Org syntax as a string."
|
||||
(concat
|
||||
(org-element-interpret--affiliated-keywords blob)
|
||||
(org-element-normalize-string results)
|
||||
(make-string (org-element-get-property :post-blank blob) 10)))
|
||||
(make-string (org-element-property :post-blank blob) 10)))
|
||||
(t (concat
|
||||
results
|
||||
(make-string
|
||||
(org-element-get-property :post-blank blob) 32))))))))
|
||||
(org-element-get-contents data) ""))
|
||||
(make-string (org-element-property :post-blank blob) 32))))))))
|
||||
(org-element-contents data) ""))
|
||||
|
||||
(defun org-element-interpret-secondary (secondary)
|
||||
"Interpret SECONDARY string as Org syntax.
|
||||
@ -3563,7 +3559,7 @@ If there is no affiliated keyword, return the empty string."
|
||||
"\n"))))))
|
||||
(mapconcat
|
||||
(lambda (key)
|
||||
(let ((value (org-element-get-property (intern (concat ":" key)) element)))
|
||||
(let ((value (org-element-property (intern (concat ":" key)) element)))
|
||||
(when value
|
||||
(if (member key org-element-multiple-keywords)
|
||||
(mapconcat (lambda (line)
|
||||
@ -3641,7 +3637,7 @@ indentation is not done with TAB characters."
|
||||
(push (length (match-string 1 object)) ind-list))))
|
||||
((memq (org-element-type object) org-element-recursive-objects)
|
||||
(funcall collect-inds object first-flag))))
|
||||
(org-element-get-contents blob))))))
|
||||
(org-element-contents blob))))))
|
||||
;; Collect indentation list in ELEMENT. Possibly remove first
|
||||
;; value if IGNORE-FIRST is non-nil.
|
||||
(catch 'zero (funcall collect-inds element (not ignore-first)))
|
||||
@ -3671,7 +3667,7 @@ indentation is not done with TAB characters."
|
||||
((memq (org-element-type object) org-element-recursive-objects)
|
||||
(funcall build object mci first-flag))
|
||||
(t object)))
|
||||
(org-element-get-contents blob)))))))
|
||||
(org-element-contents blob)))))))
|
||||
(funcall build element (apply 'min ind-list) (not ignore-first))))))
|
||||
|
||||
|
||||
@ -3698,10 +3694,10 @@ indentation is not done with TAB characters."
|
||||
|
||||
(defsubst org-element-nested-p (elem-A elem-B)
|
||||
"Non-nil when elements ELEM-A and ELEM-B are nested."
|
||||
(let ((beg-A (org-element-get-property :begin elem-A))
|
||||
(beg-B (org-element-get-property :begin elem-B))
|
||||
(end-A (org-element-get-property :end elem-A))
|
||||
(end-B (org-element-get-property :end elem-B)))
|
||||
(let ((beg-A (org-element-property :begin elem-A))
|
||||
(beg-B (org-element-property :begin elem-B))
|
||||
(end-A (org-element-property :end elem-A))
|
||||
(end-B (org-element-property :end elem-B)))
|
||||
(or (and (>= beg-A beg-B) (<= end-A end-B))
|
||||
(and (>= beg-B beg-A) (<= end-B end-A)))))
|
||||
|
||||
@ -3711,16 +3707,16 @@ indentation is not done with TAB characters."
|
||||
Leave point at the end of ELEM-A.
|
||||
|
||||
Assume ELEM-A is before ELEM-B and that they are not nested."
|
||||
(goto-char (org-element-get-property :begin elem-A))
|
||||
(let* ((beg-B (org-element-get-property :begin elem-B))
|
||||
(goto-char (org-element-property :begin elem-A))
|
||||
(let* ((beg-B (org-element-property :begin elem-B))
|
||||
(end-B-no-blank (save-excursion
|
||||
(goto-char (org-element-get-property :end elem-B))
|
||||
(goto-char (org-element-property :end elem-B))
|
||||
(skip-chars-backward " \r\t\n")
|
||||
(forward-line)
|
||||
(point)))
|
||||
(beg-A (org-element-get-property :begin elem-A))
|
||||
(beg-A (org-element-property :begin elem-A))
|
||||
(end-A-no-blank (save-excursion
|
||||
(goto-char (org-element-get-property :end elem-A))
|
||||
(goto-char (org-element-property :end elem-A))
|
||||
(skip-chars-backward " \r\t\n")
|
||||
(forward-line)
|
||||
(point)))
|
||||
@ -3729,14 +3725,14 @@ Assume ELEM-A is before ELEM-B and that they are not nested."
|
||||
(between-A-B (buffer-substring end-A-no-blank beg-B)))
|
||||
(delete-region beg-A end-B-no-blank)
|
||||
(insert body-B between-A-B body-A)
|
||||
(goto-char (org-element-get-property :end elem-B))))
|
||||
(goto-char (org-element-property :end elem-B))))
|
||||
|
||||
(defun org-element-backward ()
|
||||
"Move backward by one element."
|
||||
(interactive)
|
||||
(let* ((opoint (point))
|
||||
(element (org-element-at-point))
|
||||
(start-el-beg (org-element-get-property :begin element)))
|
||||
(start-el-beg (org-element-property :begin element)))
|
||||
;; At an headline. The previous element is the previous sibling,
|
||||
;; or the parent if any.
|
||||
(cond
|
||||
@ -3755,9 +3751,9 @@ Assume ELEM-A is before ELEM-B and that they are not nested."
|
||||
(if (and itemp (<= (org-list-get-bottom-point struct) opoint))
|
||||
(progn
|
||||
(goto-char (org-list-get-top-point struct))
|
||||
(goto-char (org-element-get-property
|
||||
(goto-char (org-element-property
|
||||
:begin (org-element-at-point))))
|
||||
(goto-char (org-element-get-property :begin prev-element))))
|
||||
(goto-char (org-element-property :begin prev-element))))
|
||||
(while (org-truely-invisible-p) (org-element-up)))
|
||||
;; Else, move at the element beginning. One exception: if point
|
||||
;; was in the blank lines after the end of a list, move directly
|
||||
@ -3769,9 +3765,9 @@ Assume ELEM-A is before ELEM-B and that they are not nested."
|
||||
(save-excursion (goto-char itemp)
|
||||
(setq struct (org-list-struct))))
|
||||
opoint))
|
||||
(progn (goto-char (org-list-get-top-point struct))
|
||||
(goto-char (org-element-get-property
|
||||
:begin (org-element-at-point))))
|
||||
(progn
|
||||
(goto-char (org-list-get-top-point struct))
|
||||
(goto-char (org-element-property :begin (org-element-at-point))))
|
||||
(goto-char start-el-beg)))))))
|
||||
|
||||
(defun org-element-drag-backward ()
|
||||
@ -3782,9 +3778,9 @@ Assume ELEM-A is before ELEM-B and that they are not nested."
|
||||
(when (= (progn (goto-char (point-min))
|
||||
(org-skip-whitespace)
|
||||
(point-at-bol))
|
||||
(org-element-get-property :end elem))
|
||||
(org-element-property :end elem))
|
||||
(error "Cannot drag element backward"))
|
||||
(goto-char (org-element-get-property :begin elem))
|
||||
(goto-char (org-element-property :begin elem))
|
||||
(org-element-backward)
|
||||
(let ((prev-elem (org-element-at-point)))
|
||||
(when (or (org-element-nested-p elem prev-elem)
|
||||
@ -3794,8 +3790,8 @@ Assume ELEM-A is before ELEM-B and that they are not nested."
|
||||
(error "Cannot drag element backward"))
|
||||
;; Compute new position of point: it's shifted by PREV-ELEM
|
||||
;; body's length.
|
||||
(let ((size-prev (- (org-element-get-property :end prev-elem)
|
||||
(org-element-get-property :begin prev-elem))))
|
||||
(let ((size-prev (- (org-element-property :end prev-elem)
|
||||
(org-element-property :begin prev-elem))))
|
||||
(org-element-swap-A-B prev-elem elem)
|
||||
(goto-char (- pos size-prev))))))
|
||||
|
||||
@ -3804,9 +3800,9 @@ Assume ELEM-A is before ELEM-B and that they are not nested."
|
||||
(interactive)
|
||||
(let* ((pos (point))
|
||||
(elem (org-element-at-point)))
|
||||
(when (= (point-max) (org-element-get-property :end elem))
|
||||
(when (= (point-max) (org-element-property :end elem))
|
||||
(error "Cannot drag element forward"))
|
||||
(goto-char (org-element-get-property :end elem))
|
||||
(goto-char (org-element-property :end elem))
|
||||
(let ((next-elem (org-element-at-point)))
|
||||
(when (or (org-element-nested-p elem next-elem)
|
||||
(and (eq (car next-elem) 'headline)
|
||||
@ -3817,14 +3813,14 @@ Assume ELEM-A is before ELEM-B and that they are not nested."
|
||||
;; body's length (without final blanks) and by the length of
|
||||
;; blanks between ELEM and NEXT-ELEM.
|
||||
(let ((size-next (- (save-excursion
|
||||
(goto-char (org-element-get-property :end next-elem))
|
||||
(goto-char (org-element-property :end next-elem))
|
||||
(skip-chars-backward " \r\t\n")
|
||||
(forward-line)
|
||||
(point))
|
||||
(org-element-get-property :begin next-elem)))
|
||||
(size-blank (- (org-element-get-property :end elem)
|
||||
(org-element-property :begin next-elem)))
|
||||
(size-blank (- (org-element-property :end elem)
|
||||
(save-excursion
|
||||
(goto-char (org-element-get-property :end elem))
|
||||
(goto-char (org-element-property :end elem))
|
||||
(skip-chars-backward " \r\t\n")
|
||||
(forward-line)
|
||||
(point)))))
|
||||
@ -3846,8 +3842,8 @@ Assume ELEM-A is before ELEM-B and that they are not nested."
|
||||
;; At an item: Either move to the next element inside, or
|
||||
;; to its end if it's hidden.
|
||||
((eq (org-element-type element) 'item)
|
||||
(if (org-element-get-property :hiddenp element)
|
||||
(goto-char (org-element-get-property :end element))
|
||||
(if (org-element-property :hiddenp element)
|
||||
(goto-char (org-element-property :end element))
|
||||
(end-of-line)
|
||||
(re-search-forward org-element-paragraph-separate nil t)
|
||||
(org-skip-whitespace)
|
||||
@ -3855,14 +3851,14 @@ Assume ELEM-A is before ELEM-B and that they are not nested."
|
||||
;; At a recursive element: Either move inside, or if it's
|
||||
;; hidden, move to its end.
|
||||
((memq (org-element-type element) org-element-greater-elements)
|
||||
(let ((cbeg (org-element-get-property :contents-begin element)))
|
||||
(let ((cbeg (org-element-property :contents-begin element)))
|
||||
(goto-char
|
||||
(if (or (org-element-get-property :hiddenp element)
|
||||
(if (or (org-element-property :hiddenp element)
|
||||
(> origin cbeg))
|
||||
(org-element-get-property :end element)
|
||||
(org-element-property :end element)
|
||||
cbeg))))
|
||||
;; Else: move to the current element's end.
|
||||
(t (goto-char (org-element-get-property :end element))))))))
|
||||
(t (goto-char (org-element-property :end element))))))))
|
||||
|
||||
(defun org-element-mark-element ()
|
||||
"Put point at beginning of this element, mark at end.
|
||||
@ -3877,11 +3873,11 @@ ones already marked."
|
||||
(set-mark
|
||||
(save-excursion
|
||||
(goto-char (mark))
|
||||
(goto-char (org-element-get-property :end (org-element-at-point)))))
|
||||
(goto-char (org-element-property :end (org-element-at-point)))))
|
||||
(let ((element (org-element-at-point)))
|
||||
(end-of-line)
|
||||
(push-mark (org-element-get-property :end element) t t)
|
||||
(goto-char (org-element-get-property :begin element))))))
|
||||
(push-mark (org-element-property :end element) t t)
|
||||
(goto-char (org-element-property :begin element))))))
|
||||
|
||||
(defun org-narrow-to-element ()
|
||||
"Narrow buffer to current element."
|
||||
@ -3890,16 +3886,16 @@ ones already marked."
|
||||
(cond
|
||||
((eq (car elem) 'headline)
|
||||
(narrow-to-region
|
||||
(org-element-get-property :begin elem)
|
||||
(org-element-get-property :end elem)))
|
||||
(org-element-property :begin elem)
|
||||
(org-element-property :end elem)))
|
||||
((memq (car elem) org-element-greater-elements)
|
||||
(narrow-to-region
|
||||
(org-element-get-property :contents-begin elem)
|
||||
(org-element-get-property :contents-end elem)))
|
||||
(org-element-property :contents-begin elem)
|
||||
(org-element-property :contents-end elem)))
|
||||
(t
|
||||
(narrow-to-region
|
||||
(org-element-get-property :begin elem)
|
||||
(org-element-get-property :end elem))))))
|
||||
(org-element-property :begin elem)
|
||||
(org-element-property :end elem))))))
|
||||
|
||||
(defun org-transpose-elements ()
|
||||
"Transpose current and previous elements, keeping blank lines between.
|
||||
@ -3911,9 +3907,9 @@ Point is moved after both elements."
|
||||
(when (= (save-excursion (goto-char (point-min))
|
||||
(org-skip-whitespace)
|
||||
(point-at-bol))
|
||||
(org-element-get-property :begin cur))
|
||||
(org-element-property :begin cur))
|
||||
(error "No previous element"))
|
||||
(goto-char (org-element-get-property :begin cur))
|
||||
(goto-char (org-element-property :begin cur))
|
||||
(forward-line -1)
|
||||
(let ((prev (org-element-at-point)))
|
||||
(when (org-element-nested-p cur prev)
|
||||
@ -3936,15 +3932,15 @@ modified."
|
||||
(mapc (lambda (element)
|
||||
(if (eq (org-element-type element) 'headline)
|
||||
(funcall unindent-tree
|
||||
(org-element-get-contents element))
|
||||
(org-element-contents element))
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(narrow-to-region
|
||||
(org-element-get-property :begin element)
|
||||
(org-element-get-property :end element))
|
||||
(org-element-property :begin element)
|
||||
(org-element-property :end element))
|
||||
(org-do-remove-indentation)))))
|
||||
(reverse contents))))))
|
||||
(funcall unindent-tree (org-element-get-contents parse-tree))))
|
||||
(funcall unindent-tree (org-element-contents parse-tree))))
|
||||
|
||||
(defun org-element-up ()
|
||||
"Move to upper element.
|
||||
@ -3957,34 +3953,34 @@ Return position at the beginning of the upper element."
|
||||
(or (org-up-heading-safe) (error "No surronding element")))
|
||||
((and (org-at-item-p)
|
||||
(setq elem (org-element-at-point))
|
||||
(let* ((top-list-p (zerop (org-element-get-property :level elem))))
|
||||
(let* ((top-list-p (zerop (org-element-property :level elem))))
|
||||
(unless top-list-p
|
||||
;; If parent is bound to be in the same list as the
|
||||
;; original point, move to that parent.
|
||||
(let ((struct (org-element-get-property :structure elem)))
|
||||
(let ((struct (org-element-property :structure elem)))
|
||||
(goto-char
|
||||
(org-list-get-parent
|
||||
(point-at-bol) struct (org-list-parents-alist struct))))))))
|
||||
(t
|
||||
(let* ((elem (or elem (org-element-at-point)))
|
||||
(end (save-excursion
|
||||
(goto-char (org-element-get-property :end elem))
|
||||
(goto-char (org-element-property :end elem))
|
||||
(skip-chars-backward " \r\t\n")
|
||||
(forward-line)
|
||||
(point)))
|
||||
prev-elem)
|
||||
(goto-char (org-element-get-property :begin elem))
|
||||
(goto-char (org-element-property :begin elem))
|
||||
(forward-line -1)
|
||||
(while (and (< (org-element-get-property
|
||||
(while (and (< (org-element-property
|
||||
:end (setq prev-elem (org-element-at-point)))
|
||||
end)
|
||||
(not (bobp)))
|
||||
(goto-char (org-element-get-property :begin prev-elem))
|
||||
(goto-char (org-element-property :begin prev-elem))
|
||||
(forward-line -1))
|
||||
(if (and (bobp) (< (org-element-get-property :end prev-elem) end))
|
||||
(if (and (bobp) (< (org-element-property :end prev-elem) end))
|
||||
(progn (goto-char opoint)
|
||||
(error "No surrounding element"))
|
||||
(goto-char (org-element-get-property :begin prev-elem))))))))
|
||||
(goto-char (org-element-property :begin prev-elem))))))))
|
||||
|
||||
|
||||
(provide 'org-element)
|
||||
|
@ -1019,8 +1019,8 @@ Assume buffer is in Org mode. Narrowing, if any, is ignored."
|
||||
(while (re-search-forward special-re nil t)
|
||||
(let ((element (org-element-at-point)))
|
||||
(when (eq (org-element-type element) 'keyword)
|
||||
(let* ((key (upcase (org-element-get-property :key element)))
|
||||
(val (org-element-get-property :value element))
|
||||
(let* ((key (upcase (org-element-property :key element)))
|
||||
(val (org-element-property :value element))
|
||||
(prop
|
||||
(cond
|
||||
((string= key "SETUP_FILE")
|
||||
@ -1096,8 +1096,8 @@ Assume buffer is in Org mode. Narrowing, if any, is ignored."
|
||||
(while (re-search-forward opt-re nil t)
|
||||
(let ((element (org-element-at-point)))
|
||||
(when (eq (org-element-type element) 'keyword)
|
||||
(let* ((key (upcase (org-element-get-property :key element)))
|
||||
(val (org-element-get-property :value element))
|
||||
(let* ((key (upcase (org-element-property :key element)))
|
||||
(val (org-element-property :value element))
|
||||
(prop (cdr (assoc key alist)))
|
||||
(behaviour (nth 4 (assq prop all))))
|
||||
(setq plist
|
||||
@ -1291,7 +1291,7 @@ OPTIONS is a plist holding export options."
|
||||
data
|
||||
'headline
|
||||
(lambda (headline info)
|
||||
(let ((tags (org-element-get-property :with-tags headline)))
|
||||
(let ((tags (org-element-property :with-tags headline)))
|
||||
(and tags (string-match
|
||||
(format ":%s:" (plist-get info :select-tags)) tags))))
|
||||
options
|
||||
@ -1307,9 +1307,9 @@ OPTIONS is a plist holding export options."
|
||||
(when (and (eq (org-element-type blob) 'headline)
|
||||
(not (org-export-skip-p blob options)))
|
||||
(setq min-level
|
||||
(min (org-element-get-property :level blob) min-level)))
|
||||
(min (org-element-property :level blob) min-level)))
|
||||
(when (= min-level 1) (throw 'exit 1)))
|
||||
(org-element-get-contents data))
|
||||
(org-element-contents data))
|
||||
;; If no headline was found, for the sake of consistency, set
|
||||
;; minimum level to 1 nonetheless.
|
||||
(if (= min-level 10000) 1 min-level))))
|
||||
@ -1426,7 +1426,7 @@ Return transcoded string."
|
||||
(unless (and
|
||||
(eq type 'headline)
|
||||
(eq (plist-get info :with-archived-trees) 'headline)
|
||||
(org-element-get-property :archivedp blob))
|
||||
(org-element-property :archivedp blob))
|
||||
(org-element-normalize-string
|
||||
(org-export-data
|
||||
blob backend
|
||||
@ -1466,13 +1466,13 @@ Return transcoded string."
|
||||
(if (eq type 'org-data) results
|
||||
(org-export-filter-apply-functions
|
||||
(plist-get info (intern (format ":filter-%s" type)))
|
||||
(let ((post-blank (org-element-get-property :post-blank blob)))
|
||||
(let ((post-blank (org-element-property :post-blank blob)))
|
||||
(if (memq type org-element-all-elements)
|
||||
(concat (org-element-normalize-string results)
|
||||
(make-string post-blank ?\n))
|
||||
(concat results (make-string post-blank ? ))))
|
||||
backend info)))))))
|
||||
(org-element-get-contents data) ""))
|
||||
(org-element-contents data) ""))
|
||||
|
||||
(defun org-export-secondary-string (secondary backend info)
|
||||
"Convert SECONDARY string into BACKEND format.
|
||||
@ -1497,10 +1497,10 @@ INFO is the plist holding export options."
|
||||
;; Check headline.
|
||||
(headline
|
||||
(let ((with-tasks (plist-get info :with-tasks))
|
||||
(todo (org-element-get-property :todo-keyword blob))
|
||||
(todo-type (org-element-get-property :todo-type blob))
|
||||
(todo (org-element-property :todo-keyword blob))
|
||||
(todo-type (org-element-property :todo-type blob))
|
||||
(archived (plist-get info :with-archived-trees))
|
||||
(tag-list (let ((tags (org-element-get-property :tags blob)))
|
||||
(tag-list (let ((tags (org-element-property :tags blob)))
|
||||
(and tags (org-split-string tags ":")))))
|
||||
(or
|
||||
;; Ignore subtrees with an exclude tag.
|
||||
@ -1512,9 +1512,9 @@ INFO is the plist holding export options."
|
||||
(loop for k in (plist-get info :select-tags)
|
||||
never (member k tag-list)))
|
||||
;; Ignore commented sub-trees.
|
||||
(org-element-get-property :commentedp blob)
|
||||
(org-element-property :commentedp blob)
|
||||
;; Ignore archived subtrees if `:with-archived-trees' is nil.
|
||||
(and (not archived) (org-element-get-property :archivedp blob))
|
||||
(and (not archived) (org-element-property :archivedp blob))
|
||||
;; Ignore tasks, if specified by `:with-tasks' property.
|
||||
(and todo (not with-tasks))
|
||||
(and todo
|
||||
@ -1529,11 +1529,11 @@ INFO is the plist holding export options."
|
||||
(drawer
|
||||
(or (not (plist-get info :with-drawers))
|
||||
(and (consp (plist-get info :with-drawers))
|
||||
(not (member (org-element-get-property :drawer-name blob)
|
||||
(not (member (org-element-property :drawer-name blob)
|
||||
(plist-get info :with-drawers))))))
|
||||
;; Check export snippet.
|
||||
(export-snippet
|
||||
(let* ((raw-back-end (org-element-get-property :back-end blob))
|
||||
(let* ((raw-back-end (org-element-property :back-end blob))
|
||||
(true-back-end
|
||||
(or (cdr (assoc raw-back-end org-export-snippet-translation-alist))
|
||||
raw-back-end)))
|
||||
@ -1558,7 +1558,7 @@ a plist."
|
||||
((subscript superscript)
|
||||
(let ((sub/super-p (plist-get info :with-sub-superscript)))
|
||||
(if (eq sub/super-p '{})
|
||||
(org-element-get-property :use-brackets-p blob)
|
||||
(org-element-property :use-brackets-p blob)
|
||||
sub/super-p)))
|
||||
;; ... tables...
|
||||
(table (plist-get info :with-tables))
|
||||
@ -2396,7 +2396,7 @@ ignored."
|
||||
(lambda (footnote local)
|
||||
(when (org-export-footnote-first-reference-p footnote local)
|
||||
(list (org-export-get-footnote-number footnote local)
|
||||
(org-element-get-property :label footnote)
|
||||
(org-element-property :label footnote)
|
||||
(org-export-get-footnote-definition footnote local))))
|
||||
info)))
|
||||
|
||||
@ -2405,22 +2405,22 @@ ignored."
|
||||
|
||||
FOOTNOTE-REFERENCE is the footnote reference being considered.
|
||||
INFO is the plist used as a communication channel."
|
||||
(let ((label (org-element-get-property :label footnote-reference)))
|
||||
(let ((label (org-element-property :label footnote-reference)))
|
||||
(or (not label)
|
||||
(equal
|
||||
footnote-reference
|
||||
(org-element-map
|
||||
(plist-get info :parse-tree) 'footnote-reference
|
||||
(lambda (footnote local)
|
||||
(when (string= (org-element-get-property :label footnote) label)
|
||||
(when (string= (org-element-property :label footnote) label)
|
||||
footnote))
|
||||
info 'first-match)))))
|
||||
|
||||
(defun org-export-get-footnote-definition (footnote-reference info)
|
||||
"Return definition of FOOTNOTE-REFERENCE as parsed data.
|
||||
INFO is the plist used as a communication channel."
|
||||
(let ((label (org-element-get-property :label footnote-reference)))
|
||||
(or (org-element-get-property :inline-definition footnote-reference)
|
||||
(let ((label (org-element-property :label footnote-reference)))
|
||||
(or (org-element-property :inline-definition footnote-reference)
|
||||
(cdr (assoc label (plist-get info :footnote-definition-alist))))))
|
||||
|
||||
(defun org-export-get-footnote-number (footnote info)
|
||||
@ -2428,11 +2428,11 @@ INFO is the plist used as a communication channel."
|
||||
|
||||
FOOTNOTE is either a footnote reference or a footnote definition.
|
||||
INFO is the plist used as a communication channel."
|
||||
(let ((label (org-element-get-property :label footnote)) seen-refs)
|
||||
(let ((label (org-element-property :label footnote)) seen-refs)
|
||||
(org-element-map
|
||||
(plist-get info :parse-tree) 'footnote-reference
|
||||
(lambda (fn local)
|
||||
(let ((fn-lbl (org-element-get-property :label fn)))
|
||||
(let ((fn-lbl (org-element-property :label fn)))
|
||||
(cond
|
||||
((and (not fn-lbl) (equal fn footnote)) (1+ (length seen-refs)))
|
||||
((and label (string= label fn-lbl)) (1+ (length seen-refs)))
|
||||
@ -2462,7 +2462,7 @@ INFO is the plist used as a communication channel."
|
||||
(defun org-export-get-relative-level (headline info)
|
||||
"Return HEADLINE relative level within current parsed tree.
|
||||
INFO is a plist holding contextual information."
|
||||
(+ (org-element-get-property :level headline)
|
||||
(+ (org-element-property :level headline)
|
||||
(or (plist-get info :headline-offset) 0)))
|
||||
|
||||
(defun org-export-low-level-p (headline info)
|
||||
@ -2511,7 +2511,7 @@ INFO is the plist used as a communication channel."
|
||||
"Non-nil when HEADLINE is the last sibling in its sub-tree.
|
||||
INFO is the plist used as a communication channel."
|
||||
(equal
|
||||
(car (last (org-element-get-contents (car (plist-get info :genealogy)))))
|
||||
(car (last (org-element-contents (car (plist-get info :genealogy)))))
|
||||
headline))
|
||||
|
||||
|
||||
@ -2566,14 +2566,14 @@ the provided rules is non-nil. The default rule is
|
||||
`org-export-default-inline-image-rule'.
|
||||
|
||||
This only applies to links without a description."
|
||||
(and (not (org-element-get-contents link))
|
||||
(and (not (org-element-contents link))
|
||||
(let ((case-fold-search t)
|
||||
(rules (or rules org-export-default-inline-image-rule)))
|
||||
(some
|
||||
(lambda (rule)
|
||||
(and (string= (org-element-get-property :type link) (car rule))
|
||||
(and (string= (org-element-property :type link) (car rule))
|
||||
(string-match (cdr rule)
|
||||
(org-element-get-property :path link))))
|
||||
(org-element-property :path link))))
|
||||
rules))))
|
||||
|
||||
(defun org-export-resolve-fuzzy-link (link info)
|
||||
@ -2594,10 +2594,10 @@ Return value can be an object, an element, or nil:
|
||||
- Otherwise, return nil.
|
||||
|
||||
Assume LINK type is \"fuzzy\"."
|
||||
(let ((path (org-element-get-property :path link)))
|
||||
(let ((path (org-element-property :path link)))
|
||||
;; Link points to a target: return it.
|
||||
(or (loop for target in (plist-get info :target-list)
|
||||
when (string= (org-element-get-property :raw-value target) path)
|
||||
when (string= (org-element-property :raw-value target) path)
|
||||
return target)
|
||||
;; Link either points to an headline or nothing. Try to find
|
||||
;; the source, with priority given to headlines with the closest
|
||||
@ -2613,7 +2613,7 @@ Assume LINK type is \"fuzzy\"."
|
||||
data 'headline
|
||||
(lambda (headline local)
|
||||
(when (string=
|
||||
(org-element-get-property :raw-value headline)
|
||||
(org-element-property :raw-value headline)
|
||||
name)
|
||||
headline))
|
||||
info 'first-match)))))
|
||||
@ -2636,12 +2636,12 @@ INFO is a plist used as a communication channel.
|
||||
|
||||
Return value can be an headline element or nil. Assume LINK type
|
||||
is either \"id\" or \"custom-id\"."
|
||||
(let ((id (org-element-get-property :path link)))
|
||||
(let ((id (org-element-property :path link)))
|
||||
(org-element-map
|
||||
(plist-get info :parse-tree) 'headline
|
||||
(lambda (headline local)
|
||||
(when (or (string= (org-element-get-property :id headline) id)
|
||||
(string= (org-element-get-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)))
|
||||
|
||||
@ -2652,11 +2652,11 @@ INFO is a plist used as a communication channel.
|
||||
|
||||
Assume LINK type is \"ref\" and. Return value is the first
|
||||
element whose `:name' property matches LINK's `:path', or nil."
|
||||
(let ((name (org-element-get-property :path link)))
|
||||
(let ((name (org-element-property :path link)))
|
||||
(org-element-map
|
||||
(plist-get info :parse-tree) org-element-all-elements
|
||||
(lambda (el local)
|
||||
(when (string= (org-element-get-property :name el) name) el))
|
||||
(when (string= (org-element-property :name el) name) el))
|
||||
info 'first-match)))
|
||||
|
||||
(defun org-export-resolve-coderef (ref info)
|
||||
@ -2669,9 +2669,9 @@ depending on src-block or example element's switches."
|
||||
(org-element-map
|
||||
(plist-get info :parse-tree) '(src-block example)
|
||||
(lambda (el local)
|
||||
(let ((switches (or (org-element-get-property :switches el) "")))
|
||||
(let ((switches (or (org-element-property :switches el) "")))
|
||||
(with-temp-buffer
|
||||
(insert (org-trim (org-element-get-property :value el)))
|
||||
(insert (org-trim (org-element-property :value el)))
|
||||
;; Build reference regexp.
|
||||
(let* ((label
|
||||
(or (and (string-match "-l +\"\\([^\"\n]+\\)\"" switches)
|
||||
@ -2701,8 +2701,8 @@ depending on src-block or example element's switches."
|
||||
(defun org-export-expand-macro (macro info)
|
||||
"Expand MACRO and return it as a string.
|
||||
INFO is a plist holding export options."
|
||||
(let* ((key (org-element-get-property :key macro))
|
||||
(args (org-element-get-property :args macro))
|
||||
(let* ((key (org-element-property :key macro))
|
||||
(args (org-element-property :args macro))
|
||||
;; User's macros are stored in the communication channel with
|
||||
;; a ":macro-" prefix. If it's a string leave it as-is.
|
||||
;; Otherwise, it's a secondary string that needs to be
|
||||
@ -2798,12 +2798,12 @@ ELEMENT is excluded from count."
|
||||
;; Only count lines from src-block and example-block elements
|
||||
;; with a "+n" or "-n" switch. A "-n" switch resets counter.
|
||||
((not (memq (org-element-type el) '(src-block example-block))) nil)
|
||||
((let ((switches (org-element-get-property :switches el)))
|
||||
((let ((switches (org-element-property :switches el)))
|
||||
(when (and switches (string-match "\\([-+]\\)n\\>" switches))
|
||||
;; Accumulate locs or reset them.
|
||||
(let ((accumulatep (string= (match-string 1 switches) "-"))
|
||||
(lines (org-count-lines
|
||||
(org-trim (org-element-get-property :value el)))))
|
||||
(org-trim (org-element-property :value el)))))
|
||||
(setq loc (if accumulatep lines (+ loc lines))))))
|
||||
;; Return nil to stay in the loop.
|
||||
nil)))
|
||||
@ -2831,8 +2831,8 @@ resulting string. Both NUM-FMT and REF-FMT arguments are ignored
|
||||
in that situation.
|
||||
|
||||
Return new code as a string."
|
||||
(let* ((switches (or (org-element-get-property :switches element) ""))
|
||||
(code (org-element-get-property :value element))
|
||||
(let* ((switches (or (org-element-property :switches element) ""))
|
||||
(code (org-element-property :value element))
|
||||
(numberp (string-match "[-+]n\\>" switches))
|
||||
(accumulatep (string-match "\\+n\\>" switches))
|
||||
;; Initialize loc counter when any kind of numbering is
|
||||
@ -2855,7 +2855,7 @@ Return new code as a string."
|
||||
;; Free up the protected lines. Note: Org blocks
|
||||
;; have commas at the beginning or every line.
|
||||
(if (string=
|
||||
(or (org-element-get-property :language element) "")
|
||||
(or (org-element-property :language element) "")
|
||||
"org")
|
||||
(replace-regexp-in-string "^," "" c)
|
||||
(replace-regexp-in-string
|
||||
@ -3055,8 +3055,8 @@ Return a list of all elements found, in order of appearance."
|
||||
(org-element-map
|
||||
(plist-get info :parse-tree) type
|
||||
(lambda (element local)
|
||||
(and (or (org-element-get-property :caption element)
|
||||
(org-element-get-property :name element))
|
||||
(and (or (org-element-property :caption element)
|
||||
(org-element-property :name element))
|
||||
(or (not predicate) (funcall predicate element))
|
||||
element)) info))
|
||||
|
||||
@ -3113,7 +3113,7 @@ BLOB is the element or object being considered. INFO is a plist
|
||||
used as a communication channel."
|
||||
;; LOCALP tells if current `:genealogy' is sufficient to find parent
|
||||
;; headline, or if it should be computed.
|
||||
(let ((localp (member blob (org-element-get-contents
|
||||
(let ((localp (member blob (org-element-contents
|
||||
(car (plist-get info :genealogy))))))
|
||||
(if localp (plist-get info :genealogy)
|
||||
(catch 'exit
|
||||
@ -3159,7 +3159,7 @@ a communication channel.
|
||||
|
||||
Return previous element or object, a string, or nil."
|
||||
(let ((parent (car (org-export-get-genealogy blob info))))
|
||||
(cadr (member blob (reverse (org-element-get-contents parent))))))
|
||||
(cadr (member blob (reverse (org-element-contents parent))))))
|
||||
|
||||
(defun org-export-get-next-element (blob info)
|
||||
"Return next element or object.
|
||||
@ -3169,7 +3169,7 @@ a communication channel.
|
||||
|
||||
Return next element or object, a string, or nil."
|
||||
(let ((parent (car (org-export-get-genealogy blob info))))
|
||||
(cadr (member blob (org-element-get-contents parent)))))
|
||||
(cadr (member blob (org-element-contents parent)))))
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user