@@ -66,7 +66,16 @@ def test_reference_explicit_with_markdown_text():
6666 """Check explicit references with Markdown formatting."""
6767 run_references_test (
6868 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`][]." ,
7079 output = '<p>This <a href="foo.html#Foo"><code>Foo</code></a>.</p>' ,
7180 )
7281
@@ -121,18 +130,27 @@ def test_missing_reference_with_markdown_text():
121130def test_missing_reference_with_markdown_id ():
122131 """Check unmapped explicit references with Markdown in the identifier."""
123132 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 *" ],
128137 )
129138
130139
131140def test_missing_reference_with_markdown_implicit ():
132141 """Check that implicit references are not fixed when the identifier is not the exact one."""
133142 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>" ,
138156 )
0 commit comments