commonmarker 0.23.4 → 0.23.5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of commonmarker might be problematic. Click here for more details.

data/test/test_xml.rb DELETED
@@ -1,107 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- class TestXml < Minitest::Test
6
- def setup
7
- @markdown = <<~MD
8
- Hi *there*!
9
-
10
- 1. I am a numeric list.
11
- 2. I continue the list.
12
- * Suddenly, an unordered list!
13
- * What fun!
14
-
15
- Okay, _enough_.
16
-
17
- | a | b |
18
- | --- | --- |
19
- | c | d |
20
- MD
21
- end
22
-
23
- def render_doc(doc)
24
- CommonMarker.render_doc(doc, :DEFAULT, [:table])
25
- end
26
-
27
- def test_to_xml
28
- compare = render_doc(@markdown).to_xml(:SOURCEPOS)
29
-
30
- assert_equal <<~XML, compare
31
- <?xml version="1.0" encoding="UTF-8"?>
32
- <!DOCTYPE document SYSTEM "CommonMark.dtd">
33
- <document sourcepos="1:1-12:13" xmlns="http://commonmark.org/xml/1.0">
34
- <paragraph sourcepos="1:1-1:11">
35
- <text sourcepos="1:1-1:3" xml:space="preserve">Hi </text>
36
- <emph sourcepos="1:4-1:10">
37
- <text sourcepos="1:5-1:9" xml:space="preserve">there</text>
38
- </emph>
39
- <text sourcepos="1:11-1:11" xml:space="preserve">!</text>
40
- </paragraph>
41
- <list sourcepos="3:1-4:23" type="ordered" start="1" delim="period" tight="true">
42
- <item sourcepos="3:1-3:23">
43
- <paragraph sourcepos="3:4-3:23">
44
- <text sourcepos="3:4-3:23" xml:space="preserve">I am a numeric list.</text>
45
- </paragraph>
46
- </item>
47
- <item sourcepos="4:1-4:23">
48
- <paragraph sourcepos="4:4-4:23">
49
- <text sourcepos="4:4-4:23" xml:space="preserve">I continue the list.</text>
50
- </paragraph>
51
- </item>
52
- </list>
53
- <list sourcepos="5:1-7:0" type="bullet" tight="true">
54
- <item sourcepos="5:1-5:30">
55
- <paragraph sourcepos="5:3-5:30">
56
- <text sourcepos="5:3-5:30" xml:space="preserve">Suddenly, an unordered list!</text>
57
- </paragraph>
58
- </item>
59
- <item sourcepos="6:1-7:0">
60
- <paragraph sourcepos="6:3-6:11">
61
- <text sourcepos="6:3-6:11" xml:space="preserve">What fun!</text>
62
- </paragraph>
63
- </item>
64
- </list>
65
- <paragraph sourcepos="8:1-8:15">
66
- <text sourcepos="8:1-8:6" xml:space="preserve">Okay, </text>
67
- <emph sourcepos="8:7-8:14">
68
- <text sourcepos="8:8-8:13" xml:space="preserve">enough</text>
69
- </emph>
70
- <text sourcepos="8:15-8:15" xml:space="preserve">.</text>
71
- </paragraph>
72
- <table sourcepos="10:1-12:13">
73
- <table_header sourcepos="10:1-10:13">
74
- <table_cell sourcepos="10:2-10:6">
75
- <text sourcepos="10:3-10:3" xml:space="preserve">a</text>
76
- </table_cell>
77
- <table_cell sourcepos="10:8-10:12">
78
- <text sourcepos="10:9-10:9" xml:space="preserve">b</text>
79
- </table_cell>
80
- </table_header>
81
- <table_row sourcepos="12:1-12:13">
82
- <table_cell sourcepos="12:2-12:6">
83
- <text sourcepos="12:3-12:3" xml:space="preserve">c</text>
84
- </table_cell>
85
- <table_cell sourcepos="12:8-12:12">
86
- <text sourcepos="12:9-12:9" xml:space="preserve">d</text>
87
- </table_cell>
88
- </table_row>
89
- </table>
90
- </document>
91
- XML
92
- end
93
-
94
- def test_to_xml_with_quotes
95
- compare = render_doc('"quotes" should be escaped').to_xml(:DEFAULT)
96
-
97
- assert_equal <<~XML, compare
98
- <?xml version="1.0" encoding="UTF-8"?>
99
- <!DOCTYPE document SYSTEM "CommonMark.dtd">
100
- <document xmlns="http://commonmark.org/xml/1.0">
101
- <paragraph>
102
- <text xml:space="preserve">&quot;quotes&quot; should be escaped</text>
103
- </paragraph>
104
- </document>
105
- XML
106
- end
107
- end