mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2025-01-05 11:45:52 +00:00
Export: Protect examples from headline processing
Lines that looked like headlines in examples could still be processes as headings. This commit make sure all converted examples are protected.
This commit is contained in:
parent
e30bf26061
commit
389419334d
@ -1,5 +1,8 @@
|
||||
2009-01-06 Carsten Dominik <carsten.dominik@gmail.com>
|
||||
|
||||
* org-exp.el (org-export-format-source-code-or-example): Protect
|
||||
the converted examples.
|
||||
|
||||
* org.el (org-set-regexps-and-options): Fix the regexp
|
||||
`org-complex-heading-regexp'.
|
||||
|
||||
|
@ -1822,6 +1822,7 @@ from the buffer."
|
||||
|
||||
(defun org-export-remove-headline-metadata (opts)
|
||||
"Remove meta data from the headline, according to user options."
|
||||
(debug)
|
||||
(let ((re org-complex-heading-regexp)
|
||||
(todo (plist-get opts :todo-keywords))
|
||||
(tags (plist-get opts :tags))
|
||||
@ -1832,9 +1833,10 @@ from the buffer."
|
||||
(when (or (not todo) (not tags) (not pri))
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward re nil t)
|
||||
(setq rpl (mapconcat (lambda (i) (if (match-end i) (match-string i) ""))
|
||||
elts " "))
|
||||
(replace-match rpl t t)))))
|
||||
(org-if-unprotected
|
||||
(setq rpl (mapconcat (lambda (i) (if (match-end i) (match-string i) ""))
|
||||
elts " "))
|
||||
(replace-match rpl t t))))))
|
||||
|
||||
(defun org-export-protect-quoted-subtrees ()
|
||||
"Mark quoted subtrees with the protection property."
|
||||
@ -2273,6 +2275,7 @@ in the list) and remove property and value from the list in LISTVAR."
|
||||
|
||||
(defun org-export-replace-src-segments-and-examples (backend)
|
||||
"Replace source code segments with special code for export."
|
||||
(debug)
|
||||
(setq org-export-last-code-line-counter-value 0)
|
||||
(let ((case-fold-search t)
|
||||
lang code trans opts)
|
||||
@ -2354,20 +2357,26 @@ Numbering lines works for all three major backends (html, latex, and ascii)."
|
||||
t t rtn))))
|
||||
(setq rtn (concat "<pre class=\"example\">\n" rtn "</pre>\n")))
|
||||
(setq rtn (org-export-number-lines rtn 'html 1 1 num cont rpllbl fmt))
|
||||
(concat "\n#+BEGIN_HTML\n" rtn "\n#+END_HTML\n\n"))
|
||||
(concat "\n#+BEGIN_HTML\n" (org-add-props rtn '(org-protected t)) "\n#+END_HTML\n\n"))
|
||||
((eq backend 'latex)
|
||||
(setq rtn (org-export-number-lines rtn 'latex 0 0 num cont rpllbl fmt))
|
||||
(concat "\n#+BEGIN_LaTeX\n\\begin{verbatim}\n" rtn
|
||||
"\n\\end{verbatim}\n#+END_LaTeX\n\n"))
|
||||
(concat "\n#+BEGIN_LaTeX\n"
|
||||
(org-add-props (concat "\\begin{verbatim}\n" rtn "\n\\end{verbatim}\n")
|
||||
'(org-protected t))
|
||||
"#+END_LaTeX\n\n"))
|
||||
((eq backend 'ascii)
|
||||
;; This is not HTML or LaTeX, so just make it an example.
|
||||
(setq rtn (org-export-number-lines rtn 'ascii 0 0 num cont rpllbl fmt))
|
||||
(concat "#+BEGIN_ASCII\n"
|
||||
(mapconcat
|
||||
(lambda (l) (concat " " l))
|
||||
(org-split-string rtn "\n")
|
||||
"\n")
|
||||
"\n#+END_ASCII\n"))))))
|
||||
(org-add-props
|
||||
(concat
|
||||
(mapconcat
|
||||
(lambda (l) (concat " " l))
|
||||
(org-split-string rtn "\n")
|
||||
"\n")
|
||||
"\n")
|
||||
'(org-protected t))
|
||||
"#+END_ASCII\n"))))))
|
||||
|
||||
(defun org-export-number-lines (text backend
|
||||
&optional skip1 skip2 number cont
|
||||
|
Loading…
Reference in New Issue
Block a user