Index: library/lib/pp.tcl =================================================================== diff -u -r6a19512f1c1fd4f38243f088845016ffadf48ab5 -r794498711051e665464953bdd212dfe739465315 --- library/lib/pp.tcl (.../pp.tcl) (revision 6a19512f1c1fd4f38243f088845016ffadf48ab5) +++ library/lib/pp.tcl (.../pp.tcl) (revision 794498711051e665464953bdd212dfe739465315) @@ -204,19 +204,37 @@ $state flush } - :public method render {-noCSSClasses:switch block} { + :public method numbers {block} { + set nrlines [regsub -all \n $block \n block] + incr nrlines + set HTML "" + for {set i 1} {$i<=$nrlines} {incr i} { + append HTML [format %3d $i]\n + } + return $HTML + } + + :public method render {{-linenumbers false} -noCSSClasses:switch block} { set :output "" + :toHTML $block + set HTML ${:output} + set :output "" :puts "" - :puts -nonewline "
" - :toHTML $block - :puts "" + if {$linenumbers} { + :puts -nonewline "
[:numbers $block] | "
+ :puts -nonewline "$HTML |
$HTML" + } return ${:output} }