[DRE-commits] [ruby-org] 238/303: Fixes handling definition lists.

Jérémy Bobbio lunar at alioth.debian.org
Fri Aug 9 17:34:05 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 a672361ce53f6db616a2b7088735e25245428c17
Author: vonavi <ivvl82 at gmail.com>
Date:   Sat Jan 26 21:12:11 2013 +0200

    Fixes handling definition lists.
---
 lib/org-ruby/html_output_buffer.rb |   26 ++++++++++++++------------
 lib/org-ruby/line.rb               |    2 +-
 spec/html_examples/code-lists.html |    3 ++-
 3 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/lib/org-ruby/html_output_buffer.rb b/lib/org-ruby/html_output_buffer.rb
index 423bc0c..3bdae94 100644
--- a/lib/org-ruby/html_output_buffer.rb
+++ b/lib/org-ruby/html_output_buffer.rb
@@ -76,9 +76,12 @@ module Orgmode
                         @title_decoration
                       end
 
-          @output << "\n" unless @indentation == :start
+          unless @indentation == :start
+            @output << "\n"
+            output_indentation
+          end
           @indentation = :output
-          output_indentation
+
           @logger.debug "#{mode}: <#{HtmlBlockTag[mode]}#{css_class}>"
           @output << "<#{HtmlBlockTag[mode]}#{css_class}>"
           # Entering a new mode obliterates the title decoration
@@ -167,17 +170,16 @@ module Orgmode
           end
           @output << inline_formatting(@buffer)
 
-        when current_mode == :definition_item
-          @output << "\n"
-          @indentation = :output
-          output_indentation
+        when current_mode == :definition_term
           d = @buffer.split("::", 2)
-          @output << "<#{HtmlBlockTag[:definition_term]}#{@title_decoration}>" << inline_formatting(d[0].strip) \
-          << "</#{HtmlBlockTag[:definition_term]}>"
-          if d.length > 1
-            @output << "<#{HtmlBlockTag[:definition_descr]}#{@title_decoration}>" << inline_formatting(d[1].strip) \
-            << "</#{HtmlBlockTag[:definition_descr]}>"
-          end
+          @output << inline_formatting(d[0].strip)
+          indent = @list_indent_stack.last
+          pop_mode
+
+          @indentation = :start
+          push_mode(:definition_descr, indent)
+          @output << inline_formatting(d[1].strip)
+          @indentation = nil
 
         when @output_type == :horizontal_rule
           @output << "\n"
diff --git a/lib/org-ruby/line.rb b/lib/org-ruby/line.rb
index 68436cb..135a558 100644
--- a/lib/org-ruby/line.rb
+++ b/lib/org-ruby/line.rb
@@ -218,7 +218,7 @@ module Orgmode
       when code_block_line? # Do not try to guess the type of this line if it is accumulating source code
         :src
       when definition_list? # order is important! A definition_list is also an unordered_list!
-        :definition_item
+        :definition_term
       when (ordered_list? or unordered_list?)
         :list_item
       when property_drawer_begin_block?
diff --git a/spec/html_examples/code-lists.html b/spec/html_examples/code-lists.html
index 9069b93..0313072 100644
--- a/spec/html_examples/code-lists.html
+++ b/spec/html_examples/code-lists.html
@@ -98,10 +98,11 @@
   <li>Example
     <dl>
       <dt>Hello</dt><dd>Hola
-        Paragrap continues here</dd>
+        Paragrap continues here
         <blockquote>
           <p>Cuando me desperte, el dinosaurio estaba alli.</p>
         </blockquote>
+      </dd>
       <dt>Dog</dt><dd>Perro
         Paragraph</dd>
     </dl>

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