diff options
-rwxr-xr-x | tkread | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -66,6 +66,12 @@ set listitems { \ {\+ *} \ } +set replacements { \ + {{^\* \* \* \* \*$} "―"} \ + {{\\$} ""} \ + {{\\\$} "$"} \ +} + if { $::argc > 0 && [lindex $::argv 0] == "-h" } { puts "Usage: $usage" exit @@ -106,10 +112,23 @@ proc markup {widget} { global underlinefmt global prefixfmt global listitems + global replacements global tagnum global underlinenum global prefixnum + # process replacements + foreach item $replacements { + set searchfor [lindex $item 0] + set replacement [lindex $item 1] + + set cur [$widget search -count len -regex "$searchfor" 0.0 end] + while {$cur != ""} { + $widget replace $cur [indexmovechar $cur "+ $len"] "$replacement" + set cur [$widget search -regex "$searchfor" $cur end] + } + } + # process images set cur [$widget search {![} 0.0 end] while {$cur != ""} { |