Skip to content

Instantly share code, notes, and snippets.

@wanabe
Created June 3, 2012 15:05
Show Gist options
  • Save wanabe/2863847 to your computer and use it in GitHub Desktop.
Save wanabe/2863847 to your computer and use it in GitHub Desktop.
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