Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2021-04-09 22:33:00 +02:00
commit 0457d8d5a3
1 changed files with 33 additions and 25 deletions

View File

@ -559,6 +559,14 @@ strings (e.g., returned by `org-export-get-caption')."
(format "@float %s%s\n%s\n%s%s@end float" (format "@float %s%s\n%s\n%s%s@end float"
type (if label (concat "," label) "") value caption-str short-str))) type (if label (concat "," label) "") value caption-str short-str)))
(defun org-texinfo--sectioning-structure (info)
"Return sectioning structure used in the document.
INFO is a plist holding export options."
(let ((class (plist-get info :texinfo-class)))
(pcase (assoc class (plist-get info :texinfo-classes))
(`(,_ ,_ . ,sections) sections)
(_ (user-error "Unknown Texinfo class: %S" class)))))
;;; Template ;;; Template
(defun org-texinfo-template (contents info) (defun org-texinfo-template (contents info)
@ -858,25 +866,22 @@ holding contextual information."
(notoc? (org-export-excluded-from-toc-p headline info)) (notoc? (org-export-excluded-from-toc-p headline info))
(command (command
(and (and
(not (org-export-low-level-p headline info)) (not (org-export-low-level-p headline info))
(let ((class (plist-get info :texinfo-class))) (let ((sections (org-texinfo--sectioning-structure info)))
(pcase (assoc class (plist-get info :texinfo-classes)) (pcase (nth (1- (org-export-get-relative-level headline info))
(`(,_ ,_ . ,sections) sections)
(pcase (nth (1- (org-export-get-relative-level headline info)) (`(,numbered ,unnumbered ,unnumbered-no-toc ,appendix)
sections) (cond
(`(,numbered ,unnumbered ,unnumbered-no-toc ,appendix) ((org-not-nil
(cond (org-export-get-node-property :APPENDIX headline t))
((org-not-nil appendix)
(org-export-get-node-property :APPENDIX headline t)) (numbered? numbered)
appendix) (index unnumbered)
(numbered? numbered) (notoc? unnumbered-no-toc)
(index unnumbered) (t unnumbered)))
(notoc? unnumbered-no-toc) (`nil nil)
(t unnumbered))) (_ (user-error "Invalid Texinfo class specification: %S"
(`nil nil) (plist-get info :texinfo-class)))))))
(_ (user-error "Invalid Texinfo class specification: %S"
class))))
(_ (user-error "Unknown Texinfo class: %S" class))))))
(todo (todo
(and (plist-get info :with-todo-keywords) (and (plist-get info :with-todo-keywords)
(let ((todo (org-element-property :todo-keyword headline))) (let ((todo (org-element-property :todo-keyword headline)))
@ -1215,12 +1220,15 @@ holding contextual information."
:texinfo-entries-cache))) :texinfo-entries-cache)))
(cached-entries (gethash scope cache 'no-cache))) (cached-entries (gethash scope cache 'no-cache)))
(if (not (eq cached-entries 'no-cache)) cached-entries (if (not (eq cached-entries 'no-cache)) cached-entries
(puthash scope (let ((sections (org-texinfo--sectioning-structure info)))
(cl-remove-if (puthash scope
(lambda (h) (cl-remove-if
(org-not-nil (org-export-get-node-property :COPYING h t))) (lambda (h)
(org-export-collect-headlines info 1 scope)) (or (org-not-nil (org-export-get-node-property :COPYING h t))
cache)))) (>= (org-export-get-relative-level h info)
(length sections))))
(org-export-collect-headlines info 1 scope))
cache)))))
;;;; Node Property ;;;; Node Property