如何防止emacs org从导出电子邮件地址链接

时间:2013-07-09 07:42:11

标签: emacs org-mode

在emacs组织模式中:

#+BEGIN_SRC sh :eval no                                                                                                                                  
git commit --amend --author 'New Author Name <email@address.com>'                                                                                        
#+END_SRC 

将导出到:

<pre class="src src-sh">
      git commit --amend --author <span style="color: #ffff00;">"New Author Name <a href="mailto:email%40address.com">&lt;email@address.com&gt;</a>"</span>
</pre>       

电子邮件地址包含的内容,而不是预期的字面值:

<pre class="src src-sh">
      git commit --amend --author <span style="color: #ffff00;">"New Author Name &lt;email@address.com&gt;"</span>
</pre>        

是否有一些出口参数?

非常感谢你的帮助:)

1 个答案:

答案 0 :(得分:0)

我不知道任何适用的导出选项,但另一种方法是尝试filtering导出(Org 8.0.5):

(require 'ox)

(defun keith/remove-a-href (string backend info)
  "remove <a href..."
  (when (org-export-derived-backend-p backend 'html)
   (replace-regexp-in-string "<a href.*?>" "" string)))

(defun keith/remove-a-close-tag (string backend info)
  "remove </a>"
  (when (org-export-derived-backend-p backend 'html)
   (replace-regexp-in-string "</a>" "" string)))

(add-to-list 'org-export-filter-final-output-functions
             'keith/remove-a-href)
(add-to-list 'org-export-filter-final-output-functions
             'keith/remove-a-close-tag)

您的示例中org-export-html-to-html的结果,在过滤之前:

<pre class="src src-sh">
      git commit --amend --author <span style="color: #95e454;">'New Author Name &lt;<a href="mailto:email&#64;address.com">email&#64;address.com</a>&gt;'</span>
</pre>

过滤后:

<pre class="src src-sh">
      git commit --amend --author <span style="color: #95e454;">'New Author Name &lt;email&#64;address.com&gt;'</span>
</pre>