Permalink
Browse files

Suppresses to pop mode for a blank line.

  • Loading branch information...
1 parent 3922887 commit b3ca9328da471c7c41eea060779565afdaa0b4f4 @vonavi committed Jan 10, 2013
Showing with 18 additions and 17 deletions.
  1. +9 −10 lib/org-ruby/html_output_buffer.rb
  2. +8 −6 lib/org-ruby/output_buffer.rb
  3. +1 −1 lib/org-ruby/textile_output_buffer.rb
@@ -56,26 +56,25 @@ def initialize(output, opts = {})
# write out one of the block tags in the HtmlBlockTag constant to
# put this information in the HTML stream.
def push_mode(mode, indent)
+ super(mode)
@list_indent_stack.push(indent)
- if HtmlBlockTag[mode] then
+
+ skip_tag = ((mode_is_table?(mode) and skip_tables?) or
+ (mode == :src and defined? Pygments))
+ if HtmlBlockTag[mode] and not skip_tag
css_class = @title_decoration
css_class = " class=\"src\"" if mode == :src and @block_lang.empty?
css_class = " class=\"src src-#{@block_lang}\"" if mode == :src and not @block_lang.empty?
css_class = " class=\"example\"" if (mode == :example || mode == :inline_example)
css_class = " style=\"text-align: center\"" if mode == :center
- skip = ((mode_is_table?(mode) and skip_tables?) or
- (mode == :src and defined? Pygments))
- unless skip
- output_indentation
- @logger.debug "#{mode}: <#{HtmlBlockTag[mode]}#{css_class}>\n"
- @output << "<#{HtmlBlockTag[mode]}#{css_class}>"
- end
+ output_indentation
+ @logger.debug "#{mode}: <#{HtmlBlockTag[mode]}#{css_class}>\n"
+ @output << "<#{HtmlBlockTag[mode]}#{css_class}>"
# Entering a new mode obliterates the title decoration
@title_decoration = ""
end
- super(mode)
- skip
+ not skip_tag
end
# We are leaving a mode. Close any tags that were opened when
@@ -181,25 +181,27 @@ def maintain_mode_stack(line)
(not mode_is_block? current_mode))
pop_mode
end
+ end
+ unless line.paragraph_type == :blank
# Opens the major mode of line if it exists.
if line.major_mode
if (@list_indent_stack.empty? or
@list_indent_stack.last < line.indent)
- @output << "\n" unless push_mode(line.major_mode, line.indent)
+ @output << "\n" if push_mode(line.major_mode, line.indent)
end
end
# Open tag that precedes text immediately
if (@list_indent_stack.empty? or
@list_indent_stack.last <= line.indent)
push_mode(line.paragraph_type, line.indent) unless line.block_type
end
+ end
- # Special case: Only end-block line closes the block
- if mode_is_block? current_mode
- pop_mode if (line.end_block? and
- line.major_mode == current_mode)
- end
+ # Special case: Only end-block line closes the block
+ if mode_is_block? current_mode
+ pop_mode if (line.end_block? and
+ line.major_mode == current_mode)
end
end
@@ -19,7 +19,7 @@ def push_mode(mode, indent)
@add_paragraph = false
@output << "\n"
end
- true
+ false
end
def pop_mode(mode = nil)

0 comments on commit b3ca932

Please sign in to comment.