-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
626e5c5
commit d132cd2
Showing
7 changed files
with
128 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
Duplicate Reference definitions: | ||
. | ||
[a]: b | ||
[a]: c | ||
. | ||
source/path:2: (WARNING/2) Duplicate reference definition: A | ||
. | ||
|
||
Missing Reference: | ||
. | ||
[a](b) | ||
. | ||
source/path:1: (WARNING/2) Reference not found: b | ||
. | ||
|
||
Unknown role: | ||
. | ||
abc | ||
|
||
{xyz}`a` | ||
. | ||
source/path:3: (ERROR/3) Unknown interpreted text role "xyz". | ||
. | ||
|
||
Unknown directive: | ||
. | ||
|
||
```{xyz} | ||
``` | ||
. | ||
source/path:2: (ERROR/3) Unknown directive type "xyz". | ||
. | ||
|
||
Bad Front Matter: | ||
. | ||
--- | ||
a: { | ||
--- | ||
. | ||
source/path:1: (ERROR/3) Front matter block: | ||
while parsing a flow node | ||
expected the node content, but found '<stream end>' | ||
in "<unicode string>", line 1, column 5: | ||
a: { | ||
^ | ||
. | ||
|
||
Directive parsing error: | ||
. | ||
|
||
```{class} | ||
``` | ||
. | ||
source/path:2: (ERROR/3) Directive 'class': 1 argument(s) required, 0 supplied | ||
. | ||
|
||
Directive run error: | ||
. | ||
|
||
```{date} | ||
x | ||
``` | ||
. | ||
source/path:2: (ERROR/3) Invalid context: the "date" directive can only be used within a substitution definition. | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
from markdown_it.utils import read_fixture_file | ||
from myst_parser.docutils_renderer import make_document | ||
from myst_parser.main import to_docutils | ||
|
||
|
||
FIXTURE_PATH = Path(__file__).parent.joinpath("fixtures") | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"line,title,input,expected", | ||
read_fixture_file(FIXTURE_PATH.joinpath("reporter_warnings.md")), | ||
) | ||
def test_basic(line, title, input, expected): | ||
document = make_document("source/path") | ||
messages = [] | ||
|
||
def observer(msg_node): | ||
if msg_node["level"] > 1: | ||
messages.append(msg_node.astext()) | ||
|
||
document.reporter.attach_observer(observer) | ||
to_docutils(input, document=document, renderer="docutils") | ||
assert "\n".join(messages).rstrip() == expected.rstrip() |