summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2009-11-08 11:24:01 +0100
committerCarsten Dominik <carsten.dominik@gmail.com>2009-11-08 11:24:01 +0100
commit2ab5c21f61ceff894c54cc06a3a5fa19c9ba9d05 (patch)
tree17ce2b83c8f693a7b4a694550e9ad28aa481bf6b
parent471c244866909daca8cccfb5415c92ba53d859c0 (diff)
downloadorg-mode-2ab5c21f61ceff894c54cc06a3a5fa19c9ba9d05.tar.gz
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.
-rwxr-xr-xlisp/ChangeLog11
-rw-r--r--lisp/org-docbook.el6
-rw-r--r--lisp/org-html.el15
-rw-r--r--lisp/org-latex.el2
4 files changed, 27 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 1590b60..192f42b 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -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
diff --git a/lisp/org-docbook.el b/lisp/org-docbook.el
index e369622..cad476f 100644
--- a/lisp/org-docbook.el
+++ b/lisp/org-docbook.el
@@ -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\"/>"
diff --git a/lisp/org-html.el b/lisp/org-html.el
index 25f53d7..42bfedf 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -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;"
diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index fa340a4..19e42c7 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -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