33
44lappend auto_path [file dirname [file dirname [file dirname [info script]]]]
55
6- package require ruff 2.0
6+ package require ruff 2.5
77package require tomato
88
99# Note : modification 'ruff! package'
@@ -15,9 +15,86 @@ package require tomato
1515 -compact false \
1616 -excludeprocs {^_} \
1717 -pagesplit namespace \
18+ -navigation sticky \
1819 -includesource true \
1920 -preamble $::tomato::_Intro \
2021 -outdir [file dirname [info script]] \
2122 -outfile " tomato.html"
2223
23- puts " done..."
24+
25+ # Syntax highlight.
26+ foreach nameFile {
27+ tomato.html tomato-tomato-mathmatrix.html tomato-tomato-helper.html
28+ tomato-tomato-mathplane.html tomato-tomato-mathmatrix3d.html tomato-tomato-mathray3d.html
29+ tomato-tomato-mathcsys.html tomato-tomato-mathline3d.html tomato-tomato-mathpt3d.html
30+ tomato-tomato-mathquat.html tomato-tomato-mathtriangle.html tomato-tomato-mathvec3d.html
31+ } {
32+ set fp [open [file join [file dirname [info script]] $nameFile ] r]
33+ set html [split [read $fp ] \n ]
34+ close $fp
35+
36+ set fp [open [file join [file dirname [info script]] $nameFile ] w+]
37+
38+ set figure 0
39+ foreach line $html {
40+ if {[string match " *<figure*>" $line ] || [string match " *ruff_dyn_src*" $line ]} {set figure 1}
41+ if {[string match " *</figure>*" $line ] || [string match " *\} </pre></div>*" $line ]} {set figure 0}
42+
43+ if {$figure } {
44+ if {[string match " set *" $line ] || [string match " * set *" $line ]} {
45+ set l {}
46+ foreach word [split $line " " ] {
47+ if {$word eq " set" } {
48+ set word " <span style=\" color: hsl(206, 98.02%, 29.04%);font-weight: 550;\" >set</span>"
49+ }
50+ append l " $word "
51+ }
52+ set line [string trimright $l ]
53+ }
54+ if {[string match " package *" $line ]} {
55+ set line [string map {package {<span style=" color: hsl(206, 98.02%, 29.04%);font-weight: 550;" >package</span>}} $line ]
56+ }
57+ if {[string match " puts *" $line ] || [string match " * puts *" $line ]} {
58+ set line [string map {puts {<span style=" color: hsl(206, 98.02%, 29.04%);font-weight: 550;" >puts</span>}} $line ]
59+ }
60+ if {[string match " foreach *" $line ]} {
61+ set line [string map {foreach {<span style=" color: hsl(206, 98.02%, 29.04%);font-weight: 550;" >foreach</span>}} $line ]
62+ }
63+ if {[string match " *>method *" $line ]} {
64+ set line [string map {method {<span style=" color: rgba(241, 8, 218, 1);font-weight: 550;" >method</span>}} $line ]
65+ }
66+ if {[string match " *return *" $line ]} {
67+ set line [string map {return {<span style=" color: rgba(8, 23, 241, 1);font-weight: 550;" >return</span>}} $line ]
68+ }
69+ if {[string match " *error *" $line ]} {
70+ set line [string map {error {<span style=" color: rgba(8, 23, 241, 1);font-weight: 550;" >error</span>}} $line ]
71+ }
72+ if {[string match " *"*" $line ]} {
73+ regexp {"(.+)"} $line -> match
74+ set line [string map [list " "$match "" " <span style=\" color: hsl(120, 71%, 16%);\" >"$match "</span>" ] $line ]
75+ }
76+ if {[string match " *# *" $line ] || [regexp {\s#$} $line ]} {
77+ set line " <span style=\" color: hsl(218, 8%, 43.5%);font-weight: 500;\" >$line </span>"
78+ }
79+
80+ if {[string match {*$*} $line ]} {
81+ set l {}
82+ foreach word [split $line " " ] {
83+ if {[regexp {(\$[a-z0-9A-Z_:]+)} $word -> match]} {
84+ set word [string map [list $match " <span style=\" color: rgb(233, 98, 98);\" >$match </span>" ] $word ]
85+ }
86+ append l " $word "
87+ }
88+ set line [string trimright $l ]
89+ }
90+ }
91+ puts $fp $line
92+ }
93+ close $fp
94+ }
95+
96+ puts " dir : [ file dirname [info script] ]"
97+ puts " file : tomato.html"
98+ puts " version : $::tomato::version "
99+ puts done!
100+ exit 0
0 commit comments