summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2022-12-02 15:31:57 +0000
committermilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2022-12-02 15:31:57 +0000
commitbf090dd8f51779456353565f80cf1d72597874be (patch)
tree79fada453352ec55b3627d19c7562a60f3f9fd61
parentdb56f87eb1f84452a04d3722e2cf80acefb9afc6 (diff)
downloaddocutils-bf090dd8f51779456353565f80cf1d72597874be.tar.gz
Only extempt sample *.txt files from "trailing whitespace" git pre-commit check.
Mask trailing whitespace in test_latex2e.py. Replace the generic extemption for '*.txt' with '*pseudoxml.txt'. (Expected output from the "pseudoxml" writer which has trailing whitespace by design.) Also simplify rule after ``prest`` moved to the attic. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9300 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rw-r--r--.pre-commit-config.yaml4
-rwxr-xr-xdocutils/test/test_writers/test_latex2e.py228
2 files changed, 116 insertions, 116 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 586407fb4..ca68b0bc7 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -7,9 +7,9 @@ repos:
hooks:
- id: check-added-large-files
- id: trailing-whitespace
- exclude: ^(sandbox|prest)|(.el|.svg|.tex|.txt|test_manpage.py|test_latex2e.py)$
+ exclude: ^sandbox|(.el|.svg|.tex|pseudoxml.txt|test_manpage.py)$
- id: end-of-file-fixer
- exclude: ^(sandbox|prest)|(.svg)|docutils/test/data/utf-16-le-sig.txt$
+ exclude: ^sandbox|(.svg)|docutils/test/data/utf-16-le-sig.txt$
- repo: https://github.com/pycqa/flake8
rev: 3.8.4 # pick a git hash / tag to point to
diff --git a/docutils/test/test_writers/test_latex2e.py b/docutils/test/test_writers/test_latex2e.py
index b02905c68..7356eb143 100755
--- a/docutils/test/test_writers/test_latex2e.py
+++ b/docutils/test/test_writers/test_latex2e.py
@@ -27,9 +27,9 @@ ham = os.path.relpath(DATA_ROOT/'ham.tex').replace('\\', '/')
class WriterPublishTestCase(unittest.TestCase):
-
+
maxDiff = None
-
+
def test_publish(self):
writer_name = 'latex'
settings = {
@@ -720,22 +720,22 @@ totest['table_styles'] = [
| 3 | 4 |
+-----+-----+
""",
-head_table + r"""
-\setlength{\DUtablewidth}{\linewidth}%
-\begin{longtable*}{p{0.075\DUtablewidth}p{0.075\DUtablewidth}}
+head_table + """
+\\setlength{\\DUtablewidth}{\\linewidth}%
+\\begin{longtable*}{p{0.075\\DUtablewidth}p{0.075\\DUtablewidth}}
1
- &
+ & \n\
2
- \\
+ \\\\
3
- &
+ & \n\
4
- \\
-\end{longtable*}
+ \\\\
+\\end{longtable*}
-\end{document}
+\\end{document}
"""],
["""\
.. table::
@@ -745,19 +745,19 @@ head_table + r"""
| 1 |2|
+-----+-+
""",
-head_booktabs + r"""
-\setlength{\DUtablewidth}{\linewidth}%
-\begin{longtable*}{p{0.075\DUtablewidth}p{0.028\DUtablewidth}}
-\toprule
+head_booktabs + """
+\\setlength{\\DUtablewidth}{\\linewidth}%
+\\begin{longtable*}{p{0.075\\DUtablewidth}p{0.028\\DUtablewidth}}
+\\toprule
1
- &
+ & \n\
2
- \\
-\bottomrule
-\end{longtable*}
+ \\\\
+\\bottomrule
+\\end{longtable*}
-\end{document}
+\\end{document}
"""],
["""\
.. table::
@@ -801,19 +801,19 @@ head_table + r"""
| 1 | 2 |
+-----+-----+
""",
-head_table + r"""
-\setlength{\DUtablewidth}{\linewidth}%
-\begin{longtable*}{|p{0.191\DUtablewidth}|p{0.365\DUtablewidth}|}
-\hline
+head_table + """
+\\setlength{\\DUtablewidth}{\\linewidth}%
+\\begin{longtable*}{|p{0.191\\DUtablewidth}|p{0.365\\DUtablewidth}|}
+\\hline
1
- &
+ & \n\
2
- \\
-\hline
-\end{longtable*}
+ \\\\
+\\hline
+\\end{longtable*}
-\end{document}
+\\end{document}
"""],
]
@@ -829,22 +829,22 @@ totest_table_style_booktabs['table_styles'] = [
| 3 | 4 |
+-----+-----+
""",
-head_table + r"""
-\setlength{\DUtablewidth}{\linewidth}%
-\begin{longtable*}{p{0.075\DUtablewidth}p{0.075\DUtablewidth}}
+head_table + """
+\\setlength{\\DUtablewidth}{\\linewidth}%
+\\begin{longtable*}{p{0.075\\DUtablewidth}p{0.075\\DUtablewidth}}
1
- &
+ & \n\
2
- \\
+ \\\\
3
- &
+ & \n\
4
- \\
-\end{longtable*}
+ \\\\
+\\end{longtable*}
-\end{document}
+\\end{document}
"""],
["""\
.. table::
@@ -871,19 +871,19 @@ head_booktabs + r"""
| 1 | 2 |
+-----+-----+
""",
-head_booktabs + r"""
-\setlength{\DUtablewidth}{\linewidth}%
-\begin{longtable*}{p{0.191\DUtablewidth}p{0.365\DUtablewidth}}
-\toprule
+head_booktabs + """
+\\setlength{\\DUtablewidth}{\\linewidth}%
+\\begin{longtable*}{p{0.191\\DUtablewidth}p{0.365\\DUtablewidth}}
+\\toprule
1
- &
+ & \n\
2
- \\
-\bottomrule
-\end{longtable*}
+ \\\\
+\\bottomrule
+\\end{longtable*}
-\end{document}
+\\end{document}
"""],
]
totest_table_style_auto['table_styles'] = [
@@ -931,19 +931,19 @@ head_booktabs + r"""
| 1 | 2 |
+-----+-----+
""",
-head_table + r"""
-\setlength{\DUtablewidth}{\linewidth}%
-\begin{longtable*}{|p{0.191\DUtablewidth}|p{0.365\DUtablewidth}|}
-\hline
+head_table + """
+\\setlength{\\DUtablewidth}{\\linewidth}%
+\\begin{longtable*}{|p{0.191\\DUtablewidth}|p{0.365\\DUtablewidth}|}
+\\hline
1
- &
+ & \n\
2
- \\
-\hline
-\end{longtable*}
+ \\\\
+\\hline
+\\end{longtable*}
-\end{document}
+\\end{document}
"""],
]
@@ -957,19 +957,19 @@ totest['table_align'] = [
| 1 | 2 |
+-----+-----+
""",
-head_table + r"""
-\setlength{\DUtablewidth}{\linewidth}%
-\begin{longtable*}[r]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|}
-\hline
+head_table + """
+\\setlength{\\DUtablewidth}{\\linewidth}%
+\\begin{longtable*}[r]{|p{0.075\\DUtablewidth}|p{0.075\\DUtablewidth}|}
+\\hline
1
- &
+ & \n\
2
- \\
-\hline
-\end{longtable*}
+ \\\\
+\\hline
+\\end{longtable*}
-\end{document}
+\\end{document}
"""],
]
@@ -981,33 +981,33 @@ Title
entry value1
===== ======
""",
-head_table + r"""
-\setlength{\DUtablewidth}{\linewidth}%
-\begin{longtable*}{|p{0.075\DUtablewidth}|p{0.086\DUtablewidth}|}
-\hline
-\textbf{%
+head_table + """
+\\setlength{\\DUtablewidth}{\\linewidth}%
+\\begin{longtable*}{|p{0.075\\DUtablewidth}|p{0.086\\DUtablewidth}|}
+\\hline
+\\textbf{%
Title
-} & \\
-\hline
-\endfirsthead
-\hline
-\textbf{%
+} & \\\\
+\\hline
+\\endfirsthead
+\\hline
+\\textbf{%
Title
-} & \\
-\hline
-\endhead
-\multicolumn{2}{p{0.16\DUtablewidth}}{\raggedleft\ldots continued on next page}\\
-\endfoot
-\endlastfoot
+} & \\\\
+\\hline
+\\endhead
+\\multicolumn{2}{p{0.16\\DUtablewidth}}{\\raggedleft\\ldots continued on next page}\\\\
+\\endfoot
+\\endlastfoot
entry
- &
+ & \n\
value1
- \\
-\hline
-\end{longtable*}
+ \\\\
+\\hline
+\\end{longtable*}
-\end{document}
+\\end{document}
"""],
["""\
+----+----+
@@ -1016,21 +1016,21 @@ value1
| |
+---------+
""",
-head_table + r"""
-\setlength{\DUtablewidth}{\linewidth}%
-\begin{longtable*}{|p{0.063\DUtablewidth}|p{0.063\DUtablewidth}|}
-\hline
+head_table + """
+\\setlength{\\DUtablewidth}{\\linewidth}%
+\\begin{longtable*}{|p{0.063\\DUtablewidth}|p{0.063\\DUtablewidth}|}
+\\hline
c3
- &
+ & \n\
c4
- \\
-\hline
-\multicolumn{2}{|p{0.13\DUtablewidth}|}{} \\
-\hline
-\end{longtable*}
+ \\\\
+\\hline
+\\multicolumn{2}{|p{0.13\\DUtablewidth}|}{} \\\\
+\\hline
+\\end{longtable*}
-\end{document}
+\\end{document}
"""],
]
@@ -1062,27 +1062,27 @@ head_template.substitute(
\fi
"""
)
-) + r"""
-\begin{DUclass}{my-class}
-\setlength{\DUtablewidth}{\linewidth}%
-\begin{longtable*}{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|}
-\hline
+) + """
+\\begin{DUclass}{my-class}
+\\setlength{\\DUtablewidth}{\\linewidth}%
+\\begin{longtable*}{|p{0.075\\DUtablewidth}|p{0.075\\DUtablewidth}|}
+\\hline
1
- &
+ & \n\
2
- \\
-\hline
+ \\\\
+\\hline
3
- &
+ & \n\
4
- \\
-\hline
-\end{longtable*}
-\end{DUclass}
+ \\\\
+\\hline
+\\end{longtable*}
+\\end{DUclass}
-\end{document}
+\\end{document}
"""],
]
@@ -1154,11 +1154,11 @@ same paragraph.
[r""".. compound::
Compound paragraph
-
+
.. raw:: LaTeX
-
+
raw LaTeX block
-
+
compound paragraph continuation.
""",
head_template.substitute(