@@ -66,7 +66,16 @@ def test_reference_explicit_with_markdown_text():
66
66
"""Check explicit references with Markdown formatting."""
67
67
run_references_test (
68
68
url_map = {"Foo" : "foo.html#Foo" },
69
- source = "This [`Foo`][Foo]." ,
69
+ source = "This [**Foo**][Foo]." ,
70
+ output = '<p>This <a href="foo.html#Foo"><strong>Foo</strong></a>.</p>' ,
71
+ )
72
+
73
+
74
+ def test_reference_implicit_with_code ():
75
+ """Check implicit references (identifier only, wrapped in backticks)."""
76
+ run_references_test (
77
+ url_map = {"Foo" : "foo.html#Foo" },
78
+ source = "This [`Foo`][]." ,
70
79
output = '<p>This <a href="foo.html#Foo"><code>Foo</code></a>.</p>' ,
71
80
)
72
81
@@ -121,18 +130,27 @@ def test_missing_reference_with_markdown_text():
121
130
def test_missing_reference_with_markdown_id ():
122
131
"""Check unmapped explicit references with Markdown in the identifier."""
123
132
run_references_test (
124
- url_map = {"NotFoo" : "foo.html#NotFoo" },
125
- source = "[Foo][*oh *]" ,
126
- output = "<p>[Foo][*oh *]</p>" ,
127
- unmapped = ["*oh *" ],
133
+ url_map = {"Foo" : "foo.html#Foo" , " NotFoo" : "foo.html#NotFoo" },
134
+ source = "[Foo][*NotFoo *]" ,
135
+ output = "<p>[Foo][*NotFoo *]</p>" ,
136
+ unmapped = ["*NotFoo *" ],
128
137
)
129
138
130
139
131
140
def test_missing_reference_with_markdown_implicit ():
132
141
"""Check that implicit references are not fixed when the identifier is not the exact one."""
133
142
run_references_test (
134
- url_map = {"Foo" : "foo.html#Foo" },
135
- source = "[`Foo`][]" ,
136
- output = "<p>[<code>Foo</code>][]</p>" ,
137
- unmapped = [],
143
+ url_map = {"Foo-bar" : "foo.html#Foo-bar" },
144
+ source = "[*Foo-bar*][] and [`Foo`-bar][]" ,
145
+ output = "<p>[<em>Foo-bar</em>][*Foo-bar*] and [<code>Foo</code>-bar][]</p>" ,
146
+ unmapped = ["*Foo-bar*" ],
147
+ )
148
+
149
+
150
+ def test_ignore_reference_with_special_char ():
151
+ """Check that references are not considered if there is a space character inside."""
152
+ run_references_test (
153
+ url_map = {"a b" : "foo.html#Foo" },
154
+ source = "This [*a b*][]." ,
155
+ output = "<p>This [<em>a b</em>][].</p>" ,
138
156
)
0 commit comments