如何逃避双引号? [英] How to escape double quote?
问题描述
在组织模式中,如果我要逐字逐句格式化文字,即〜...〜
,如果它在引号内:〜 ...〜
,它没有格式化(按原样)。
另外,引用一个保留的符号,如果是,他们的意思是什么? (它们似乎不影响所产生的HTML / Emacs的显示内侧)。
在这种情况下的罪魁祸首是正规表达在 org-emph-re
org-verbatim-re
,负责确定文档中的字符序列将被逐字地设置。
org-verbatim-re是在org.el中定义的变量。
它的值是
\([('\{] \ | ^ \)\(\([=〜] \)\([^
\\\
,\'] \ | [^
\\\
,\']。?\(?:\\\
。 / em>?\)\ {0,1\} [^
\\\
,\'] \)\3\)\([ - 。 :!?;'\)} \] \ | $ \)
引号和双引号是明确的禁止逐字字符 =〜
by
[^
\\\
,\'] \ | [^
\\\
,\']
我发现3年以后的讨论得出结论,你必须修改这个正则表达式并设置变量 org-emph-re
/ org-verbatim-re
可以在您的emacs设置中符合您的意愿(也许是文件本地变量也可以),您可以通过排除不包括字符类的双引号进行实验和外面的比赛我一样n = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 〜+] \)\([^
\\\
,'] \ | [^
\\\
,']。?\\ ?:\\\
。?\)\ {0,1 \} [^
\\\
,'] \)\3\)\( [ - 。,:!?;')} \] \ | $ \)
但是看那个正则表达式天堂知道复杂的文件会发生什么 - 你必须尝试...
编辑:如果我评估以下内容作为区域, =
中的引号正确导出,但没有其他内容:-),当我有更多时间时,我会进一步调查。
(setq org-emph-re\([('{] \ | ^ \)\(\([* / _ =〜+ \\)\([^
\\\
,'] \ | [^
\\\
,']。?\(?:\\\
。?\)\ { 0,1 \} [^
\\\
,'] \)\3\)\([ - 。,! )
编辑2::通过直接更改 org.el
来实现:
更改从'(\t('\{ - \t)中的
(defvar org-emphasis-regexp-components
,!c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c >'(\t('{ - \t。,:!?;')} \\\t\r\\\
,'。1) code>并重新编译org然后重新启动emacs。
在8.0版本之前,这是一个 defcustom
不再需要这个手工修改了。
regards,
Tom
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).
Also, are quotes a reserved symbol, if so, what do they mean? (they don't seem to affect the generated HTML / inside Emacs display).
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 is a variable defined in `org.el'. Its value is "\([ ('\"{]\|^\)\(\([=~]\)\([^
\n,\"']\|[^
\n,\"'].?\(?:\n.?\)\{0,1\}[^
\n,\"']\)\3\)\([- .,:!?;'\")}\]\|$\)"
quotes and double quotes are explicitly forbidden inside verbatim characters =~
by
[^
\n,\"']\|[^
\n,\"']
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
"\([ ('{]\|^\)\(\([*/_=~+]\)\([^
\n,']\|[^
\n,'].?\(?:\n.?\)\{0,1\}[^
\n,']\)\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 "\([ ('{]\|^\)\(\([*/_=~+]\)\([^ \n,']\|[^ \n,'].?\(?:\n.?\)\{0,1\}[^ \n,']\)\3\)\([- .,:!?;')}]\|$\)")
Edit 2:: Got it to work by changing org.el
directly:
Change the line following (defvar org-emphasis-regexp-components
from '(" \t('\"{" "- \t.,:!?;'\")}\\" " \t\r\n,\"'" "." 1)
to '(" \t('{" "- \t.,:!?;')}\\" " \t\r\n,'" "." 1)
and recompile org then restart emacs.
This was a defcustom
prior to the 8.0 release, it isn't anymore, so you have to live with this manual modification.
regards, Tom
这篇关于如何逃避双引号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!