Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 597afca

Browse files
committed
Differentiate warnings when cleaning vs parsing blocks (felix-hilden#136)
1 parent 1754196 commit 597afca

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

docs/src/reference.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ All warning subtypes below are in the ``codeautolink.*`` namespace
146146
and can be ignored with configuring ``suppress_warnings``.
147147

148148
- ``invalid_argument``: issued when a directive is used incorrectly
149-
- ``parse_block``: issued when parsing a code block fails
149+
- ``clean_block``: issued when cleaning a block fails with a ``SyntaxError``
150+
- ``parse_block``: issued when parsing a block fails with a ``SyntaxError``
150151
- ``import_star``: issued when a library cannot be imported to determine
151152
the names that an ``import *`` would introduce
152153
- ``match_block``: issued when a block cannot be matched

docs/src/release_notes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ These release notes are based on
88
sphinx-codeautolink adheres to
99
`Semantic Versioning <https://semver.org>`_.
1010

11+
Unreleased
12+
----------
13+
- Differentiate warning types of block cleaning and parsing (:issue:`136`)
14+
1115
0.14.1 (2023-01-30)
1216
-------------------
1317
- Fix added debug info on failed resolving crashing the build (:issue:`134`)

src/sphinx_codeautolink/extension/block.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,9 @@ def parse_source(
199199
try:
200200
source, clean_source = transformer(source)
201201
except SyntaxError as e:
202-
show_source = self._format_source_for_error(source, prefaces)
203-
msg = self._parsing_error_msg(e, language, show_source)
202+
msg = self._parsing_error_msg(e, language, source)
204203
logger.warning(
205-
msg, type=warn_type, subtype="parse_block", location=node
204+
msg, type=warn_type, subtype="clean_block", location=node
206205
)
207206
return
208207
else:

0 commit comments

Comments
 (0)