Skip to content

Commit

Permalink
Added multi-paragraph list item support.
Browse files Browse the repository at this point in the history
  • Loading branch information
bdewey committed Dec 28, 2009
1 parent 3392f16 commit 7d05561
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 0 deletions.
2 changes: 2 additions & 0 deletions History.txt
Expand Up @@ -2,6 +2,8 @@

* HTML output is now indented
* Proper support for multi-paragraph list items.
* Fixed bugs:
* "rake spec" wouldn't work on Linux. Needed "require 'rubygems'".

== 0.3.0 / 2009-12-27

Expand Down
11 changes: 11 additions & 0 deletions lib/org-ruby/output_buffer.rb
Expand Up @@ -118,6 +118,17 @@ def maintain_list_indent_stack(line)
@list_indent_stack.push(line.indent)
push_mode line.paragraph_type
end
elsif line.blank? then

# Nothing

elsif ((line.paragraph_type == :paragraph) and
(not @list_indent_stack.empty? and
line.indent > @list_indent_stack.last))

# Nothing -- output this paragraph inside
# the list block (ul/ol)

else
@list_indent_stack = []
while ((current_mode == :ordered_list) or
Expand Down
31 changes: 31 additions & 0 deletions spec/html_examples/advanced-lists.html
@@ -0,0 +1,31 @@
<p>Advanced Lists</p>
<p><code>org-ruby</code> supports the following list features of <code>org-mode</code>:</p>
<h1>Nested lists</h1>
<ul>
<li>You can have nested lists</li>
<li>This is first-level</li>
<ul>
<li>This is a nested item</li>
<li>This is another nested item</li>
</ul>
<li>Back to the first level</li>
<li>Another first level item</li>
<ol>
<li>This is a numbered list nested within the unordered list</li>
<li>This is another numbered item</li>
</ol>
</ul>
<p>Note the list ends just some more text. Make sure both list blocks are closed.</p>
<h1>Multi-paragraph list items</h1>
<p>This list will end with the end-of-file. Make sure all blocks are closed.</p>
<ul>
<li>This is a list item</li>
<li>This list item has multiple paragraphs.</li>
<p>This is paragraph two.</p>
<p>And paragraph three.</p>
<li>Back to a list item.</li>
<ul>
<li>Nested, just for grins!</li>
<li>woo hoo!</li>
</ul>
</ul>
31 changes: 31 additions & 0 deletions spec/html_examples/advanced-lists.org
@@ -0,0 +1,31 @@
Advanced Lists

=org-ruby= supports the following list features of =org-mode=:

* Nested lists

- You can have nested lists
- This is first-level
- This is a nested item
- This is another nested item
- Back to the first level
- Another first level item
1. This is a numbered list nested within the unordered list
2. This is another numbered item

Note the list ends just some more text. Make sure both list blocks
are closed.

* Multi-paragraph list items

This list will end with the end-of-file. Make sure all blocks are closed.

- This is a list item
- This list item has multiple paragraphs.

This is paragraph two.

And paragraph three.
- Back to a list item.
- Nested, just for grins!
- woo hoo!

0 comments on commit 7d05561

Please sign in to comment.