?? help_rtf2html.pl
@hexdigits = ('0','1','2','3','4','5','6','7','8', '9','a','b','c','d','e','f');sub byteToHex { local ($byte) = @_; $hexstr = ""; $hi = $byte / 16; $lo = $byte % 16; $hexstr = $hexdigits[$hi] . $hexdigits[$lo]; return $hexstr; }sub parseColorTbl { local ($colortbl) = @_; #print "color table : \n" . $colortbl . "\n\n"; @colortable = split(/;/,$colortbl); #print "found " . $#colortable . " entries\n\n"; $i = 0; while ($i <= $#colortable){ $red = $colortable[$i]; $green = $colortable[$i]; $blue = $colortable[$i]; $red =~ s/\s*\\red(\d*)\\green(\d*)\\blue(\d*)\s*/$1/g; $green =~ s/\s*\\red(\d*)\\green(\d*)\\blue(\d*)\s*/$2/g; $blue =~ s/\s*\\red(\d*)\\green(\d*)\\blue(\d*)\s*/$3/g; $colortable[$i] = "#" . &byteToHex($1) . &byteToHex($2) . &byteToHex($3); #print $i . ": " . $colortable[$i] ."\n"; $i++; } }## MAIN PROGRAM#open(RTFFILE,"wbstego.rtf"); $htmlcode = "";$rtfcode = "";while ($line=readline(*RTFFILE)) { # rm line breaks $line =~ s/[\n\r]/ /g; $rtfcode = $rtfcode . $line;}close(RTFFILE); @colortable;# parse color table$coltbl = $rtfcode;$coltbl =~ s/(.*?){\s*\\colortbl;(.*?)}(.*)/$2/g;&parseColorTbl($coltbl);# remove font table$rtfcode =~ s/{\s*\\fonttbl(\s*{\s*\\f(\d*)(.*?)}\s*)*}//g;# remove color table$rtfcode =~ s/{\s*\\colortbl;(.*?)}//g;# footnote$rtfcode =~ s/{\s*([\w\\\'\-]*)\\footnote([\w\\\'\-]*)(.*?){(.*?)([#\$\+K])}(.*?){\s(.*?)}(.*?)}/{\<a name=\"$7\" type=\"$5\"\/\>}/g;# create links$rtfcode =~ s/{\s*([\w\\\'\-]*)\\uldb([\w\\\'\-]*)\s?(.*?)\s*}\s*{\s*([\w\\\'\-]*)\\v([\w\\\'\-]*)\s*(.*?)}/{$1$2\<a href=\"#$6\">$3\<\/a\>}/g;# font face 1#$rtfcode =~ s/{\s*([\w\\\'\-]*)\\f1([\w\\\'\-]*)\s?(.*?)}/{$1$2\<font face=\"Arial, Helvetica\"\>$3\<\/font\>}/g;# font size - better ignore#$rtfcode =~ s/{\s*([\w\\\'\-]*)\\fs(\d+)([\w\\\'\-]*)\s?(.*?)}/{$1$3\<font size=\"$2\"\>$4\<\/font\>}/g;# font color# remove all color commands which are inside a link$rtfcode =~ s/{\s*([\w\\\'\-]*)\\cf(\d+)([\w\\\'\-]*)\s?\<a(.*?)\<\/a\>}/{$1$3\<a $4\<\/a\>}/g;# replace the others with a font tag$rtfcode =~ s/{\s*([\w\\\'\-]*)\\cf(\d+)([\w\\\'\-]*)\s?(.*?)}/{$1$3\<font color=\"$colortable[$2-1]\"\>$4\<\/font\>}/g;# bold face$rtfcode =~ s/{\s*([\w\\\'\-]*)\\b([\w\\\'\-]*)\s?\<a(.*?)\<\/a\>}/{$1$2\<a $3\<\/a\>}/g;$rtfcode =~ s/{\s*([\w\\\'\-]*)\\b([\w\\\'\-]*)\s?(.*?)}/{$1$2\<b\>$3\<\/b\>}/g;# italics$rtfcode =~ s/{\s*([\w\\\'\-]*)\\i([\w\\\'\-]*)\s?\<a(.*?)\<\/a\>}/{$1$2\<a $3\<\/a\>}/g;$rtfcode =~ s/{\s*([\w\\\'\-]*)\\i([\w\\\'\-]*)\s?(.*?)}/{$1$2\<i\>$3\<\/i\>}/g;# line breaks$rtfcode =~ s/\\par(\s+)/\<br\/\>$1/g;$rtfcode =~ s/\\pard([\\\s]+)/$1/g;# page breaks$rtfcode =~ s/\\page(\W+)/\<br\/\>\<br\/\>\<hr\/\>\<br\/\>\<br\/\>$1/g;# replace unknown command chains$rtfcode =~ s/\\[\w\'\-\\]*([\s\<\}]+)/$1/g;# replace unknown command chains$rtfcode =~ s/\\[\w\'\-\\]*\{([\s\w\;\碶*\\]*)\}//g;open(HTMLFILE,">intermediate2.txt");print HTMLFILE $rtfcode ;close(HTMLFILE);#replace bracket pairs $rtfcode =~ s/{(.*?)}/$1/g;#replace bracket pairs and whitepspace around#$rtfcode =~ s/\s*{(.*?)}\s*/$1/g;#replace standalone { }$rtfcode =~ s/[{}]//g;#remove symbols before anchors$rtfcode =~ s/[#\$\+K]\<a/\<a/g;# resolve anchors%map;open(MAPFILE,"wbstego.map"); $line = "";while ($line=readline(*MAPFILE)) { @mapline = split(/=/,$line); #rm white space $mapline[1] =~ s/[\n\r]//g; $map{$mapline[0]} = $mapline[1]; #print "map entry:" . $mapline[0] . "---" . $mapline[1] . "\n"; }close(MAPFILE); # remove anchors of type $ (title) and + (browsing info)$rtfcode =~ s/\<a name=\"[\w\s:\.\,\;\_\-]*\" type=\"[\$\+]\"\/>//g;# add map id anchors$rtfcode =~ s/(\<a name=\")([\w\s:\.\,\;\_\-]*)(\") type=\"#\"\/>/$1$2$3 \/><br\/><a name=\"$map{$2}\" \/><br\/>/g;# dbg (if ln above is commented out) remove type attrib of # anchors#$rtfcode =~ s/(\<a name=\")([\w\s:\.\,\;\_\-]*)(\") type=\"#\"\/>/$1$2$3 \/>/g;# gather keyword entries$kwdTop = $rtfcode;$kwdTop =~ s/(.*?)(\<a name=\")([\w\s:\.\,\;\_\-]*)(\") type=\"K\"\/>/$3\/\/\/\//g;#print $kwdTop;# split keyword entries@keywordTopics = split(/\/\/\/\//,$kwdTop);%kwdTopicMap;$i = 1;while ($i <= $#keywordTopics) { $kwdTopicMap{$keywordTopics[$i]} = $i; $i++;}# replace keyword lists with keyword ids$rtfcode =~ s/(\<a name=\")([\w\s:\.\,\;\_\-]*)(\") type=\"K\"\/>/\<a name=\"kw$kwdTopicMap{$2}\" \/><br\/>/g;open(HTMLFILE,">wbstego.html");print HTMLFILE "<html><head><title>wbStego Help</title></head><body>" . $rtfcode . "</body></html>";close(HTMLFILE);
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -