imports/bookish.rb in livetext-0.9.21 vs imports/bookish.rb in livetext-0.9.22
- old
+ new
@@ -31,30 +31,28 @@
_out "<tr><td width=5% valign=top></td><td>" + items.join("</td><td>") + "</td></tr>"
end
_out "</table>"
end
- # def comment
- # _body { } # ignore body
- # end
-
def _errout(*args)
::STDERR.puts *args
end
def _nbsp(n)
" "*n
end
def _slug(str)
- s2 = str.chomp.strip.gsub(/[?:,()'"\/]/,"").gsub(/ /, "-").downcase
- # _errout "SLUG: #{str} => #{s2}"
- s2
+ str2 = str.chomp.strip
+ str2 = str2.gsub(/[?:,()'"\/]/,"")
+ str2 = str2.gsub(/ /, "-")
+ str2.downcase!
+ str2
end
-
# FIXME duplicated?
+
def image(args = nil, body = nil)
name = @_args[0]
_out "<img src='#{name}'></img>"
end
@@ -107,11 +105,11 @@
@toc << "#{_nbsp(3)}<b>#@section</b> #{title}<br>"
@_data = _slug(@_data)
next_output
_out "<h3>#@section #{title}</h3>\n"
rescue => err
- STDERR.puts "#{err}\n#{err.backtrace}"
+ ::STDERR.puts "#{err}\n#{err.backtrace}"
exit
end
def subsec(args = nil, body = nil)
@sec2 += 1
@@ -274,10 +272,10 @@
def quote(args = nil, body = nil)
_out "<blockquote>"
_body {|line| _out line }
_out "</blockquote>"
rescue => err
- STDERR.puts "#{err}\n#{err.backtrace}"
+ ::STDERR.puts "#{err}\n#{err.backtrace}"
exit
end
def init_bookish
@toc_file = "toc.tmp"