diff options
author | Nick White <git@njw.me.uk> | 2014-01-01 15:20:12 +0000 |
---|---|---|
committer | Nick White <git@njw.me.uk> | 2014-01-01 15:20:12 +0000 |
commit | 8a580c7a0cae271b5fcf5ab938ad1064323efaf6 (patch) | |
tree | f7b655913071241c79ca0d2d4bc3904d64b3c335 | |
parent | 15ce64e5282d617ca16a98e30ca697b5c31d9dad (diff) | |
download | tkread-8a580c7a0cae271b5fcf5ab938ad1064323efaf6.tar.bz2 tkread-8a580c7a0cae271b5fcf5ab938ad1064323efaf6.zip |
Add headings to markdown processing
-rwxr-xr-x | tkread | 20 |
1 files changed, 13 insertions, 7 deletions
@@ -29,9 +29,12 @@ set tagnum 0 set domarkdown 0 set surroundfmt { \ - {"***" "bold italic"} \ - {"**" "bold"} \ - {"*" "italic"} \ + {"***" "0" "bold italic"} \ + {"**" "0" "bold"} \ + {"*" "0" "italic"} \ + {"===" "0" "italic"} \ + {"==" "3" "italic"} \ + {"=" "6" ""} \ } package require Tk @@ -55,7 +58,8 @@ proc markup {widget} { foreach fmt $surroundfmt { set searchchar [lindex $fmt 0] - set fmtstring [lindex $fmt 1] + set fmtsizemod [lindex $fmt 1] + set fmtstring [lindex $fmt 2] set searchlen [string length $searchchar] set insection 0 set cur "" @@ -87,7 +91,8 @@ proc markup {widget} { $widget tag add tag_$tagnum markon_$x markoff_$x } - $widget tag configure tag_$tagnum -font "{$fontfamily} $fontsize $fmtstring" + # TODO: change in changeFontSize too if this works + $widget tag configure tag_$tagnum -font "{$fontfamily} [expr $fontsize + $fmtsizemod] $fmtstring" incr tagnum } } @@ -102,8 +107,9 @@ proc changeFontSize {change} { set fontsize $newsize .t configure -font "{$fontfamily} $fontsize" -padx [expr $fontsize * 3] for {set x 0} {$x < $tagnum} {incr x} { - set fmtstring [lindex [lindex $surroundfmt $x] 1] - .t tag configure tag_$x -font "{$fontfamily} $fontsize $fmtstring" + set fmtstring [lindex [lindex $surroundfmt $x] 2] + set fmtsizemod [lindex [lindex $surroundfmt $x] 1] + .t tag configure tag_$x -font "{$fontfamily} [expr $fontsize + $fmtsizemod] $fmtstring" } } } |