org-element: New syntax for export snippets
* contrib/lisp/org-element.el (org-element-export-snippet-parser, org-element-export-snippet-interpreter, org-element-export-snippet-successor): Use "@@backend:contents@@" syntax.
This commit is contained in:
parent
89bb446a0b
commit
2e38ed36cb
|
@ -1899,17 +1899,12 @@ keywords.
|
||||||
|
|
||||||
Assume point is at the beginning of the snippet."
|
Assume point is at the beginning of the snippet."
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(looking-at "<\\([-A-Za-z0-9]+\\)@")
|
(re-search-forward "@@\\([-A-Za-z0-9]+\\):" nil t)
|
||||||
(let* ((begin (point))
|
(let* ((begin (match-beginning 0))
|
||||||
(back-end (org-match-string-no-properties 1))
|
(back-end (org-match-string-no-properties 1))
|
||||||
(inner-begin (match-end 0))
|
(value (buffer-substring-no-properties
|
||||||
(inner-end
|
(point)
|
||||||
(let ((count 1))
|
(progn (re-search-forward "@@" nil t) (match-beginning 0))))
|
||||||
(goto-char inner-begin)
|
|
||||||
(while (and (> count 0) (re-search-forward "[<>]" nil t))
|
|
||||||
(if (equal (match-string 0) "<") (incf count) (decf count)))
|
|
||||||
(1- (point))))
|
|
||||||
(value (buffer-substring-no-properties inner-begin inner-end))
|
|
||||||
(post-blank (skip-chars-forward " \t"))
|
(post-blank (skip-chars-forward " \t"))
|
||||||
(end (point)))
|
(end (point)))
|
||||||
`(export-snippet
|
`(export-snippet
|
||||||
|
@ -1922,7 +1917,7 @@ Assume point is at the beginning of the snippet."
|
||||||
(defun org-element-export-snippet-interpreter (export-snippet contents)
|
(defun org-element-export-snippet-interpreter (export-snippet contents)
|
||||||
"Interpret EXPORT-SNIPPET object as Org syntax.
|
"Interpret EXPORT-SNIPPET object as Org syntax.
|
||||||
CONTENTS is nil."
|
CONTENTS is nil."
|
||||||
(format "<%s@%s>"
|
(format "@@%s:%s@@"
|
||||||
(org-element-property :back-end export-snippet)
|
(org-element-property :back-end export-snippet)
|
||||||
(org-element-property :value export-snippet)))
|
(org-element-property :value export-snippet)))
|
||||||
|
|
||||||
|
@ -1931,18 +1926,14 @@ CONTENTS is nil."
|
||||||
|
|
||||||
LIMIT bounds the search.
|
LIMIT bounds the search.
|
||||||
|
|
||||||
Return value is a cons cell whose CAR is `export-snippet' CDR is
|
Return value is a cons cell whose CAR is `export-snippet' and CDR
|
||||||
its beginning position."
|
its beginning position."
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(catch 'exit
|
(let (beg)
|
||||||
(while (re-search-forward "<[-A-Za-z0-9]+@" limit t)
|
(when (and (re-search-forward "@@[-A-Za-z0-9]+:" limit t)
|
||||||
(save-excursion
|
(setq beg (match-beginning 0))
|
||||||
(let ((beg (match-beginning 0))
|
(re-search-forward "@@" limit t))
|
||||||
(count 1))
|
(cons 'export-snippet beg)))))
|
||||||
(while (re-search-forward "[<>]" limit t)
|
|
||||||
(if (equal (match-string 0) "<") (incf count) (decf count))
|
|
||||||
(when (zerop count)
|
|
||||||
(throw 'exit (cons 'export-snippet beg))))))))))
|
|
||||||
|
|
||||||
|
|
||||||
;;;; Footnote Reference
|
;;;; Footnote Reference
|
||||||
|
|
Loading…
Reference in New Issue