M spec/gmi_renderer_spec.cr => spec/gmi_renderer_spec.cr +43 -0
@@ 106,4 106,47 @@ It does print hello world."
actual.should eq(expected)
end
+
+ it "should render unordered lists" do
+ input = "* First element
+* Second element
+* Third element"
+ expected = "* First element
+* Second element
+* Third element"
+
+ actual = render_to_gmi(input)
+
+ actual.should eq(expected)
+ end
+
+ it "should render unordered lists when it is surrounded by other text" do
+ input = "hello there
+* First element
+* Second element
+* Third element
+there hello"
+ expected = "hello there
+* First element
+* Second element
+* Third element
+there hello"
+
+ actual = render_to_gmi(input)
+
+ actual.should eq(expected)
+ end
+
+ it "should render ordered lists as unrodered" do
+ input = "1. First element
+2. Second element
+3. Third element"
+ expected = "* First element
+* Second element
+* Third element"
+
+ actual = render_to_gmi(input)
+
+ actual.should eq(expected)
+ end
end
M src/gmi_renderer.cr => src/gmi_renderer.cr +2 -2
@@ 30,11 30,11 @@ class GmiRenderer < Markd::Renderer
end
def list(node, entering)
- raise "Not implemented"
+ add_newline_if_needed
end
def item(node, entering)
- raise "Not implemented"
+ @output_io << "* " if entering
end
def block_quote(node, entering)