[DRE-commits] [ruby-org] 44/303: HTML output is now indented, two spaces per scope.

Jérémy Bobbio lunar at alioth.debian.org
Fri Aug 9 17:33:24 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 19b85eee258d5abe5d87f4c88906df34d0874c59
Author: Brian Dewey <bdewey at gmail.com>
Date:   Mon Dec 28 11:24:20 2009 -0800

    HTML output is now indented, two spaces per scope.
---
 History.txt                               |    5 +++++
 lib/org-ruby/html_output_buffer.rb        |   16 ++++++++++++++--
 lib/org-ruby/output_buffer.rb             |    7 +++++++
 spec/html_examples/block_code.html        |    4 ++--
 spec/html_examples/blockquote.html        |    4 ++--
 spec/html_examples/inline-formatting.html |    6 +++---
 spec/html_examples/lists.html             |   14 +++++++-------
 spec/html_examples/only-list.html         |    6 +++---
 spec/html_examples/only-table.html        |    8 ++++----
 spec/html_examples/tables.html            |   14 +++++++-------
 10 files changed, 54 insertions(+), 30 deletions(-)

diff --git a/History.txt b/History.txt
index c473f6e..b73138f 100644
--- a/History.txt
+++ b/History.txt
@@ -1,3 +1,8 @@
+== 0.4.0 / 2009-12-28
+
+* HTML output is now indented
+* Proper support for multi-paragraph list items.
+
 == 0.3.0 / 2009-12-27
 
 * Uses rubypants to get better typography (smart quotes, elipses, etc.).
diff --git a/lib/org-ruby/html_output_buffer.rb b/lib/org-ruby/html_output_buffer.rb
index aade653..08e4682 100644
--- a/lib/org-ruby/html_output_buffer.rb
+++ b/lib/org-ruby/html_output_buffer.rb
@@ -21,13 +21,19 @@ module Orgmode
     }
 
     def push_mode(mode)
+      if ModeTag[mode] then
+        output_indentation
+        @output << "<#{ModeTag[mode]}>\n" 
+      end
       super(mode)
-      @output << "<#{ModeTag[mode]}>\n" if ModeTag[mode]
     end
 
     def pop_mode(mode = nil)
       m = super(mode)
-      @output << "</#{ModeTag[m]}>\n" if ModeTag[m]
+      if ModeTag[m] then
+        output_indentation
+        @output << "</#{ModeTag[m]}>\n"
+      end
     end
 
     def flush!
@@ -38,6 +44,7 @@ module Orgmode
         @output << CGI.escapeHTML(@buffer) << "\n"
       else
         if (@buffer.length > 0) then
+          output_indentation
           @output << "<#{HtmlBlockTag[@output_type]}>" \
             << inline_formatting(@buffer) \
             << "</#{HtmlBlockTag[@output_type]}>\n"
@@ -49,6 +56,11 @@ module Orgmode
     ######################################################################
     private
 
+    def output_indentation
+      indent = "  " * (@mode_stack.length - 1)
+      @output << indent
+    end
+
     Tags = {
       "*" => { :open => "<b>", :close => "</b>" },
       "/" => { :open => "<i>", :close => "</i>" },
diff --git a/lib/org-ruby/output_buffer.rb b/lib/org-ruby/output_buffer.rb
index a1407ec..7998ecd 100644
--- a/lib/org-ruby/output_buffer.rb
+++ b/lib/org-ruby/output_buffer.rb
@@ -99,6 +99,13 @@ module Orgmode
     ######################################################################
     private
 
+    # call-seq:
+    #     continue_current_list?  => boolean
+    #
+    # Tests if the line should continue the current list.
+    def continue_current_list?(line)
+    end
+
     def maintain_list_indent_stack(line)
       if (line.plain_list?) then
         while (not @list_indent_stack.empty? \
diff --git a/spec/html_examples/block_code.html b/spec/html_examples/block_code.html
index c5482d0..637b93d 100644
--- a/spec/html_examples/block_code.html
+++ b/spec/html_examples/block_code.html
@@ -25,6 +25,6 @@ This is my code!
 Another line!
 </pre>
 <ul>
-<li>My list should cancel this.</li>
-<li>Another list line.</li>
+  <li>My list should cancel this.</li>
+  <li>Another list line.</li>
 </ul>
diff --git a/spec/html_examples/blockquote.html b/spec/html_examples/blockquote.html
index c058247..ac559ef 100644
--- a/spec/html_examples/blockquote.html
+++ b/spec/html_examples/blockquote.html
@@ -1,7 +1,7 @@
 <p>BLOCKQUOTE</p>
 <p>Testing that I can have block quotes:</p>
 <blockquote>
-<p><i>Example:</i></p>
-<p>This is blockquote text.</p>
+  <p><i>Example:</i></p>
+  <p>This is blockquote text.</p>
 </blockquote>
 <p>And now I’m back to normal text!</p>
diff --git a/spec/html_examples/inline-formatting.html b/spec/html_examples/inline-formatting.html
index 00d7dc9..c79cd1b 100644
--- a/spec/html_examples/inline-formatting.html
+++ b/spec/html_examples/inline-formatting.html
@@ -2,9 +2,9 @@
 <p>I want to make sure I handle all inline formatting. I need to handle <b>bold</b>, <i>italic</i>, <code>code</code>, <code>verbatim</code>, <span style="text-decoration:underline;">underline</span>, <del>strikethrough</del>.</p>
 <p>In addition, I need to make sure I can handle links. We’ve got simple links, like this:</p>
 <ul>
-<li><a href="http://www.bing.com">http://www.bing.com</a></li>
-<li><a href="http://www.google.com">http://www.google.com</a></li>
-<li>http://www.gmail.com</li>
+  <li><a href="http://www.bing.com">http://www.bing.com</a></li>
+  <li><a href="http://www.google.com">http://www.google.com</a></li>
+  <li>http://www.gmail.com</li>
 </ul>
 <p>Note the last one <b>is not</b> a link, as the source doesn’t include it in double-brackets and I don’t auto-recognize URLs.</p>
 <p>I should also handle links with <a href="http://www.xkcd.com">helpful text</a>.</p>
diff --git a/spec/html_examples/lists.html b/spec/html_examples/lists.html
index 4c49a90..30c692c 100644
--- a/spec/html_examples/lists.html
+++ b/spec/html_examples/lists.html
@@ -1,19 +1,19 @@
 <h1>Lists</h1>
 <p>I want to make sure I have great support for lists.</p>
 <ul>
-<li>This is an unordered list</li>
-<li>This continues the unordered list</li>
+  <li>This is an unordered list</li>
+  <li>This continues the unordered list</li>
 </ul>
 <p>And this is a paragraph <b>after</b> the list.</p>
 <h2>Wrapping within the list</h2>
 <ul>
-<li>This is a single-line list item in the org file.</li>
-<li>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo  [...]
-<li>And this is the next item. The previous item needs to be on one line to keep <code>textile</code> happy.</li>
-<li>Ditto the previous line, actually.</li>
+  <li>This is a single-line list item in the org file.</li>
+  <li>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo du [...]
+  <li>And this is the next item. The previous item needs to be on one line to keep <code>textile</code> happy.</li>
+  <li>Ditto the previous line, actually.</li>
 </ul>
 <h2>Edge cases</h2>
 <ul>
-<li>This is a single-line list.</li>
+  <li>This is a single-line list.</li>
 </ul>
 <p>And this is a <b>separate paragraph.</b> Note the indentation in the org file.</p>
diff --git a/spec/html_examples/only-list.html b/spec/html_examples/only-list.html
index 567c37f..91e354a 100644
--- a/spec/html_examples/only-list.html
+++ b/spec/html_examples/only-list.html
@@ -1,5 +1,5 @@
 <ul>
-<li>This file has only a list</li>
-<li>Note it will end with nothing other than a list item.</li>
-<li>the world wants to know: Will org-ruby write the closing ul tag?</li>
+  <li>This file has only a list</li>
+  <li>Note it will end with nothing other than a list item.</li>
+  <li>the world wants to know: Will org-ruby write the closing ul tag?</li>
 </ul>
diff --git a/spec/html_examples/only-table.html b/spec/html_examples/only-table.html
index 70b451f..46f0e2f 100644
--- a/spec/html_examples/only-table.html
+++ b/spec/html_examples/only-table.html
@@ -1,6 +1,6 @@
 <table>
-<tr><td>One</td><td>Two</td><td>Three</td><td>Four</td></tr>
-<tr><td>Five</td><td>Six</td><td>Seven</td><td>Eight</td></tr>
-<tr><td>Nine</td><td>Ten</td><td>Eleven</td><td>Twelve</td></tr>
-<tr><td><b>format</b></td><td><i>text</i></td><td><code>in</code></td><td><span style="text-decoration:underline;">cells</span></td></tr>
+  <tr><td>One</td><td>Two</td><td>Three</td><td>Four</td></tr>
+  <tr><td>Five</td><td>Six</td><td>Seven</td><td>Eight</td></tr>
+  <tr><td>Nine</td><td>Ten</td><td>Eleven</td><td>Twelve</td></tr>
+  <tr><td><b>format</b></td><td><i>text</i></td><td><code>in</code></td><td><span style="text-decoration:underline;">cells</span></td></tr>
 </table>
diff --git a/spec/html_examples/tables.html b/spec/html_examples/tables.html
index de132c0..810ac55 100644
--- a/spec/html_examples/tables.html
+++ b/spec/html_examples/tables.html
@@ -2,19 +2,19 @@
 <p>Different types of ORG tables.</p>
 <h1>Simple table, no header.</h1>
 <table>
-<tr><td>Cell one</td><td>Cell two</td></tr>
-<tr><td>Cell three</td><td>Cell four</td></tr>
+  <tr><td>Cell one</td><td>Cell two</td></tr>
+  <tr><td>Cell three</td><td>Cell four</td></tr>
 </table>
 <h1>Indented table</h1>
 <table>
-<tr><td>Cell one</td></tr>
-<tr><td>Cell two</td></tr>
+  <tr><td>Cell one</td></tr>
+  <tr><td>Cell two</td></tr>
 </table>
 <p>And here’s some paragraph content. The line breaks will need to get removed here, but not for the tables.</p>
 <h1>Table with header</h1>
 <table>
-<tr><td>One</td><td>Two</td><td>Three</td></tr>
-<tr><td>Four</td><td>Five</td><td>Six</td></tr>
-<tr><td>Seven</td><td>Eight</td><td>Nine</td></tr>
+  <tr><td>One</td><td>Two</td><td>Three</td></tr>
+  <tr><td>Four</td><td>Five</td><td>Six</td></tr>
+  <tr><td>Seven</td><td>Eight</td><td>Nine</td></tr>
 </table>
 <p>The separator row should not get printed out.</p>

-- 
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