diff options
author | Nick White <git@njw.name> | 2014-04-17 16:16:44 -0400 |
---|---|---|
committer | Nick White <git@njw.name> | 2014-04-17 16:16:44 -0400 |
commit | 00e0b832d8225d818c33d1731274503da9e8e009 (patch) | |
tree | 95a9a4686f1db71cb4415b38f72d8a86a7657daa | |
parent | 50b66f6d5a27773680916fe72ebfe0c6b5c90cf6 (diff) | |
download | tkread-00e0b832d8225d818c33d1731274503da9e8e009.tar.bz2 tkread-00e0b832d8225d818c33d1731274503da9e8e009.zip |
Add a few replacements, for hr and escaping of dollar and end of line
-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 != ""} { |