5
5
6
6
7
7
IGNORE_CASES = {
8
- 'setext_headings_02 ' , # we only allow one line title
9
- 'setext_headings_15 ' ,
10
-
11
- 'setext_headings_03 ' , # must start with 2 = or -
12
- 'setext_headings_07 ' , # ignore
13
- 'setext_headings_13 ' , # ignore
14
-
15
- 'html_blocks_39 ' , # ignore
16
- 'link_reference_definitions_19 ' , # weird rule
17
-
18
- 'block_quotes_08 ' , # we treat it different
19
-
20
- 'list_items_05 ' , # I don't agree
21
- 'list_items_24 ' ,
22
- 'list_items_28 ' ,
23
- 'list_items_39 ' , # no lazy
24
- 'list_items_40 ' ,
25
- 'list_items_41 ' ,
26
-
27
- 'lists_07 ' , # we use simple way to detect tight list
28
- 'lists_16 ' ,
29
- 'lists_17 ' ,
30
- 'lists_18 ' ,
31
- 'lists_19 ' ,
32
-
33
- 'block_quotes_05 ' , # we don't allow lazy continuation
34
- 'block_quotes_06 ' ,
35
- 'block_quotes_11 ' ,
36
- 'block_quotes_20 ' ,
37
- 'block_quotes_23 ' ,
38
- 'block_quotes_24 ' , # this test case shows why lazy is not good
39
-
40
- 'code_spans_09 ' , # code has no priority
41
- 'code_spans_10 ' ,
42
-
43
- 'entity_and_numeric_character_references_04 ' , # &entity is allowed
44
- 'entity_and_numeric_character_references_05 ' ,
45
-
46
- 'links_31 ' , # different behavior
47
- 'links_37 ' ,
48
- 'links_38 ' , # code has no priority
49
- 'links_39 ' ,
50
- 'links_45 ' , # different behavior
51
- 'links_46 ' ,
52
- 'links_49 ' ,
53
- 'links_50 ' , # code has no priority
54
- 'links_51 ' , # different behavior
55
- 'links_64 ' , # allow empty key
56
- 'links_65 ' ,
57
-
58
- 'images_02 ' , # we just keep everything as raw
59
- 'images_03 ' ,
60
- 'images_04 ' ,
61
- 'images_05 ' ,
62
- 'images_06 ' ,
63
- 'images_14 ' ,
64
- 'images_18 ' ,
65
-
66
- 'autolinks_02 ' , # don't understand
8
+ 'setext_headings_002 ' , # we only allow one line title
9
+ 'setext_headings_015 ' ,
10
+
11
+ 'setext_headings_003 ' , # must start with 2 = or -
12
+ 'setext_headings_007 ' , # ignore
13
+ 'setext_headings_013 ' , # ignore
14
+
15
+ 'html_blocks_039 ' , # ignore
16
+ 'link_reference_definitions_019 ' , # weird rule
17
+
18
+ 'block_quotes_008 ' , # we treat it different
19
+
20
+ 'list_items_005 ' , # I don't agree
21
+ 'list_items_024 ' ,
22
+ 'list_items_028 ' ,
23
+ 'list_items_039 ' , # no lazy
24
+ 'list_items_040 ' ,
25
+ 'list_items_041 ' ,
26
+
27
+ 'lists_007 ' , # we use simple way to detect tight list
28
+ 'lists_016 ' ,
29
+ 'lists_017 ' ,
30
+ 'lists_018 ' ,
31
+ 'lists_019 ' ,
32
+
33
+ 'block_quotes_005 ' , # we don't allow lazy continuation
34
+ 'block_quotes_006 ' ,
35
+ 'block_quotes_011 ' ,
36
+ 'block_quotes_020 ' ,
37
+ 'block_quotes_023 ' ,
38
+ 'block_quotes_024 ' , # this test case shows why lazy is not good
39
+
40
+ 'code_spans_009 ' , # code has no priority
41
+ 'code_spans_010 ' ,
42
+
43
+ 'entity_and_numeric_character_references_004 ' , # &entity is allowed
44
+ 'entity_and_numeric_character_references_005 ' ,
45
+
46
+ 'links_031 ' , # different behavior
47
+ 'links_037 ' ,
48
+ 'links_038 ' , # code has no priority
49
+ 'links_039 ' ,
50
+ 'links_045 ' , # different behavior
51
+ 'links_046 ' ,
52
+ 'links_049 ' ,
53
+ 'links_050 ' , # code has no priority
54
+ 'links_051 ' , # different behavior
55
+ 'links_064 ' , # allow empty key
56
+ 'links_065 ' ,
57
+
58
+ 'images_002 ' , # we just keep everything as raw
59
+ 'images_003 ' ,
60
+ 'images_004 ' ,
61
+ 'images_005 ' ,
62
+ 'images_006 ' ,
63
+ 'images_014 ' ,
64
+ 'images_018 ' ,
65
+
66
+ 'autolinks_002 ' , # don't understand
67
67
}
68
68
INSANE_CASES = {
69
- 'fenced_code_blocks_13 ' ,
70
- 'fenced_code_blocks_15 ' ,
71
- 'list_items_33 ' ,
72
- 'list_items_38 ' ,
73
-
74
- 'link_reference_definitions_02 ' , # only allow one line definition
75
- 'link_reference_definitions_03 ' ,
76
- 'link_reference_definitions_04 ' ,
77
- 'link_reference_definitions_05 ' ,
78
- 'link_reference_definitions_07 ' ,
79
- 'link_reference_definitions_21 ' ,
80
-
81
- 'links_25 ' ,
82
- 'links_32 ' ,
83
- 'links_33 ' ,
84
- 'links_41 ' ,
85
- 'links_60 ' ,
86
- 'links_82 ' ,
87
- 'links_84 ' ,
69
+ 'fenced_code_blocks_013 ' ,
70
+ 'fenced_code_blocks_015 ' ,
71
+ 'list_items_033 ' ,
72
+ 'list_items_038 ' ,
73
+
74
+ 'link_reference_definitions_002 ' , # only allow one line definition
75
+ 'link_reference_definitions_003 ' ,
76
+ 'link_reference_definitions_004 ' ,
77
+ 'link_reference_definitions_005 ' ,
78
+ 'link_reference_definitions_007 ' ,
79
+ 'link_reference_definitions_021 ' ,
80
+
81
+ 'links_025 ' ,
82
+ 'links_032 ' ,
83
+ 'links_033 ' ,
84
+ 'links_041 ' ,
85
+ 'links_060 ' ,
86
+ 'links_082 ' ,
87
+ 'links_084 ' ,
88
88
}
89
89
90
90
DIFFERENCES = {
91
- 'tabs_05 ' : lambda s : s .replace ('<code> ' , '<code>' ),
92
- 'tabs_06 ' : lambda s : s .replace ('<code> ' , '<code>' ),
93
- 'tabs_07 ' : lambda s : s .replace ('<code> ' , '<code>' ),
91
+ 'tabs_005 ' : lambda s : s .replace ('<code> ' , '<code>' ),
92
+ 'tabs_006 ' : lambda s : s .replace ('<code> ' , '<code>' ),
93
+ 'tabs_007 ' : lambda s : s .replace ('<code> ' , '<code>' ),
94
94
}
95
95
96
96
97
- class TestCommonMark (TestCase ):
98
- pass
99
-
100
-
101
97
def assert_spec (self , n , text , html ):
102
98
print (text )
103
99
result = mistune .html (text )
@@ -120,16 +116,20 @@ def assert_spec(self, n, text, html):
120
116
'paragraphs' , 'blank_lines' ,
121
117
'block_quotes' , 'list_items' , 'lists' ,
122
118
'backslash' , 'entity' , 'code_spans' ,
123
- # emphasis, links
124
- 'images' , 'autolinks' , 'raw_html' ,
119
+ # emphasis
120
+ 'links' , ' images' , 'autolinks' , 'raw_html' ,
125
121
'hard_line' , 'soft_line' , 'textual' ,
126
122
}
127
123
128
124
129
125
def ignore (n ):
130
- if not n .startswith ('links ' ):
126
+ if n .startswith ('emphasis ' ):
131
127
return True
132
128
return (n in IGNORE_CASES ) or (n in INSANE_CASES )
133
129
134
130
135
- fixtures .load_cases (TestCase , assert_spec , 'commonmark.txt' , ignore )
131
+ class TestCommonMark (TestCase ):
132
+ pass
133
+
134
+
135
+ fixtures .load_cases (TestCommonMark , assert_spec , 'commonmark.txt' , ignore )
0 commit comments