Created
June 3, 2012 15:05
-
-
Save wanabe/2863847 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: lib/bitclust/rdcompiler.rb | |
=================================================================== | |
--- lib/bitclust/rdcompiler.rb (revision 5176) | |
+++ lib/bitclust/rdcompiler.rb (working copy) | |
@@ -154,15 +154,18 @@ module BitClust | |
"<h#{level} #{name}>#{label}</h#{level}>" | |
end | |
- def ulist | |
+ def ulist(ident = nil) | |
@out.puts '<ul>' | |
- @f.while_match(/\A\s+\*\s/) do |line| | |
+ indent ||= @f.peek[/\A\s+/].length | |
+ @f.while_match(/\A\s{#{indent},}\*\s/) do |line| | |
string '<li>' | |
string compile_text(line.sub(/\A\s+\*/, '').strip) | |
@f.while_match(/\A\s+[^\*\s]/) do |cont| | |
nl | |
string compile_text(cont.strip) | |
end | |
+ next_line = @f.peek[/(\A\s{#{indent}}\s+)\*/] | |
+ ulist($1. length) if next_line | |
line '</li>' | |
end | |
line '</ul>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment