簡短的回答:在功能org-export-attach-captions-and-attributes
替換字符串:約煩惱
diff -u -L /home/eab/.emacs.d/el-get/org-mode/lisp/org-exp.el -L \#\<buffer\ el-get/org-exp.el\> /home/eab/.emacs.d/el-get/org-mode/lisp/org-exp.el /tmp/buffer-content-8644Ge2
--- /home/eab/.emacs.d/el-get/org-mode/lisp/org-exp.el
+++ #<buffer el-get/org-exp.el>
@@ -1935,7 +1935,7 @@
"\\|"
"^[ \t]*\\(|[^-]\\)"
"\\|"
- "^[ \t]*\\[\\[.*\\]\\][ \t]*$"))
+ "^.*\\[\\[.*\\]\\][ \t]*$"))
cap shortn attr label end)
(while (re-search-forward re nil t)
(cond
長註釋。 讓我們看看函數的源代碼,它將#+ATTR_BACKEND
解析爲文本屬性。
(defun org-export-attach-captions-and-attributes (target-alist)
"Move #+CAPTION, #+ATTR_BACKEND, and #+LABEL text into text properties.
If the next thing following is a table, add the text properties to the first
table line. If it is a link, add it to the line containing the link."
(goto-char (point-min))
(remove-text-properties (point-min) (point-max)
'(org-caption nil org-attributes nil))
(let ((case-fold-search t)
(re (concat "^[ \t]*#\\+caption:[ \t]+\\(.*\\)"
"\\|"
"^[ \t]*#\\+attr_" (symbol-name org-export-current-backend) ":[ \t]+\\(.*\\)"
"\\|"
"^[ \t]*#\\+label:[ \t]+\\(.*\\)"
"\\|"
"^[ \t]*\\(|[^-]\\)"
"\\|"
"^[ \t]*\\[\\[.*\\]\\][ \t]*$"))
...)))
org-export-current-backend
在這種情況下HTML
。 它適用於這樣的文本
#+ATTR_HTML: target="_blank"
[[http://cnn.com][CNN]]
這樣的:
1)通過正則表達式"^[ \t]*#\\+attr_"...
2解析全線#+ATTR_HTML: target="_blank"
)的正則表達式"^[ \t]*\\[\\[.*\\]\\][ \t]*$"
3)刪除字符串解析全線[[http://cnn.com][CNN]]
#+ATTR_HTML: target="_blank"
導出爲html之前
4)設置屬性target="_blank"
行[[http://cnn.com][CNN]]
然後org模式準備HTML鏈接出口與此屬性。
如果我替換字符串"^[ \t]*\\[\\[.*\\]\\][ \t]*$"
通過"^.*\\[\\[.*\\]\\][ \t]*$"
那麼這個補丁功能,適用於
#+ATTR_HTML: target="_blank"
- [[http://cnn.com][CNN]]
了。但對於名單
- [[http://cnn.com][CNN]]
- [[http://cnn.com][CNN]]
- some text
一個問題,如果我每一個環節之前把ATTR_HTML
#+ATTR_HTML: target="_blank"
- [[http://cnn.com][CNN]]
#+ATTR_HTML: target="_blank"
- [[http://cnn.com][CNN]]
- some text
然後我得到這樣的輸出HTML
* CNN
* CNN
* some text
有一個在列表中的額外的差距。所以,我不能讓這樣的
* CNN
* CNN
* some text
只輸出
* CNN
* CNN
* some text
這個例子表明,組織模式是不是在某些情況下,靈活。我可以編寫lisp函數,它爲導出文本中的所有鏈接設置此html屬性,並將此功能添加到#+OPTIONS:
或其他內容。但是我不能以這種方式使越來越多的組織模式導出系統複雜化,因爲有一些組織模式的語法限制 - 這很簡單。
如果我有這樣的組織發佈問題,我想:可能是我需要別的化妝,除了組織模式? )