0
text = child.html()
text = text.replace /(#include(\s*&lt;.*&gt;)?)/gi, '<span>$1</span>'
text = text.replace /(main\(.*\))/gi, '<span>$1</span>'
child.html text

http://jsfiddle.net/dcro/XKHC8/

这是我的问题的答案:Wrapping strings with a span我不知道如何使用咖啡脚本,而回答的人看起来不可用。

4

1 回答 1

1

来自js2coffee.org

var text;

text = text.replace(/(#include(\s*&lt;.*&gt;)?)/gi, '<span>$1</span>');

text = text.replace(/(main\(.*\))/gi, '<span>$1</span>');

child.html(text);
于 2013-08-30T17:45:43.777 回答