lib/wikicloth/wiki_buffer.rb in wikicloth-0.7.0 vs lib/wikicloth/wiki_buffer.rb in wikicloth-0.7.1

- old
+ new

@@ -68,18 +68,18 @@ end def check_globals() return false if self.class != WikiBuffer - if previous_char == "\n" - if @indent == @buffers[-1].object_id && current_char != " " && current_char != "\n" + if previous_char == "\n" || previous_char == "" + if @indent == @buffers[-1].object_id && current_char != " " + @indent = nil # close pre tag cc_temp = current_char "</pre>\n".each_char { |c| self.add_char(c) } # get the parser back on the right track "\n#{cc_temp}".each_char { |c| @buffers[-1].add_char(c) } - @indent = nil return true end if current_char == " " && @indent.nil? && ![WikiBuffer::HTMLElement,WikiBuffer::Var].include?(@buffers[-1].class) "\n<pre> ".each_char { |c| @buffers[-1].add_char(c) } @indent = @buffers[-1].object_id @@ -180,11 +180,11 @@ # Magic Words self.data.gsub!(/__([A-Z]+)__/) { |r| case $1 when "TOC" - @options[:link_handler].toc(@options[:sections]) + @options[:link_handler].toc(@options[:sections], @options[:toc_numbered]) else "" end } @@ -224,10 +224,10 @@ # Paragraphs if is_heading @paragraph_open = false else if self.data =~ /^\s*$/ && @paragraph_open && @list_data.empty? - self.data = "</p>" + self.data = "</p>#{self.data}" @paragraph_open = false else if self.data !~ /^\s*$/ self.data = "<p>#{self.data}" and @paragraph_open = true unless @paragraph_open end