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

标签 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>        

是否有一些导出参数?

非常感谢你的帮助:)

最佳答案

我不知道有任何适用的导出选项,但另一种方法是试验 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>

关于emacs - 如何防止 emacs org 将电子邮件地址导出到链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17542686/

相关文章:

function - 带有附加参数的交互式 "r"elisp defun?

emacs - 更改组织模式开始新一天的时间

emacs - `with-temp-file' 与 `org-map-entries' 的行为

emacs - Emacs 是否有允许插入一些文本的只读或查看模式?

emacs - Spacemacs 中的组织模式 : with-eval-after-load and additional-packages

c++ - 在 emacs 中寻求自动完成功能

emacs - 在将表达式放入 lambda 之前评估表达式

emacs - elisp如何检查是否按下了Shift键

emacs - 组织模式电子表格程序化远程引用

Emacs 组织模式 : how to create literate programs with noweb syntax