plugin/bookish.rb in livetext-0.8.95 vs plugin/bookish.rb in livetext-0.8.96

- old
+ new

@@ -116,20 +116,23 @@ @sec += 1 @sec2 = 0 @section = "#@chapter.#@sec" # _errout("section #@section") @toc << "#{_nbsp(3)}<b>#@section</b> #@_data<br>" -# _next_output(_slug(@_data)) + _next_output(_slug(@_data)) _out "<h3>#@section #{@_data}</h3>\n" +rescue => err + STDERR.puts "#{err}\n#{err.backtrace}" + exit end def subsec @sec2 += 1 @subsec = "#@chapter.#@sec.#@sec2" @toc << "#{_nbsp(6)}<b>#@subsec</b> #@_data<br>" # _errout("section #@subsec") -# _next_output(_slug(@_data)) + _next_output(_slug(@_data)) _out "<h3>#@subsec #{@_data}</h3>\n" end def table2 title = @_data @@ -220,12 +223,12 @@ def toc! _debug "Closing TOC" @toc.close rescue => err - puts @body - @body = "" + puts @parent.body + @parent.body = "" _errout "Exception: #{err.inspect}" end def toc2 file = @_args[0] @@ -240,13 +243,12 @@ system("cat toc.tmp >>#{file}") end def missing @toc << "#{_nbsp(8)}<font color=red>TBD: #@_data</font><br>" - _print "<br><font color=red><i>[Material missing" - _print ": #@_data" unless @_data.empty? - _out "]</i></font><br>\n " + stuff = @_data.empty? ? "" : ": #@_data" + _print "<br><font color=red><i>[Material missing#{stuff}]</i></font><br>\n " end def TBC @toc << "#{_nbsp(8)}<font color=red>To be continued...</font><br>" _print "<br><font color=red><i>To be continued...</i></font><br>" @@ -260,9 +262,12 @@ def quote _out "<blockquote>" _body {|line| _out line } _out "</blockquote>" +rescue => err + STDERR.puts "#{err}\n#{err.backtrace}" + exit end def init_bookish @toc_file = "toc.tmp" @toc = ::File.new(@toc_file, "w")