mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch '6.1.x'
# Conflicts: # CHANGES # sphinx/__init__.py
This commit is contained in:
commit
f0dbe8180d
9
CHANGES
9
CHANGES
@ -19,6 +19,15 @@ Bugs fixed
|
|||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
Release 6.1.1 (released Jan 05, 2023)
|
||||||
|
=====================================
|
||||||
|
|
||||||
|
Bugs fixed
|
||||||
|
----------
|
||||||
|
|
||||||
|
* #11091: Fix ``util.nodes.apply_source_workaround`` for ``literal_block`` nodes
|
||||||
|
with no source information in the node or the node's parents.
|
||||||
|
|
||||||
Release 6.1.0 (released Jan 05, 2023)
|
Release 6.1.0 (released Jan 05, 2023)
|
||||||
=====================================
|
=====================================
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import contextlib
|
||||||
import re
|
import re
|
||||||
import unicodedata
|
import unicodedata
|
||||||
from typing import TYPE_CHECKING, Any, Callable, Iterable
|
from typing import TYPE_CHECKING, Any, Callable, Iterable
|
||||||
@ -152,6 +153,7 @@ def apply_source_workaround(node: Element) -> None:
|
|||||||
|
|
||||||
# workaround: literal_block under bullet list (#4913)
|
# workaround: literal_block under bullet list (#4913)
|
||||||
if isinstance(node, nodes.literal_block) and node.source is None:
|
if isinstance(node, nodes.literal_block) and node.source is None:
|
||||||
|
with contextlib.suppress(ValueError):
|
||||||
node.source = get_node_source(node)
|
node.source = get_node_source(node)
|
||||||
|
|
||||||
# workaround: recommonmark-0.2.0 doesn't set rawsource attribute
|
# workaround: recommonmark-0.2.0 doesn't set rawsource attribute
|
||||||
|
@ -11,8 +11,8 @@ from docutils.parsers import rst
|
|||||||
from docutils.utils import new_document
|
from docutils.utils import new_document
|
||||||
|
|
||||||
from sphinx.transforms import ApplySourceWorkaround
|
from sphinx.transforms import ApplySourceWorkaround
|
||||||
from sphinx.util.nodes import (NodeMatcher, clean_astext, extract_messages, make_id,
|
from sphinx.util.nodes import (NodeMatcher, apply_source_workaround, clean_astext,
|
||||||
split_explicit_title)
|
extract_messages, make_id, split_explicit_title)
|
||||||
|
|
||||||
|
|
||||||
def _transform(doctree):
|
def _transform(doctree):
|
||||||
@ -226,3 +226,23 @@ def test_make_id_sequential(app):
|
|||||||
)
|
)
|
||||||
def test_split_explicit_target(title, expected):
|
def test_split_explicit_target(title, expected):
|
||||||
assert expected == split_explicit_title(title)
|
assert expected == split_explicit_title(title)
|
||||||
|
|
||||||
|
|
||||||
|
def test_apply_source_workaround_literal_block_no_source():
|
||||||
|
"""Regression test for #11091.
|
||||||
|
|
||||||
|
Test that apply_source_workaround doesn't raise.
|
||||||
|
"""
|
||||||
|
literal_block = nodes.literal_block('', '')
|
||||||
|
list_item = nodes.list_item('', literal_block)
|
||||||
|
bullet_list = nodes.bullet_list('', list_item)
|
||||||
|
|
||||||
|
assert literal_block.source is None
|
||||||
|
assert list_item.source is None
|
||||||
|
assert bullet_list.source is None
|
||||||
|
|
||||||
|
apply_source_workaround(literal_block)
|
||||||
|
|
||||||
|
assert literal_block.source is None
|
||||||
|
assert list_item.source is None
|
||||||
|
assert bullet_list.source is None
|
||||||
|
Loading…
Reference in New Issue
Block a user