[DRE-commits] [ruby-org] 80/303: Checkpoint
Jérémy Bobbio
lunar at alioth.debian.org
Fri Aug 9 17:33:31 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 9b8f57c1b3914771c8d1236b655631b5f974e2db
Author: Brian Dewey <bdewey at gmail.com>
Date: Tue Jan 5 16:49:00 2010 -0800
Checkpoint
---
History.txt | 4 +++
lib/org-ruby.rb | 2 +-
lib/org-ruby/line.rb | 63 ------------------------------------------------
lib/org-ruby/parser.rb | 60 ++++++++++++++++++++++++++++++++++++++++++++-
4 files changed, 64 insertions(+), 65 deletions(-)
diff --git a/History.txt b/History.txt
index 54859f7..e4f0075 100644
--- a/History.txt
+++ b/History.txt
@@ -1,3 +1,7 @@
+== 0.5.2 / 2010-01-05
+
+* Refactored to improve layering.
+
== 0.5.1 / 2009-12-30
* Minor enhancement: Recognize lines starting with ":" as examples.
diff --git a/lib/org-ruby.rb b/lib/org-ruby.rb
index eb458e2..5dd92db 100644
--- a/lib/org-ruby.rb
+++ b/lib/org-ruby.rb
@@ -3,7 +3,7 @@ unless defined? ::OrgRuby
module OrgRuby
# :stopdoc:
- VERSION = '0.5.1'
+ VERSION = '0.5.2'
LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
# :startdoc:
diff --git a/lib/org-ruby/line.rb b/lib/org-ruby/line.rb
index 7ce84d3..472dd1b 100644
--- a/lib/org-ruby/line.rb
+++ b/lib/org-ruby/line.rb
@@ -170,69 +170,6 @@ module Orgmode
translate(lines, output_buffer)
end
- def self.to_html(lines, opts = { })
- output = ""
- output_buffer = HtmlOutputBuffer.new(output, opts)
- translate(lines, output_buffer)
- end
-
- # Converts an array of lines to textile format.
- def self.translate(lines, output_buffer)
- lines.each do |line|
-
- # See if we're carrying paragraph payload, and output
- # it if we're about to switch to some other output type.
- output_buffer.prepare(line)
-
- case line.paragraph_type
- when :metadata, :table_separator, :blank
-
- output_buffer << line.line if output_buffer.preserve_whitespace?
-
- when :comment
-
- if line.begin_block?
- output_buffer.push_mode(:blockquote) if line.block_type == "QUOTE"
- output_buffer.push_mode(:src) if line.block_type == "SRC"
- output_buffer.push_mode(:example) if line.block_type == "EXAMPLE"
- elsif line.end_block?
- output_buffer.pop_mode(:blockquote) if line.block_type == "QUOTE"
- output_buffer.pop_mode(:src) if line.block_type == "SRC"
- output_buffer.pop_mode(:example) if line.block_type == "EXAMPLE"
- else
- output_buffer << line.line if output_buffer.preserve_whitespace?
- end
-
- when :table_row, :table_header
-
- output_buffer << line.line.lstrip
-
- when :ordered_list
-
- output_buffer << line.strip_ordered_list_tag << " "
-
- when :unordered_list
-
- output_buffer << line.strip_unordered_list_tag << " "
-
- when :inline_example
-
- output_buffer << line.line.sub(InlineExampleRegexp, "")
-
- when :paragraph
-
- if output_buffer.preserve_whitespace? then
- output_buffer << line.line
- else
- output_buffer << line.line.strip << " "
- end
- end
- end
- output_buffer.flush!
- output_buffer.pop_mode until output_buffer.current_mode == :normal
- output_buffer.output
- end
-
######################################################################
private
diff --git a/lib/org-ruby/parser.rb b/lib/org-ruby/parser.rb
index 8de947a..4b35d3e 100644
--- a/lib/org-ruby/parser.rb
+++ b/lib/org-ruby/parser.rb
@@ -180,7 +180,8 @@ module Orgmode
else
export_options[:decorate_title] = true
end
- output << Line.to_html(@header_lines, export_options) unless skip_header_lines?
+ output_buffer = HtmlOutputBuffer.new(output, export_options)
+ output << translate(@header_lines, output_buffer) unless skip_header_lines?
# If we've output anything at all, remove the :decorate_title option.
export_options.delete(:decorate_title) if (output.length > 0)
@@ -195,6 +196,63 @@ module Orgmode
######################################################################
private
+ # Converts an array of lines to the appropriate format.
+ def translate(lines, output_buffer)
+ lines.each do |line|
+
+ # See if we're carrying paragraph payload, and output
+ # it if we're about to switch to some other output type.
+ output_buffer.prepare(line)
+
+ case line.paragraph_type
+ when :metadata, :table_separator, :blank
+
+ output_buffer << line.line if output_buffer.preserve_whitespace?
+
+ when :comment
+
+ if line.begin_block?
+ output_buffer.push_mode(:blockquote) if line.block_type == "QUOTE"
+ output_buffer.push_mode(:src) if line.block_type == "SRC"
+ output_buffer.push_mode(:example) if line.block_type == "EXAMPLE"
+ elsif line.end_block?
+ output_buffer.pop_mode(:blockquote) if line.block_type == "QUOTE"
+ output_buffer.pop_mode(:src) if line.block_type == "SRC"
+ output_buffer.pop_mode(:example) if line.block_type == "EXAMPLE"
+ else
+ output_buffer << line.line if output_buffer.preserve_whitespace?
+ end
+
+ when :table_row, :table_header
+
+ output_buffer << line.line.lstrip
+
+ when :ordered_list
+
+ output_buffer << line.strip_ordered_list_tag << " "
+
+ when :unordered_list
+
+ output_buffer << line.strip_unordered_list_tag << " "
+
+ when :inline_example
+
+ output_buffer << line.line.sub(InlineExampleRegexp, "")
+
+ when :paragraph
+
+ if output_buffer.preserve_whitespace? then
+ output_buffer << line.line
+ else
+ output_buffer << line.line.strip << " "
+ end
+ end
+ end
+ output_buffer.flush!
+ output_buffer.pop_mode until output_buffer.current_mode == :normal
+ output_buffer.output
+ end
+
# Uses export_select_tags and export_exclude_tags to determine
# which parts of the org-file to export.
def mark_trees_for_export
--
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