20b3975f2966 — Sean Russell tip 12 years ago
Fixes #289, Incorrect list generation. Also turns off debug for json renderer.
3 files changed, 7 insertions(+), 6 deletions(-)

M json_renderer.rb
M parser.rb
M pdf.rb
M json_renderer.rb +3 -2
@@ 69,10 69,11 @@ if __FILE__ == $0
 	require 'parser'
 	require 'renderer'
 	File.open(ARGV[0] || "markup.txt") { |fin| 
-		p = RML::Parser.new( true )
+		p = RML::Parser.new() 
 		a = { 'dot' => ['cp $RML_INPUT $RML_OUTPUT', 'txt']}
 		r = RML::Renderer.new( RML::JSONRenderer.new(:output => STDOUT), a, p)
-		p.parse(fin) { |l| STDERR.puts l.inspect }
+		p.parse(fin)
+		#p.parse(fin) { |l| STDERR.puts l.inspect }
 		r.render( p.tokens )
 	}
 end

          
M parser.rb +2 -2
@@ 238,7 238,7 @@ module RML
 			when :definition
 				attrs = { :flavor => :definition, :term => content[0].strip }
 				content = content[1]
-			when "*"
+			when "*", "-"
 				list_type = :u_list
 				flavor = :bullet
 			when /\[([_X])\]/

          
@@ 320,7 320,7 @@ module RML
 			tag = content.strip.downcase
 			return [{ :alignment  => alignment,
 								:level	    => level,
-							  :id         => tag	}, content]
+							  :id         => tag	}, [content]]
 		end
 
 

          
M pdf.rb +2 -2
@@ 402,10 402,10 @@ module RML
 					unicode = true
 					bullet,idnt = "\xE2\x9C\x94",12
 				when :upper_alpha
-					bullet,idnt = "%c."%(?A + @list_idx[-1]),15
+					bullet,idnt = "%c."%(?A.ord + @list_idx[-1]),15
 					@list_idx[-1] += 1
 				when :lower_alpha
-					bullet,idnt = "%c."%(?a + @list_idx[-1]),15
+					bullet,idnt = "%c."%(?a.ord + @list_idx[-1]),15
 					@list_idx[-1] += 1
 				when :number, :auto
 					@list_idx[-1] += 1