ox-texinfo: Fix definitions containing Org markup
* lisp/ox-texinfo.el (org-texinfo--match-definition): Consider :tag being an anonymous node with multiple markup nodes. Convert it to plain Texinfo beforehand, so that it is available as a plain text. Add new optional argument INFO to be able to run Org AST for :tag -> Texinfo text conversion. (org-texinfo--separate-definitions): Pass INFO to `org-texinfo--match-definition'. * testing/lisp/test-ox-texinfo.el (test-ox-texinfo/definition): New test case. Reported-by: 8dcc <8dcc.git@gmail.com> Link: https://orgmode.org/list/87wmi09tdx.fsf@gmail.com
This commit is contained in:
parent
bc7033f2d1
commit
cff9c45afb
|
@ -643,7 +643,7 @@ Return new tree."
|
|||
(let ((contents (org-element-contents plain-list))
|
||||
(items nil))
|
||||
(dolist (item contents)
|
||||
(pcase-let ((`(,cmd . ,args) (org-texinfo--match-definition item)))
|
||||
(pcase-let ((`(,cmd . ,args) (org-texinfo--match-definition item info)))
|
||||
(cond
|
||||
(cmd
|
||||
(when items
|
||||
|
@ -659,16 +659,17 @@ Return new tree."
|
|||
info)
|
||||
tree)
|
||||
|
||||
(defun org-texinfo--match-definition (item)
|
||||
(defun org-texinfo--match-definition (item &optional info)
|
||||
"Return a cons-cell if ITEM specifies a Texinfo definition command.
|
||||
The car is the command and the cdr is its arguments."
|
||||
(let ((tag (car-safe (org-element-property :tag item))))
|
||||
The car is the command and the cdr is its arguments.
|
||||
INFO is the export INFO plist."
|
||||
(let ((tag (org-export-data (org-element-property :tag item) info)))
|
||||
(and tag
|
||||
(stringp tag)
|
||||
(string-match org-texinfo--definition-command-regexp tag)
|
||||
(pcase-let*
|
||||
((cmd (car (rassoc (match-string-no-properties 1 tag)
|
||||
org-texinfo--definition-command-alist)))
|
||||
org-texinfo--definition-command-alist)))
|
||||
(`(,cmd ,category)
|
||||
(and cmd (save-match-data (split-string cmd " "))))
|
||||
(args (match-string-no-properties 2 tag)))
|
||||
|
|
|
@ -443,7 +443,25 @@ body
|
|||
(and
|
||||
(re-search-forward "@defvar nil")
|
||||
(re-search-forward "Description")
|
||||
(re-search-forward "@end defvar")))))))
|
||||
(re-search-forward "@end defvar"))))))
|
||||
;; Function name containing markup
|
||||
(should
|
||||
(org-test-with-temp-text
|
||||
(string-join
|
||||
(list "- Function: ~foo_bar~ arg ::"
|
||||
" Description")
|
||||
"\n")
|
||||
(let ((export-buffer "*Test Texinfo Export*")
|
||||
(org-export-show-temporary-export-buffer nil))
|
||||
(org-export-to-buffer 'texinfo export-buffer
|
||||
nil nil nil nil nil
|
||||
#'texinfo-mode)
|
||||
(with-current-buffer export-buffer
|
||||
(goto-char (point-min))
|
||||
(and
|
||||
(re-search-forward "@defun @code{foo_bar} arg")
|
||||
(re-search-forward "Description")
|
||||
(re-search-forward "@end defun")))))))
|
||||
|
||||
|
||||
;;; Escaping
|
||||
|
|
Loading…
Reference in New Issue