[DRE-commits] [ruby-org] 245/303: Quote and center blocks can include tables.
Jérémy Bobbio
lunar at alioth.debian.org
Fri Aug 9 17:34:06 UTC 2013
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch master
in repository ruby-org.
commit 0e4d6e2e89c5ed094b9be511df4fa7fd26f34c8d
Author: vonavi <ivvl82 at gmail.com>
Date: Tue Jan 29 22:04:49 2013 +0200
Quote and center blocks can include tables.
---
lib/org-ruby/headline.rb | 1 -
lib/org-ruby/html_output_buffer.rb | 1 -
lib/org-ruby/parser.rb | 69 +++++++++++++++---------------------
3 files changed, 29 insertions(+), 42 deletions(-)
diff --git a/lib/org-ruby/headline.rb b/lib/org-ruby/headline.rb
index c48d112..659e39e 100644
--- a/lib/org-ruby/headline.rb
+++ b/lib/org-ruby/headline.rb
@@ -45,7 +45,6 @@ module Orgmode
def initialize(line, parser = nil, offset=0)
super(line, parser)
@body_lines = []
- @body_lines << self # Make @body_lines contain the headline?
@tags = []
@export_state = :exclude
if (@line =~ LineRegexp) then
diff --git a/lib/org-ruby/html_output_buffer.rb b/lib/org-ruby/html_output_buffer.rb
index 8228e61..7b69e74 100644
--- a/lib/org-ruby/html_output_buffer.rb
+++ b/lib/org-ruby/html_output_buffer.rb
@@ -23,7 +23,6 @@ module Orgmode
:definition_descr => "dd",
:table => "table",
:table_row => "tr",
- :table_header => "tr",
:quote => "blockquote",
:example => "pre",
:src => "pre",
diff --git a/lib/org-ruby/parser.rb b/lib/org-ruby/parser.rb
index 6456691..3a268a3 100644
--- a/lib/org-ruby/parser.rb
+++ b/lib/org-ruby/parser.rb
@@ -101,53 +101,42 @@ module Orgmode
table_header_set = false
@lines.each do |text|
line = Line.new text, self
+ mode = :normal if line.end_block? and mode == line.paragraph_type
+ mode = :normal if line.property_drawer_end_block? and mode == :property_drawer
- if mode == :normal
+ case mode
+ when :normal, :quote, :center
if Headline.headline? line.line
- @current_headline = Headline.new line.line, self, offset
- @headlines << @current_headline
- else
- # If there is a setting on this line, remember it.
- line.in_buffer_setting? do |key, value|
- store_in_buffer_setting key, value
- end
- if line.table_separator? then
- if previous_line and previous_line.paragraph_type == :table_row and !table_header_set
- previous_line.assigned_paragraph_type = :table_header
- table_header_set = true
- end
- end
- table_header_set = false if !line.table?
- mode = line.paragraph_type if line.begin_block?
- mode = :property_drawer if line.property_drawer_begin_block?
- if @current_headline
- @current_headline.body_lines << line
- else
- @header_lines << line
+ line = Headline.new line.line, self, offset
+ elsif line.table_separator?
+ if previous_line and previous_line.paragraph_type == :table_row and !table_header_set
+ previous_line.assigned_paragraph_type = :table_header
+ table_header_set = true
end
end
+ table_header_set = false if !line.table?
+ when :example, :src
+ # As long as we stay in code mode, force lines to be paragraphs.
+ # Don't try to interpret structural items, like headings and tables.
+ line.assigned_paragraph_type = :paragraph
+ end
- else
- mode = :normal if line.end_block? and mode == line.paragraph_type
- mode = :normal if line.property_drawer_end_block? and mode == :property_drawer
-
- case mode
- when :example, :src
- # As long as we stay in code mode, force lines to be paragraphs.
- # Don't try to interpret structural items, like headings and tables.
- line.assigned_paragraph_type = :paragraph
- when :quote, :center
- if Headline.headline? line.line
- line = Headline.new line.line, self, offset
- end
+ if mode == :normal
+ @headlines << @current_headline = line if Headline.headline? line.line
+ # If there is a setting on this line, remember it.
+ line.in_buffer_setting? do |key, value|
+ store_in_buffer_setting key, value
end
- unless mode == :comment
- if @current_headline
- @current_headline.body_lines << line
- else
- @header_lines << line
- end
+ mode = line.paragraph_type if line.begin_block?
+ mode = :property_drawer if line.property_drawer_begin_block?
+ end
+
+ unless mode == :comment
+ if @current_headline
+ @current_headline.body_lines << line
+ else
+ @header_lines << line
end
end
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-org.git
More information about the Pkg-ruby-extras-commits
mailing list