@@ -55,7 +55,7 @@ def formatBody(lines)
5555 body += emitCode ( codeArr , code = 'h2' , 1 ) if s . sub! ( /^!!/ , '' )
5656 body += emitCode ( codeArr , code = 'blockquote' , 1 ) if s . sub! ( /^\" \" / , '' )
5757 if s =~ /^\| /
58- s . sub! ( /^\| .*\| $/ ) { asRow ( $&) }
58+ s . sub! ( /^\| .*\| \s * $/ ) { asRow ( $&) }
5959 body += emitCode ( codeArr , code = 'table' , 1 )
6060 end
6161 body += emitCode ( codeArr , '' , 0 ) if code == ''
@@ -102,6 +102,7 @@ def emitCode(codeArr, code, depth)
102102
103103def asRow ( s )
104104 cells = s . sub! ( /^\| / , '' ) . scan ( /([^|]*)\| / ) . flatten
105+ comment cells
105106 cellspans = [ ]
106107 cells . each do |e |
107108 if e . strip != ''
@@ -110,6 +111,7 @@ def asRow(s)
110111 cellspans . last [ 1 ] += 1 unless cellspans . empty?
111112 end
112113 end
114+ comment cellspans
113115 row = '<tr>'
114116 cellspans . each do |cell |
115117 content = cell [ 0 ]
@@ -121,6 +123,9 @@ def asRow(s)
121123 row += '</tr>'
122124end
123125
126+ def comment ( obj )
127+ puts "<!-- #{ obj . inspect } -->"
128+ end
124129
125130def asAnchor ( title )
126131 if File . exists? ( "pages/#{ title } " )
@@ -145,7 +150,7 @@ def inPlaceUrl(origRef)
145150print "Content-type: text/html\n \n "
146151
147152page = ENV [ 'QUERY_STRING' ] =~ /^(#{ LINK } )$/ ? $1 : "WelcomeVisitors" # $& is the last match
148- page . untaint
153+
149154par = { }
150155par [ 'page' ] = page
151156par [ 'title' ] = page . gsub ( /(.)([A-Z])/ , '\1 \2' )
@@ -166,7 +171,7 @@ def inPlaceUrl(origRef)
166171end
167172
168173par [ 'summary' ] = " -- Last edited #{ date } " if date
169- par [ 'body' ] = formatBody ( body . untaint )
174+ par [ 'body' ] = formatBody ( body )
170175par [ 'action' ] = <<-BLAH
171176<form method=post action="edit.rb?#{ page } ">
172177<input type=submit value=" Edit ">
0 commit comments