summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.name>2014-04-17 16:16:44 -0400
committerNick White <git@njw.name>2014-04-17 16:16:44 -0400
commit00e0b832d8225d818c33d1731274503da9e8e009 (patch)
tree95a9a4686f1db71cb4415b38f72d8a86a7657daa
parent50b66f6d5a27773680916fe72ebfe0c6b5c90cf6 (diff)
downloadtkread-00e0b832d8225d818c33d1731274503da9e8e009.tar.bz2
tkread-00e0b832d8225d818c33d1731274503da9e8e009.zip
Add a few replacements, for hr and escaping of dollar and end of line
-rwxr-xr-xtkread19
1 files changed, 19 insertions, 0 deletions
diff --git a/tkread b/tkread
index bf03f50..d415274 100755
--- a/tkread
+++ b/tkread
@@ -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 != ""} {