org-element-lineage: Allow TYPES to be a symbol
* lisp/org-element-ast.el (org-element-lineage): Allow TYPES argument to be a symbol. * lisp/ox-ascii.el (org-ascii--current-text-width): (org-ascii-format-inlinetask-default): (org-ascii-section): * lisp/ox-beamer.el (org-beamer--format-block): * lisp/ox-html.el (org-html-section): (org-html-table-cell): (org-html-table-row): * lisp/ox-latex.el (org-latex-table-cell): (org-latex-table-row): * lisp/ox-odt.el (org-odt-headline): (org-odt-table-style-spec): (org-odt-get-table-cell-styles): (org-odt-table-cell): (org-odt-table-row): * lisp/ox-org.el (org-org-section): * lisp/ox-publish.el (org-publish-collect-index): * lisp/ox-texinfo.el (org-texinfo--get-node): (org-texinfo-section): (org-texinfo-table-row): * lisp/ox.el (org-export--skip-p): (org-export-get-node-property): (org-export-table-cell-borders): (org-export-table-row-in-header-p): (org-export-table-row-number): (org-export-collect-headlines): Update all the callers.
This commit is contained in:
parent
2d22d7f515
commit
81a7e8c836
|
@ -458,7 +458,11 @@ code blocks by target file."
|
|||
(org-babel-map-src-blocks (buffer-file-name)
|
||||
(let ((current-heading-pos
|
||||
(if (org-element--cache-active-p)
|
||||
(or (org-element-property :begin (org-element-lineage (org-element-at-point) '(headline) t)) 1)
|
||||
(or (org-element-property
|
||||
:begin (org-element-lineage
|
||||
(org-element-at-point)
|
||||
'headline t))
|
||||
1)
|
||||
(org-with-wide-buffer
|
||||
(org-with-limited-levels (outline-previous-heading))))))
|
||||
(if (eq last-heading-pos current-heading-pos) (cl-incf counter)
|
||||
|
|
|
@ -955,8 +955,9 @@ the sole contents of the footnote, e.g., after calling `org-cite-wrap-citation'.
|
|||
|
||||
When non-nil, the return value if the footnote container."
|
||||
(let ((footnote
|
||||
(org-element-lineage citation
|
||||
'(footnote-definition footnote-reference))))
|
||||
(org-element-lineage
|
||||
citation
|
||||
'(footnote-definition footnote-reference))))
|
||||
(and footnote
|
||||
(or (not strict)
|
||||
(equal (org-element-contents (org-element-parent citation))
|
||||
|
|
|
@ -1293,7 +1293,7 @@ of matched result, which is either `dedicated' or `fuzzy'."
|
|||
(<= (match-end 3) (point)))
|
||||
(org-element-lineage
|
||||
(save-match-data (org-element-context))
|
||||
'(link) t)))
|
||||
'link t)))
|
||||
(goto-char (match-beginning 0))
|
||||
(setq type 'fuzzy)
|
||||
(throw :fuzzy-match t)))
|
||||
|
@ -1472,7 +1472,7 @@ is non-nil, move backward."
|
|||
(let ((context (save-excursion
|
||||
(unless search-backward (forward-char -1))
|
||||
(org-element-context))))
|
||||
(pcase (org-element-lineage context '(link) t)
|
||||
(pcase (org-element-lineage context 'link t)
|
||||
(`nil nil)
|
||||
(link
|
||||
(goto-char (org-element-property :begin link))
|
||||
|
|
|
@ -1272,7 +1272,7 @@ may have been stored before."
|
|||
(catch :found
|
||||
(while (re-search-forward item-regexp end t)
|
||||
(when (setq item (org-element-lineage
|
||||
(org-element-at-point) '(plain-list) t))
|
||||
(org-element-at-point) 'plain-list t))
|
||||
(goto-char (org-element-property (if prepend? :post-affiliated
|
||||
:contents-end)
|
||||
item))
|
||||
|
@ -1377,7 +1377,7 @@ may have been stored before."
|
|||
;; Narrow to the table, possibly creating one if necessary.
|
||||
(catch :found
|
||||
(while (re-search-forward org-table-dataline-regexp end t)
|
||||
(pcase (org-element-lineage (org-element-at-point) '(table) t)
|
||||
(pcase (org-element-lineage (org-element-at-point) 'table t)
|
||||
(`nil nil)
|
||||
((pred (lambda (e) (eq 'table.el (org-element-property :type e))))
|
||||
nil)
|
||||
|
|
|
@ -1422,7 +1422,7 @@ ELEMENT is the element at point."
|
|||
;; Ignore checks in LOGBOOK (or equivalent) drawer.
|
||||
((let ((log (org-log-into-drawer)))
|
||||
(and log
|
||||
(let ((drawer (org-element-lineage element '(drawer))))
|
||||
(let ((drawer (org-element-lineage element 'drawer)))
|
||||
(and drawer
|
||||
(org-string-equal-ignore-case
|
||||
log (org-element-property :drawer-name drawer))))))
|
||||
|
|
|
@ -388,7 +388,7 @@ same as `S-TAB') also when called without prefix argument."
|
|||
((org-fold-hide-drawer-toggle nil t element))
|
||||
;; Table: enter it or move to the next field.
|
||||
((and (org-match-line "[ \t]*[|+]")
|
||||
(org-element-lineage element '(table) t))
|
||||
(org-element-lineage element 'table t))
|
||||
(if (and (org-element-type-p element 'table)
|
||||
(eq 'table.el (org-element-property :type element)))
|
||||
(message (substitute-command-keys "\\<org-mode-map>\
|
||||
|
|
|
@ -1043,8 +1043,9 @@ When DATUM is `plain-text', all the properties are removed."
|
|||
DATUM is an object or element.
|
||||
|
||||
Return ancestors from the closest to the farthest. When optional
|
||||
argument TYPES is a list of symbols, return the first element or
|
||||
object in the lineage whose type belongs to that list instead.
|
||||
argument TYPES is a symbol or a list of symbols, return the first
|
||||
element or object in the lineage whose type equals or belongs to that
|
||||
list instead.
|
||||
|
||||
When optional argument WITH-SELF is non-nil, lineage includes
|
||||
DATUM itself as the first element, and TYPES, if provided, also
|
||||
|
@ -1054,6 +1055,7 @@ When DATUM is obtained through `org-element-context' or
|
|||
`org-element-at-point', and org-element-cache is disabled, only
|
||||
ancestors from its section can be found. There is no such limitation
|
||||
when DATUM belongs to a full parse tree."
|
||||
(when (and types (not (listp types))) (setq types (list types)))
|
||||
(let ((up (if with-self datum (org-element-parent datum)))
|
||||
ancestors)
|
||||
(while (and up (not (org-element-type-p up types)))
|
||||
|
|
|
@ -224,7 +224,7 @@ defined locally.
|
|||
The return value is nil if not at a footnote definition, and
|
||||
a list with label, start, end and definition of the footnote
|
||||
otherwise."
|
||||
(pcase (org-element-lineage (org-element-at-point) '(footnote-definition) t)
|
||||
(pcase (org-element-lineage (org-element-at-point) 'footnote-definition t)
|
||||
(`nil nil)
|
||||
(definition
|
||||
(let* ((label (org-element-property :label definition))
|
||||
|
@ -376,7 +376,7 @@ References are sorted according to a deep-reading order."
|
|||
(and (eq (org-element-property :type object) 'inline)
|
||||
(- (org-element-property :contents-end object)
|
||||
(org-element-property :contents-begin object)))))
|
||||
(let ((d (org-element-lineage object '(footnote-definition))))
|
||||
(let ((d (org-element-lineage object 'footnote-definition)))
|
||||
(push (list label (copy-marker begin) (not d) size)
|
||||
references)
|
||||
(when d
|
||||
|
|
|
@ -600,7 +600,7 @@ Use :header-args: instead"
|
|||
(org-element-map ast 'drawer
|
||||
(lambda (d)
|
||||
(when (equal (org-element-property :drawer-name d) "PROPERTIES")
|
||||
(let ((headline? (org-element-lineage d '(headline)))
|
||||
(let ((headline? (org-element-lineage d 'headline))
|
||||
(before
|
||||
(mapcar #'org-element-type
|
||||
(assq d (reverse (org-element-contents
|
||||
|
@ -635,7 +635,7 @@ Use :header-args: instead"
|
|||
(and (not (file-remote-p file))
|
||||
(not (file-exists-p file))
|
||||
(list (org-element-property :begin l)
|
||||
(format (if (org-element-lineage l '(link))
|
||||
(format (if (org-element-lineage l 'link)
|
||||
"Link to non-existent image file %S \
|
||||
in description"
|
||||
"Link to non-existent local file %S")
|
||||
|
|
|
@ -2382,7 +2382,7 @@ is an integer, 0 means `-', 1 means `+' etc. If WHICH is
|
|||
;; Check we're really on a line with a bullet.
|
||||
(when (org-element-type-p e '(item plain-list))
|
||||
;; Look for ATTR_ORG attribute in the current plain list.
|
||||
(let ((plain-list (org-element-lineage e '(plain-list) t)))
|
||||
(let ((plain-list (org-element-lineage e 'plain-list t)))
|
||||
(org-with-point-at (org-element-property :post-affiliated plain-list)
|
||||
(let ((case-fold-search t)
|
||||
(regexp "^[ \t]*#\\+attr_org:.* :radio \\(\\S-+\\)")
|
||||
|
@ -2606,7 +2606,7 @@ With optional prefix argument ALL, do this for the whole buffer."
|
|||
;; Skip whole list since we have its
|
||||
;; structure anyway.
|
||||
(while (setq element (org-element-lineage
|
||||
element '(plain-list)))
|
||||
element 'plain-list))
|
||||
(goto-char
|
||||
(min (org-element-property :end element)
|
||||
end))))))
|
||||
|
@ -3219,7 +3219,7 @@ With a prefix argument ARG, change the region in a single item."
|
|||
:end
|
||||
(org-element-lineage
|
||||
(org-element-at-point (1- end))
|
||||
'(plain-list) t)))
|
||||
'plain-list t)))
|
||||
;; Insert footnote definitions after the list.
|
||||
(unless (bolp) (beginning-of-line 2))
|
||||
;; At (point-max).
|
||||
|
|
|
@ -1088,7 +1088,7 @@ A coderef format regexp can only match at the end of a line."
|
|||
;; If footnote reference belongs to a table, make sure to
|
||||
;; remove any newline characters in order to preserve
|
||||
;; table's structure.
|
||||
(when (org-element-lineage definition '(table-cell))
|
||||
(when (org-element-lineage definition 'table-cell)
|
||||
(while (search-forward "\n" nil t) (replace-match " ")))))
|
||||
contents
|
||||
'remote))
|
||||
|
@ -1154,7 +1154,7 @@ Throw an error when not at such a table."
|
|||
;; If within a table a newline would disrupt the structure,
|
||||
;; so remove newlines.
|
||||
(goto-char (point-min))
|
||||
(when (org-element-lineage context '(table-cell))
|
||||
(when (org-element-lineage context 'table-cell)
|
||||
(while (search-forward "\n" nil t) (replace-match " "))))
|
||||
contents))
|
||||
t))
|
||||
|
|
|
@ -761,7 +761,7 @@ Field is restored even in case of abnormal exit."
|
|||
If TABLE-TYPE is non-nil, also check for table.el-type tables."
|
||||
(and (org-match-line (if table-type "[ \t]*[|+]" "[ \t]*|"))
|
||||
(or (not (derived-mode-p 'org-mode))
|
||||
(let ((e (org-element-lineage (org-element-at-point) '(table) t)))
|
||||
(let ((e (org-element-lineage (org-element-at-point) 'table t)))
|
||||
(and e (or table-type
|
||||
(eq 'org (org-element-property :type e))))))))
|
||||
|
||||
|
@ -4259,7 +4259,7 @@ beginning and end position of the current table."
|
|||
"Apply function F to the start of all tables in the buffer."
|
||||
(org-with-point-at 1
|
||||
(while (re-search-forward org-table-line-regexp nil t)
|
||||
(let ((table (org-element-lineage (org-element-at-point) '(table) t)))
|
||||
(let ((table (org-element-lineage (org-element-at-point) 'table t)))
|
||||
(when table
|
||||
(unless quietly
|
||||
(message "Mapping tables: %d%%"
|
||||
|
|
18
lisp/org.el
18
lisp/org.el
|
@ -7274,7 +7274,7 @@ Use the command `\\[widen]' to see the whole buffer again."
|
|||
(if (org-element--cache-active-p)
|
||||
(let* ((heading (org-element-lineage
|
||||
(or element (org-element-at-point))
|
||||
'(headline) t))
|
||||
'headline t))
|
||||
(end (org-element-property :end heading)))
|
||||
(if (and heading end)
|
||||
(narrow-to-region (org-element-property :begin heading)
|
||||
|
@ -16472,7 +16472,7 @@ buffer boundaries with possible narrowing."
|
|||
(while (re-search-forward file-types-re end t)
|
||||
(let* ((link (org-element-lineage
|
||||
(save-match-data (org-element-context))
|
||||
'(link) t))
|
||||
'link t))
|
||||
(linktype (org-element-property :type link))
|
||||
(inner-start (match-beginning 1))
|
||||
(path
|
||||
|
@ -16566,7 +16566,7 @@ buffer boundaries with possible narrowing."
|
|||
((eq org-image-actual-width t) nil)
|
||||
((listp org-image-actual-width)
|
||||
(let* ((case-fold-search t)
|
||||
(par (org-element-lineage link '(paragraph)))
|
||||
(par (org-element-lineage link 'paragraph))
|
||||
(attr-re "^[ \t]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)")
|
||||
(par-end (org-element-property :post-affiliated par))
|
||||
;; Try to find an attribute providing a :width.
|
||||
|
@ -17982,7 +17982,7 @@ object (e.g., within a comment). In these case, you need to use
|
|||
(when string (save-excursion (insert (org-trim string))))))
|
||||
;; In a list, make sure indenting keeps trailing text within.
|
||||
((and (not (eolp))
|
||||
(org-element-lineage context '(item)))
|
||||
(org-element-lineage context 'item))
|
||||
(let ((trailing-data
|
||||
(delete-and-extract-region (point) (line-end-position))))
|
||||
(org--newline indent arg interactive)
|
||||
|
@ -20330,7 +20330,7 @@ depending on context."
|
|||
(interactive)
|
||||
(let* ((element (org-element-at-point))
|
||||
(contents-begin (org-element-property :contents-begin element))
|
||||
(table (org-element-lineage element '(table) t)))
|
||||
(table (org-element-lineage element 'table t)))
|
||||
(if (and table
|
||||
(> (point) contents-begin)
|
||||
(<= (point) (org-element-property :contents-end table)))
|
||||
|
@ -20355,7 +20355,7 @@ depending on context."
|
|||
(call-interactively #'forward-sentence))
|
||||
(let* ((element (org-element-at-point))
|
||||
(contents-end (org-element-property :contents-end element))
|
||||
(table (org-element-lineage element '(table) t)))
|
||||
(table (org-element-lineage element 'table t)))
|
||||
(if (and table
|
||||
(>= (point) (org-element-property :contents-begin table))
|
||||
(< (point) contents-end))
|
||||
|
@ -20569,7 +20569,7 @@ instead of back to heading."
|
|||
Respect narrowing."
|
||||
(let ((cached (org-element-at-point nil 'cached)))
|
||||
(if cached
|
||||
(let ((cached-headline (org-element-lineage cached '(headline) t)))
|
||||
(let ((cached-headline (org-element-lineage cached 'headline t)))
|
||||
(or (not cached-headline)
|
||||
(< (org-element-property :begin cached-headline) (point-min))))
|
||||
(org-with-limited-levels
|
||||
|
@ -20692,7 +20692,7 @@ make a significant difference in outlines with very many siblings."
|
|||
(org-element-at-point nil t))))
|
||||
(if element
|
||||
(let* ((current-heading (org-element-lineage element '(headline inlinetask) 'with-self))
|
||||
(parent (org-element-lineage current-heading '(headline))))
|
||||
(parent (org-element-lineage current-heading 'headline)))
|
||||
(if (and parent
|
||||
(<= (point-min) (org-element-property :begin parent)))
|
||||
(progn
|
||||
|
@ -21092,7 +21092,7 @@ Function may return a real element, or a pseudo-element with type
|
|||
(list begin end (org-element-parent e))))
|
||||
;; Find the full plain list containing point, the check it
|
||||
;; contains exactly one line per item.
|
||||
((let ((l (org-element-lineage e '(plain-list) t)))
|
||||
((let ((l (org-element-lineage e 'plain-list t)))
|
||||
(while (org-element-type-p
|
||||
(org-element-parent l)
|
||||
'(item plain-list))
|
||||
|
|
|
@ -581,7 +581,7 @@ INFO is a plist used as a communication channel."
|
|||
;; No inlinetask: Remove global margin from text width.
|
||||
(- (plist-get info :ascii-text-width)
|
||||
(plist-get info :ascii-global-margin)
|
||||
(let ((parent (org-export-get-parent-headline element)))
|
||||
(let ((parent (org-element-lineage element 'headline)))
|
||||
;; Inner margin doesn't apply to text before first
|
||||
;; headline.
|
||||
(if (not parent) 0
|
||||
|
@ -1419,7 +1419,7 @@ of the parameters."
|
|||
(make-string width (if utf8p ?━ ?_)))
|
||||
;; Flush the inlinetask to the right.
|
||||
(- (plist-get info :ascii-text-width) (plist-get info :ascii-global-margin)
|
||||
(if (not (org-export-get-parent-headline inlinetask)) 0
|
||||
(if (not (org-element-lineage inlinetask 'headline)) 0
|
||||
(plist-get info :ascii-inner-margin))
|
||||
(org-ascii--current-text-width inlinetask info)))))
|
||||
|
||||
|
@ -1760,7 +1760,7 @@ contextual information."
|
|||
(let ((links
|
||||
(and (plist-get info :ascii-links-to-notes)
|
||||
;; Take care of links in first section of the document.
|
||||
(not (org-element-lineage section '(headline)))
|
||||
(not (org-element-lineage section 'headline))
|
||||
(org-ascii--describe-links
|
||||
(org-ascii--unique-links section info)
|
||||
(org-ascii--current-text-width section info)
|
||||
|
@ -1769,7 +1769,7 @@ contextual information."
|
|||
(if (not (org-string-nw-p links)) contents
|
||||
(concat (org-element-normalize-string contents) "\n\n" links))
|
||||
;; Do not apply inner margin if parent headline is low level.
|
||||
(let ((headline (org-export-get-parent-headline section)))
|
||||
(let ((headline (org-element-lineage section 'headline)))
|
||||
(if (or (not headline) (org-export-low-level-p headline info)) 0
|
||||
(plist-get info :ascii-inner-margin))))))
|
||||
|
||||
|
|
|
@ -517,7 +517,7 @@ used as a communication channel."
|
|||
;; when there is no previous headline or the previous
|
||||
;; headline do not have a BEAMER_column property.
|
||||
(parent-env (org-element-property
|
||||
:BEAMER_ENV (org-export-get-parent-headline headline)))
|
||||
:BEAMER_ENV (org-element-lineage headline 'headline)))
|
||||
(start-columns-p
|
||||
(or (equal environment "columns")
|
||||
(and column-width
|
||||
|
|
|
@ -3554,7 +3554,7 @@ holding contextual information."
|
|||
"Transcode a SECTION element from Org to HTML.
|
||||
CONTENTS holds the contents of the section. INFO is a plist
|
||||
holding contextual information."
|
||||
(let ((parent (org-export-get-parent-headline section)))
|
||||
(let ((parent (org-element-lineage section 'headline)))
|
||||
;; Before first headline: no container, just return CONTENTS.
|
||||
(if (not parent) contents
|
||||
;; Get div's class and id references.
|
||||
|
@ -3692,7 +3692,7 @@ contextual information."
|
|||
CONTENTS is nil. INFO is a plist used as a communication
|
||||
channel."
|
||||
(let* ((table-row (org-element-parent table-cell))
|
||||
(table (org-export-get-parent-table table-cell))
|
||||
(table (org-element-lineage table-cell 'table))
|
||||
(cell-attrs
|
||||
(if (not (plist-get info :html-table-align-individual-fields)) ""
|
||||
(format (if (and (boundp 'org-html-format-table-no-css)
|
||||
|
@ -3756,7 +3756,7 @@ communication channel."
|
|||
((not (= 1 group)) '("<tbody>" . "\n</tbody>"))
|
||||
;; Row is from first group. Table has >=1 groups.
|
||||
((org-export-table-has-header-p
|
||||
(org-export-get-parent-table table-row) info)
|
||||
(org-element-lineage table-row 'table) info)
|
||||
'("<thead>" . "\n</thead>"))
|
||||
;; Row is from first and only group.
|
||||
(t '("<tbody>" . "\n</tbody>")))))
|
||||
|
|
|
@ -2596,7 +2596,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
|||
(cond
|
||||
((string-match-p "\\<headlines\\>" value)
|
||||
(let* ((localp (string-match-p "\\<local\\>" value))
|
||||
(parent (org-element-lineage keyword '(headline)))
|
||||
(parent (org-element-lineage keyword 'headline))
|
||||
(level (if (not (and localp parent)) 0
|
||||
(org-export-get-relative-level parent info)))
|
||||
(depth
|
||||
|
@ -3983,7 +3983,7 @@ This function assumes TABLE has `org' as its `:type' property and
|
|||
CONTENTS is the cell contents. INFO is a plist used as
|
||||
a communication channel."
|
||||
(let ((type (org-export-read-attribute
|
||||
:attr_latex (org-export-get-parent-table table-cell) :mode))
|
||||
:attr_latex (org-element-lineage table-cell 'table) :mode))
|
||||
(scientific-format (plist-get info :latex-table-scientific-notation)))
|
||||
(concat
|
||||
(if (and contents
|
||||
|
@ -4033,7 +4033,7 @@ a communication channel."
|
|||
;; Special case for long tables. Define header and footers.
|
||||
((and longtablep (org-export-table-row-ends-header-p table-row info))
|
||||
(let ((columns (cdr (org-export-table-dimensions
|
||||
(org-export-get-parent-table table-row) info))))
|
||||
(org-element-lineage table-row 'table) info))))
|
||||
(format "%s
|
||||
\\endfirsthead
|
||||
\\multicolumn{%d}{l}{%s} \\\\[0pt]
|
||||
|
|
|
@ -1797,8 +1797,8 @@ holding contextual information."
|
|||
;; If top-level list, re-start numbering. Otherwise,
|
||||
;; continue numbering.
|
||||
(format "text:continue-numbering=\"%s\""
|
||||
(let* ((parent (org-export-get-parent-headline
|
||||
headline)))
|
||||
(let* ((parent (org-element-lineage
|
||||
headline 'headline)))
|
||||
(if (and parent
|
||||
(org-export-low-level-p parent info))
|
||||
"true" "false")))))
|
||||
|
@ -3231,7 +3231,8 @@ contextual information."
|
|||
;;;; Table Cell
|
||||
|
||||
(defun org-odt-table-style-spec (element info)
|
||||
(let* ((table (org-export-get-parent-table element))
|
||||
"Get table style from `:odt-table-styles' INFO property."
|
||||
(let* ((table (org-element-lineage element 'table))
|
||||
(table-attributes (org-export-read-attribute :attr_odt table))
|
||||
(table-style (plist-get table-attributes :style)))
|
||||
(assoc table-style (plist-get info :odt-table-styles))))
|
||||
|
@ -3256,7 +3257,7 @@ styles congruent with the ODF-1.2 specification."
|
|||
(r (car table-cell-address)) (c (cdr table-cell-address))
|
||||
(style-spec (org-odt-table-style-spec table-cell info))
|
||||
(table-dimensions (org-export-table-dimensions
|
||||
(org-export-get-parent-table table-cell)
|
||||
(org-element-lineage table-cell 'table)
|
||||
info)))
|
||||
(when style-spec
|
||||
;; LibreOffice - particularly the Writer - honors neither table
|
||||
|
@ -3314,9 +3315,9 @@ channel."
|
|||
(cond
|
||||
((and (= 1 (org-export-table-row-group table-row info))
|
||||
(org-export-table-has-header-p
|
||||
(org-export-get-parent-table table-row) info))
|
||||
(org-element-lineage table-row 'table) info))
|
||||
"OrgTableHeading")
|
||||
((let* ((table (org-export-get-parent-table table-cell))
|
||||
((let* ((table (org-element-lineage table-cell 'table))
|
||||
(table-attrs (org-export-read-attribute :attr_odt table))
|
||||
(table-header-columns
|
||||
(let ((cols (plist-get table-attrs :header-columns)))
|
||||
|
@ -3374,7 +3375,7 @@ communication channel."
|
|||
(let* ((rowgroup-tags
|
||||
(if (and (= 1 (org-export-table-row-group table-row info))
|
||||
(org-export-table-has-header-p
|
||||
(org-export-get-parent-table table-row) info))
|
||||
(org-element-lineage table-row 'table) info))
|
||||
;; If the row belongs to the first rowgroup and the
|
||||
;; table has more than one row groups, then this row
|
||||
;; belongs to the header row group.
|
||||
|
|
|
@ -226,7 +226,7 @@ a communication channel."
|
|||
;; them are included in the result.
|
||||
(let ((footnotes
|
||||
(org-element-map
|
||||
(list (org-export-get-parent-headline section) section)
|
||||
(list (org-element-lineage section 'headline) section)
|
||||
'footnote-reference
|
||||
(lambda (fn)
|
||||
(and (eq (org-element-property :type fn) 'standard)
|
||||
|
|
|
@ -1042,7 +1042,7 @@ its CDR is a string."
|
|||
(org-element-map (plist-get info :parse-tree) 'keyword
|
||||
(lambda (k)
|
||||
(when (equal (org-element-property :key k) "INDEX")
|
||||
(let ((parent (org-export-get-parent-headline k)))
|
||||
(let ((parent (org-element-lineage k 'headline)))
|
||||
(list (org-element-property :value k)
|
||||
file
|
||||
(cond
|
||||
|
|
|
@ -557,7 +557,7 @@ node or anchor name is unique."
|
|||
;; Consequently, we ensure that every parent headline gets
|
||||
;; its node beforehand. As a recursive operation, this
|
||||
;; achieves the desired effect.
|
||||
(let ((parent (org-element-lineage datum '(headline))))
|
||||
(let ((parent (org-element-lineage datum 'headline)))
|
||||
(when (and parent (not (assq parent cache)))
|
||||
(org-texinfo--get-node parent info)
|
||||
(setq cache (plist-get info :texinfo-node-cache))))
|
||||
|
@ -1352,7 +1352,7 @@ INFO is a plist holding contextual information. See
|
|||
(org-element-type-p
|
||||
(org-element-parent destination)
|
||||
'headline))))
|
||||
(let ((headline (org-element-lineage destination '(headline) t)))
|
||||
(let ((headline (org-element-lineage destination 'headline t)))
|
||||
(org-texinfo--@ref headline desc info)))
|
||||
(_ (org-texinfo--@ref destination desc info)))))
|
||||
((string= type "mailto")
|
||||
|
@ -1651,7 +1651,7 @@ contextual information."
|
|||
"Transcode a SECTION element from Org to Texinfo.
|
||||
CONTENTS holds the contents of the section. INFO is a plist
|
||||
holding contextual information."
|
||||
(let ((parent (org-export-get-parent-headline section)))
|
||||
(let ((parent (org-element-lineage section 'headline)))
|
||||
(when parent ;first section is handled in `org-texinfo-template'
|
||||
(org-trim
|
||||
(concat contents
|
||||
|
@ -1808,7 +1808,7 @@ a communication channel."
|
|||
(let ((rowgroup-tag
|
||||
(if (and (= 1 (org-export-table-row-group table-row info))
|
||||
(org-export-table-has-header-p
|
||||
(org-export-get-parent-table table-row) info))
|
||||
(org-element-lineage table-row 'table) info))
|
||||
"@headitem "
|
||||
"@item ")))
|
||||
(concat rowgroup-tag contents "\n"))))
|
||||
|
|
18
lisp/ox.el
18
lisp/ox.el
|
@ -1843,7 +1843,7 @@ not exported."
|
|||
(table (not (plist-get options :with-tables)))
|
||||
(table-cell
|
||||
(and (org-export-table-has-special-column-p
|
||||
(org-export-get-parent-table datum))
|
||||
(org-element-lineage datum 'table))
|
||||
(org-export-first-sibling-p datum options)))
|
||||
(table-row (org-export-table-row-is-special-p datum options))
|
||||
(timestamp
|
||||
|
@ -2966,7 +2966,7 @@ containing their first reference."
|
|||
d))
|
||||
definitions)))
|
||||
(org-element-adopt
|
||||
(org-element-lineage reference '(section))
|
||||
(org-element-lineage reference 'section)
|
||||
definition)
|
||||
;; Also insert definitions for nested
|
||||
;; references, if any.
|
||||
|
@ -4256,7 +4256,7 @@ inherited from a parent headline.
|
|||
|
||||
Return value is a string or nil."
|
||||
(let ((headline (if (org-element-type-p datum 'headline) datum
|
||||
(org-export-get-parent-headline datum))))
|
||||
(org-element-lineage datum 'headline))))
|
||||
(if (not inherited) (org-element-property property datum)
|
||||
(org-element-property-inherited property headline 'with-self nil nil t))))
|
||||
|
||||
|
@ -5359,7 +5359,7 @@ row (resp. last row) of the table, ignoring table rules, if any.
|
|||
|
||||
Returned borders ignore special rows."
|
||||
(let* ((row (org-element-parent table-cell))
|
||||
(table (org-export-get-parent-table table-cell))
|
||||
(table (org-element-lineage table-cell 'table))
|
||||
borders)
|
||||
;; Top/above border? TABLE-CELL has a border above when a rule
|
||||
;; used to demarcate row groups can be found above. Hence,
|
||||
|
@ -5476,7 +5476,7 @@ INFO is a plist used as a communication channel."
|
|||
INFO is a plist used as a communication channel. Always return
|
||||
nil for special rows and rows separators."
|
||||
(and (org-export-table-has-header-p
|
||||
(org-export-get-parent-table table-row) info)
|
||||
(org-element-lineage table-row 'table) info)
|
||||
(eql (org-export-table-row-group table-row info) 1)))
|
||||
|
||||
(defun org-export-table-row-starts-header-p (table-row info)
|
||||
|
@ -5506,7 +5506,7 @@ for special rows and separators."
|
|||
;; First time a row is queried, populate cache with all the
|
||||
;; rows from the table.
|
||||
(let ((number -1))
|
||||
(org-element-map (org-export-get-parent-table table-row) 'table-row
|
||||
(org-element-map (org-element-lineage table-row 'table) 'table-row
|
||||
(lambda (row)
|
||||
(when (eq (org-element-property :type row) 'standard)
|
||||
(puthash row (cl-incf number) cache)))
|
||||
|
@ -5613,7 +5613,7 @@ Return a list of all exportable headlines as parsed elements.
|
|||
Footnote sections are ignored."
|
||||
(let* ((scope (cond ((not scope) (plist-get info :parse-tree))
|
||||
((org-element-type-p scope 'headline) scope)
|
||||
((org-export-get-parent-headline scope))
|
||||
((org-element-lineage scope 'headline))
|
||||
(t (plist-get info :parse-tree))))
|
||||
(limit (plist-get info :headline-levels))
|
||||
(n (if (not (wholenump n)) limit
|
||||
|
@ -6039,12 +6039,12 @@ Return the new string."
|
|||
(defun org-export-get-parent-headline (blob)
|
||||
"Return BLOB parent headline or nil.
|
||||
BLOB is the element or object being considered."
|
||||
(org-element-lineage blob '(headline)))
|
||||
(org-element-lineage blob 'headline))
|
||||
|
||||
(defun org-export-get-parent-table (object)
|
||||
"Return OBJECT parent table or nil.
|
||||
OBJECT is either a `table-cell' or `table-element' type object."
|
||||
(org-element-lineage object '(table)))
|
||||
(org-element-lineage object 'table))
|
||||
|
||||
(defun org-export-get-previous-element (blob info &optional n)
|
||||
"Return previous element or object.
|
||||
|
|
|
@ -3971,7 +3971,7 @@ Text
|
|||
(org-test-with-temp-text
|
||||
"* H1\n** H2\n#+BEGIN_CENTER\n*bold<point>*\n#+END_CENTER"
|
||||
(org-element-type
|
||||
(org-element-lineage (org-element-context) '(center-block))))))
|
||||
(org-element-lineage (org-element-context) 'center-block)))))
|
||||
(should-not
|
||||
(org-test-with-temp-text
|
||||
"* H1\n** H2\n#+BEGIN_CENTER\n*bold<point>*\n#+END_CENTER"
|
||||
|
|
|
@ -2362,7 +2362,7 @@ Para2"
|
|||
:transcoders
|
||||
`(,(cons 'footnote-reference
|
||||
(lambda (f _c i)
|
||||
(when (org-element-lineage f '(drawer))
|
||||
(when (org-element-lineage f 'drawer)
|
||||
(push (org-export-footnote-first-reference-p f i nil)
|
||||
result))
|
||||
""))
|
||||
|
@ -2383,7 +2383,7 @@ Para2"
|
|||
:transcoders
|
||||
`(,(cons 'footnote-reference
|
||||
(lambda (f _c i)
|
||||
(when (org-element-lineage f '(drawer))
|
||||
(when (org-element-lineage f 'drawer)
|
||||
(push (org-export-footnote-first-reference-p f i nil t)
|
||||
result))
|
||||
""))
|
||||
|
|
Loading…
Reference in New Issue