wordprss的单引号变为双引号的解决方法

wordpress里面,常常把单引号变为双引号,简直是自做聪明,非常让人讨厌。

粘贴代码的时候,printf("123"), 就自动变为printf(“123”), 读者根本无法粘贴拷贝了。

后来,我找到了Code Markup插件和iG:Syntax Hiliter 插件,可以解决引号混乱的问题。

经过试用,我比较看好iG:Syntax Hiliter,不仅解决了引号问题,还能借用geshi.php 自动对多种语言的关键词进行加亮显示,在http://www.18ie.com/ 上进行了安装和测试,觉得是个好插件。

但插件终究是要耗费CPU时间的,我想找到一个不用插件的终极解决方法:

找到wordpress\wp-includes\functions-formatting.php 中的 wptexturize() 函数,

把以下代码注释掉:

//$curl = preg_replace("/'s/", '’s', $curl);
   //$curl = preg_replace("/'(\d\d(?:’|')?s)/", "’$1", $curl);
   //$curl = preg_replace('/(\s|\A|")\'/', '$1‘', $curl);
   //$curl = preg_replace('/(\d+)"/', '$1″', $curl);
   //$curl = preg_replace("/(\d+)'/", '$1′', $curl);
   //$curl = preg_replace("/(\S)'([^'\s])/", "$1’$2", $curl);
   //$curl = preg_replace('/(\s|\A)"(?!\s)/', '$1“$2', $curl);
   //$curl = preg_replace('/"(\s|\S|\Z)/', '”$1', $curl);
   //$curl = preg_replace("/'([\s.]|\Z)/", '’$1', $curl);
   //$curl = preg_replace("/ \(tm\)/i", ' ™', $curl);
   //$curl = str_replace("''", '”', $curl);
   
   //$curl = preg_replace('/(\d+)x(\d+)/', "$1×$2", $curl);

 

用wordpress 写代码的时候,用 pre 这个tag,把要写的代码包起来,在style.css里面,加入:

pre {border: solid 1px #C1C0B5;
 font-size: 1.2 em;
  color: blue;
 margin: 5px;
 padding:5px;
 background: #F0F8FF}
浅蓝色的底色,蓝色的字体,效果还是不错的吧?

 

发表评论


0.018 sec