Index: Makefile ================================================================== --- Makefile +++ Makefile @@ -1,9 +1,9 @@ #!/usr/bin/make CC = gcc -Os -static -TCLLIB = /home/drh/tcl/lib/libtcl8.6.a -lm -lz -lpthread -ldl +TCLLIB = /home/drh/tcl/lib/libtcl8.7.a -lm -lz -lpthread -ldl TCLINC = /home/drh/tcl/include TCLSH = tclsh all: wapptclsh Index: wapp.tcl ================================================================== --- wapp.tcl +++ wapp.tcl @@ -73,24 +73,33 @@ # In addition to the substitutions above, the text also does backslash # escapes. # proc wapp-subst {txt} { global wapp - regsub -all {%(html|url|qp|string|unsafe){1,1}?(|%)\((.+)\)\2} $txt \ - {[wappInt-enc-\1 "\3"]} txt - dict append wapp .reply [uplevel 1 [list subst -novariables $txt]] + set txt [subst -novar -nocom $txt] + while {[regexp {^(.*?)%(html|url|qp|string|unsafe)(|%)\((.+?)\)\3(.*)$} \ + $txt all before verb m1 arg after]} { + set arg [uplevel 1 [list subst $arg]] + dict append wapp .reply $before[wappInt-enc-$verb $arg] + set txt $after + } + dict append wapp .reply $txt } # Works like wapp-subst, but also removes whitespace from the beginning # of lines. # proc wapp-trim {txt} { global wapp - regsub -all {\n\s+} [string trim $txt] \n txt - regsub -all {%(html|url|qp|string|unsafe){1,1}?(|%)\((.+)\)\2} $txt \ - {[wappInt-enc-\1 "\3"]} txt - dict append wapp .reply [uplevel 1 [list subst -novariables $txt]] + regsub -all {\n\s+} [subst -nocom -novar [string trim $txt]] \n txt + while {[regexp {^(.*?)%(html|url|qp|string|unsafe)(|%)\((.+?)\)\3(.*)$} \ + $txt all before verb m1 arg after]} { + set arg [uplevel 1 [list subst $arg]] + dict append wapp .reply $before[wappInt-enc-$verb $arg] + set txt $after + } + dict append wapp .reply $txt } # There must be a wappInt-enc-NAME routine for each possible substitution # in wapp-subst. Thus there are routines for "html", "url", "qp", and "unsafe". #