Skip navigation

Sign up | Lost password? | Help

Eexpress @ Ubuntu

Posts tagged with "vim html wiki sed"

html2wiki:让wiki使用语法高亮显示。

保留颜色语法高亮是最重要的。要不vim的html输出就没意义了。
:source $VIMRUNTIME/syntax/2html.vim
:write __xxx__.html

先建立一个html2wiki.sed
s/<a href="/[[/g
s/">http/|http/g
s/<\/a>/]]/g

s/<font \|<\/font>/@@/g
s/color="/color(/g
s/">/):/g

/<pre>\|<\/pre>/ d
/<body\|<\/body>/ d
/<html>\|<\/html>/ d
/<head>\|<\/head>/ d
/<meta/ d

s/<title>/!!/g
s/<\/title>//g

s/\/\//\/ \//g
s/<b>\|<\/b>\|<B>\|<\/B>/''/g
#&amp;&gt;&lt;&quot;
s/\t/>/g
#s/^ */>/g
s/ \{8\}/>/g

然后,这样运行
$●  sed -f html2wiki.sed fetch_web_pic.bash.html >fetch_web_pic.bash.html.wiki

得到的wiki文件,可以直接粘贴到tiddlywiki的编辑里面。如下图

December 2009
S M T W T F S
November 2009January 2010
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31