Protect target-like strings in verbatim emphasis

Martin G. Skjaeveland writes:

> Then I write
>
> some text some text ~<<some_scr_block_name>>~.
>
> because I want "<<some_scr_block_name>>" written as verbatim in my latex
> export, I get, in latex,
>
> \texttt{\textbackslash{}label\{some\_src\_block\_name\}some\_src\_block\_name}.
>
> which gives me the text
>
> \label{some_src_block_name}some_src_block_name
>
> in verbatim.
This commit is contained in:
Carsten Dominik 2009-11-08 11:24:01 +01:00
parent 471c244866
commit 2ab5c21f61
4 changed files with 27 additions and 7 deletions

View File

@ -1,3 +1,14 @@
2009-11-08 Carsten Dominik <carsten.dominik@gmail.com>
* org-latex.el (org-export-latex-preprocess): Protect targets in
verbatim emphasis.
* org-html.el (org-export-as-html): Protect targets in verbatim
emphasis.
* org-docbook.el (org-export-as-docbook): Protect targets in
verbatim emphasis.
2009-11-06 Carsten Dominik <carsten.dominik@gmail.com>
* org-clock.el (org-show-notification): Handle messages that

View File

@ -736,8 +736,12 @@ publishing directory."
;; Make targets to anchors. Note that currently FOP does not
;; seem to support <anchor> tags when generating PDF output,
;; but this can be used in DocBook --> HTML conversion.
(while (string-match "<<<?\\([^<>]*\\)>>>?\\((INVISIBLE)\\)?[ \t]*\n?" line)
(setq start 0)
(while (string-match
"<<<?\\([^<>]*\\)>>>?\\((INVISIBLE)\\)?[ \t]*\n?" line start)
(cond
((get-text-property (match-beginning 1) 'org-protected line)
(setq start (match-end 1)))
((match-end 2)
(setq line (replace-match
(format "@<anchor xml:id=\"%s\"/>"

View File

@ -972,9 +972,12 @@ lang=\"%s\" xml:lang=\"%s\">
(setq line (concat line "\\\\")))))
;; make targets to anchors
(setq start 0)
(while (string-match
"<<<?\\([^<>]*\\)>>>?\\((INVISIBLE)\\)?[ \t]*\n?" line)
"<<<?\\([^<>]*\\)>>>?\\((INVISIBLE)\\)?[ \t]*\n?" line start)
(cond
((get-text-property (match-beginning 1) 'org-protected line)
(setq start (match-end 1)))
((match-end 2)
(setq line (replace-match
(format
@ -985,16 +988,18 @@ lang=\"%s\" xml:lang=\"%s\">
((and org-export-with-toc (equal (string-to-char line) ?*))
;; FIXME: NOT DEPENDENT on TOC?????????????????????
(setq line (replace-match
(concat "@<span class=\"target\">" (match-string 1 line) "@</span> ")
; (concat "@<i>" (match-string 1 line) "@</i> ")
(concat "@<span class=\"target\">"
(match-string 1 line) "@</span> ")
;; (concat "@<i>" (match-string 1 line) "@</i> ")
t t line)))
(t
(setq line (replace-match
(concat "@<a name=\""
(org-solidify-link-text (match-string 1 line))
"\" class=\"target\">" (match-string 1 line) "@</a> ")
"\" class=\"target\">" (match-string 1 line)
"@</a> ")
t t line)))))
(setq line (org-html-handle-time-stamps line))
;; replace "&" by "&amp;", "<" and ">" by "&lt;" and "&gt;"

View File

@ -1785,7 +1785,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
(while (re-search-forward
(concat "<<<?" org-export-latex-all-targets-re
">>>?\\((INVISIBLE)\\)?") nil t)
(org-if-unprotected
(org-if-unprotected-at (+ (match-beginning 0) 2)
(replace-match
(org-export-latex-protect-string
(format "\\label{%s}%s" (save-match-data (org-solidify-link-text