如何转义双引号? [英] How to escape double quote?

查看:77
本文介绍了如何转义双引号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在组织模式下,如果我想逐字格式化文本,即~...~,如果它在引号内:~"..."~,它没有被格式化(保持原样).

In org mode, if I want to format text a monospace verbatim, i.e. ~...~, if it is inside quotes: ~"..."~, it is not formatted (left as is).

另外,引号是保留符号吗?如果是,它们是什么意思?(它们似乎不会影响生成的 HTML/Emacs 显示).

Also, are quotes a reserved symbol, if so, what do they mean? (they don't seem to affect the generated HTML / inside Emacs display).

推荐答案

这种情况的罪魁祸首是 org-emph-re org 中的正则表达式-verbatim-re,负责确定是否要逐字设置文档中的字符序列.

The culprit in this case is the regular expression in org-emph-re org-verbatim-re, responsible for determining if a sequence of characters in the document is to be set verbatim or not.

org-verbatim-re 是在 `org.el' 中定义的变量.它的价值是"([ ('"{]|^)(([=~])([^
,"']|[^
,"'].?(?: .?){0,1}[^
,"'])3)([- .,:!?;'")}]|$)"

org-verbatim-re is a variable defined in `org.el'. Its value is "([ ('"{]|^)(([=~])([^
,"']|[^
,"'].?(?: .?){0,1}[^
,"'])3)([- .,:!?;'")}]|$)"

引号和双引号在逐字字符=~中被

quotes and double quotes are explicitly forbidden inside verbatim characters =~ by

[^ 

,"']|[^ 

,"']

我发现可以追溯到 3 年前的讨论得出的结论是你必须修改这个正则表达式并设置变量 org-emph-re/org-verbatim-re 到你的 emacs 设置中符合你的愿望的东西(也许文件局部变量也可以).您可以通过从排除字符类和外部匹配中排除双引号来进行实验,如

I found discussions dating back 3 years comming to the conclusion that you have to tinker with this regular expression and set the variable org-emph-re/org-verbatim-re to something that matches your wishes in your emacs setup (maybe a file local variable works as well). You can experiment by excluding double quotes from the excluding character classes and outside matches as in

"([ ('{]|^)(([*/_=~+])([^
,']|[^
,'].?(?: .?){0,1}[^
,'])3)([- .,:!?;')}]|$)"

"([ ('{]|^)(([*/_=~+])([^
,']|[^
,'].?(?: .?){0,1}[^
,'])3)([- .,:!?;')}]|$)"

但是看看那个正则表达式,天知道会发生什么复杂的文档——你必须尝试......

but looking at that regex, heaven knows what happens to complex documents -- you have to try...

编辑:碰巧的是,如果我将以下内容评估为区域,= 中的引号会正确导出,但没有其他内容:-),我会进一步调查何时我有更多的时间.

Edit: as it happens, if I evalute the following as region, quotes inside = are exported correctly, but nothing else is :-), I investigate further when I have more time.

(setq org-emph-re "([ ('{]|^)(([*/_=~+])([^ ,']|[^ ,'].?(?: .?){0,1}[^ ,'])3)([- .,:!?;')}]|$)")

(setq org-emph-re "([ ('{]|^)(([*/_=~+])([^ ,']|[^ ,'].?(?: .?){0,1}[^ ,'])3)([- .,:!?;')}]|$)")

编辑 2::通过直接更改 org.el 使其工作:

Edit 2:: Got it to work by changing org.el directly:

(defvar org-emphasis-regexp-components from '(" ('"{" "- .,:!?;'")}\" " ,"'" "." 1)'(" ('{" "- .,:!?;')}\" " ,'" "." 1) 并重新编译 org 然后重新启动 emacs.

Change the line following (defvar org-emphasis-regexp-components from '(" ('"{" "- .,:!?;'")}\" " ,"'" "." 1) to '(" ('{" "- .,:!?;')}\" " ,'" "." 1) and recompile org then restart emacs.

这是 8.0 版本之前的 defcustom,现在不再是了,因此您必须忍受这种手动修改.

This was a defcustom prior to the 8.0 release, it isn't anymore, so you have to live with this manual modification.

问候,汤姆

这篇关于如何转义双引号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆