1
Fork 0

dedent transform

This commit is contained in:
Jan-Erik Rediger 2024-10-29 20:58:49 +01:00
parent 1e746fbd72
commit 2aaf3d2106

View file

@ -1,5 +1,7 @@
#!/usr/bin/env wish
package require textutil
set active_transform 0
proc oneline {text} {
@ -17,6 +19,10 @@ proc wordcount {text} {
return $out
}
proc dedent {text} {
return [textutil::undent $text]
}
proc markdown_quote {text} {
set text [string trimright $text]
return [string cat "> " [regsub -all \n $text "\n> "]]
@ -24,6 +30,7 @@ proc markdown_quote {text} {
lappend transforms [list {One line} oneline]
lappend transforms [list {Line/Word/Char} wordcount]
lappend transforms [list {Dedent} dedent]
lappend transforms [list {Markdown Quote} markdown_quote]
wm geometry . 750x650