From e7e92d31544b9e6e3b1ecf0e203b95f5a454d525 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sun, 13 Jun 2021 17:29:52 +0900 Subject: [PATCH 1/3] Update CHANGES for PR #9313 --- CHANGES | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index b5011d71847..6710a63a5a3 100644 --- a/CHANGES +++ b/CHANGES @@ -16,7 +16,7 @@ Features added Bugs fixed ---------- -* 9313: LaTeX: complex table with merged cells broken since 4.0 +* #9313: LaTeX: complex table with merged cells broken since 4.0 Testing -------- From 7b8b3de9d1c8ee042929d0b3b5d873e58ca29415 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sun, 13 Jun 2021 22:22:15 +0900 Subject: [PATCH 2/3] Fix #9330: versionchanged causes error during pdf build The versionchanged directive breaks doctree if its contents start with non-paragraph element (ex. lists, tables, and so on). It causes build error in LaTeX. This inserts a paragraph if the first child of the contents is not a paragraph not to break doctree. --- CHANGES | 2 ++ sphinx/domains/changeset.py | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 6710a63a5a3..9d773318793 100644 --- a/CHANGES +++ b/CHANGES @@ -16,6 +16,8 @@ Features added Bugs fixed ---------- +* #9330: changeset domain: :rst:dir:`versionchanged` with contents being a list + will cause error during pdf build * #9313: LaTeX: complex table with merged cells broken since 4.0 Testing diff --git a/sphinx/domains/changeset.py b/sphinx/domains/changeset.py index 1b31e0248a2..81c81c2882c 100644 --- a/sphinx/domains/changeset.py +++ b/sphinx/domains/changeset.py @@ -74,8 +74,10 @@ def run(self) -> List[Node]: if self.content: self.state.nested_parse(self.content, self.content_offset, node) classes = ['versionmodified', versionlabel_classes[self.name]] - if len(node): - if isinstance(node[0], nodes.paragraph) and node[0].rawsource: + if len(node) > 0 and isinstance(node[0], nodes.paragraph): + # the contents start with a paragraph + if node[0].rawsource: + # make the first paragraph translatable content = nodes.inline(node[0].rawsource, translatable=True) content.source = node[0].source content.line = node[0].line @@ -84,10 +86,16 @@ def run(self) -> List[Node]: para = cast(nodes.paragraph, node[0]) para.insert(0, nodes.inline('', '%s: ' % text, classes=classes)) + elif len(node) > 0: + # the contents do not starts with a paragraph + para = nodes.paragraph('', '', + nodes.inline('', '%s: ' % text, classes=classes), + translatable=False) + node.insert(0, para) else: + # the contents are empty para = nodes.paragraph('', '', - nodes.inline('', '%s.' % text, - classes=classes), + nodes.inline('', '%s.' % text, classes=classes), translatable=False) node.append(para) From ef9b55c9616b957bda1431e331bb17a2edab36e2 Mon Sep 17 00:00:00 2001 From: jfbu Date: Sun, 13 Jun 2021 18:34:06 +0200 Subject: [PATCH 3/3] Fix #9305 LaTeX: backslash in sphinxupquote error with Japanese --- CHANGES | 2 ++ sphinx/texinputs/sphinxlatexliterals.sty | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 9d773318793..9a7f854e34a 100644 --- a/CHANGES +++ b/CHANGES @@ -19,6 +19,8 @@ Bugs fixed * #9330: changeset domain: :rst:dir:`versionchanged` with contents being a list will cause error during pdf build * #9313: LaTeX: complex table with merged cells broken since 4.0 +* #9305: LaTeX: backslash may cause Improper discretionary list pdf build error + with Japanese engines Testing -------- diff --git a/sphinx/texinputs/sphinxlatexliterals.sty b/sphinx/texinputs/sphinxlatexliterals.sty index 4d0312fc653..d2ba89ea73f 100644 --- a/sphinx/texinputs/sphinxlatexliterals.sty +++ b/sphinx/texinputs/sphinxlatexliterals.sty @@ -765,7 +765,8 @@ % break at . , ; ? ! / \sphinxbreaksviaactive % break also at \ - \let\sphinx@textbackslash\textbackslash + \setbox8=\hbox{\textbackslash}% + \def\sphinx@textbackslash{\copy8}% \let\textbackslash\sphinxtextbackslash % by default, no continuation symbol on next line but may be added \let\sphinxafterbreak\sphinxafterbreakofinlineliteral