Skip to content

Commit

Permalink
Merge branch 'release/3.4.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
chdemko committed Jan 22, 2024
2 parents 8e8327f + 0379af3 commit f857c74
Show file tree
Hide file tree
Showing 10 changed files with 213 additions and 87 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
poetry-version: [1.7.1]
pandoc-version: [3.1.9]
pandoc-version: [3.1.11.1]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -42,7 +42,7 @@ jobs:
matrix:
python-version: ['3.12']
poetry-version: [1.2.2, 1.3.2, 1.4.2, 1.5.1, 1.6.1, 1.7.1]
pandoc-version: [3.1.9]
pandoc-version: [3.1.11.1]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -68,7 +68,7 @@ jobs:
matrix:
python-version: ['3.12']
poetry-version: [1.7.1]
pandoc-version: [2.14.2, '2.15', 2.16.2, 2.17.1.1, '2.18', 2.19.2, 3.0.1, 3.1.9]
pandoc-version: [2.14.2, '2.15', 2.16.2, 2.17.1.1, '2.18', 2.19.2, 3.0.1, 3.1.11.1]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand Down Expand Up @@ -122,8 +122,8 @@ jobs:
poetry-version: 1.7.1
- name: Install dependencies
run: |
wget https://github.com/jgm/pandoc/releases/download/3.1.9/pandoc-3.1.9-1-amd64.deb
sudo dpkg -i ./pandoc-3.1.9-1-amd64.deb
wget https://github.com/jgm/pandoc/releases/download/3.1.11.1/pandoc-3.1.11.1-1-amd64.deb
sudo dpkg -i ./pandoc-3.1.11.1-1-amd64.deb
poetry install
- name: Test
env:
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ on:

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
Expand All @@ -24,13 +22,13 @@ jobs:
uses: abatilo/actions-poetry@v2
with:
poetry-version: 1.7.1
- name: Set up poetry-dynamic-versioning
run: |
poetry self add "poetry-dynamic-versioning[plugin]"
- name: Install dependencies
run: |
poetry install
poetry run pip install twine
- name: Set up poetry-dynamic-versioning
run: |
poetry self add "poetry-dynamic-versioning[plugin]"
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ $ pipx install pandoc-numbering
To upgrade to the most recent release, use

~~~shell
$ pipx install --upgrade pandoc-numbering
$ pipx upgrade pandoc-numbering
~~~

`pipx` is a script to install and run python applications in isolated environments from the Python Package Index, [PyPI]. It can be installed using instructions given [here](https://pipx.pypa.io/stable/).
Expand Down
18 changes: 17 additions & 1 deletion pandoc_numbering.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import re
import unicodedata
from functools import partial
from textwrap import dedent

from panflute import (
BlockQuote,
Expand Down Expand Up @@ -1520,7 +1521,22 @@ def finalize(doc):
doc.metadata["header-includes"] = MetaList(doc.metadata["header-includes"])

doc.metadata["header-includes"].append(
MetaInlines(RawInline(r"\usepackage{tocloft}", "tex"))
MetaInlines(
RawInline(
dedent(
r"""
\makeatletter
\@ifpackageloaded{subfig}{
\usepackage[subfigure]{tocloft}
}{
\usepackage{tocloft}
}
\makeatother
"""
),
"tex",
)
)
)
doc.metadata["header-includes"].append(
MetaInlines(RawInline(r"\usepackage{etoolbox}", "tex"))
Expand Down
134 changes: 72 additions & 62 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ optional = true
[tool.poetry.group.docs.dependencies]
myst-parser = "^2.0"
sphinx = "^7.2"
sphinx_rtd_theme = "^1.3"
sphinx_rtd_theme = "^2.0"

[tool.poetry.scripts]
pandoc-numbering = "pandoc_numbering:main"
Expand Down
42 changes: 38 additions & 4 deletions tests/test_listings_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,16 @@ def test_listing_latex(self):
r"""
---
header-includes:
- "`\\usepackage{tocloft}`{=tex}"
- |
`
\makeatletter
\@ifpackageloaded{subfig}{
\usepackage[subfigure]{tocloft}
}{
\usepackage{tocloft}
}
\makeatother
`{=tex}
- "`\\usepackage{etoolbox}`{=tex}"
- "`\\newlistof{exercise}{exercise}{List of exercises}\\renewcommand{\\cftexercisetitlefont}{\\cfttoctitlefont}\\setlength{\\cftexercisenumwidth}{\\cftfignumwidth}\\setlength{\\cftexerciseindent}{\\cftfigindent}`{=tex}"
- "`\\ifdef{\\mainmatter}{\\let\\oldmainmatter\\mainmatter\\renewcommand{\\mainmatter}[0]{\\listofexercise\\oldmainmatter}}{}`{=tex}"
Expand All @@ -178,7 +187,15 @@ def test_listing_latex(self):
listing-title: List of exercises
---
`\usepackage{tocloft}`{=tex}
`
\makeatletter
\@ifpackageloaded{subfig}{
\usepackage[subfigure]{tocloft}
}{
\usepackage{tocloft}
}
\makeatother
`{=tex}
`\usepackage{etoolbox}`{=tex}
Expand Down Expand Up @@ -260,7 +277,16 @@ def test_listing_latex_format(self):
r"""
---
header-includes:
- "`\\usepackage{tocloft}`{=tex}"
- |
`
\makeatletter
\@ifpackageloaded{subfig}{
\usepackage[subfigure]{tocloft}
}{
\usepackage{tocloft}
}
\makeatother
`{=tex}
- "`\\usepackage{etoolbox}`{=tex}"
- "`\\newlistof{exercise}{exercise}{List of exercises}\\renewcommand{\\cftexercisetitlefont}{\\cfttoctitlefont}\\setlength{\\cftexercisenumwidth}{\\cftfignumwidth}\\setlength{\\cftexerciseindent}{\\cftfigindent}`{=tex}"
- "`\\ifdef{\\mainmatter}{\\let\\oldmainmatter\\mainmatter\\renewcommand{\\mainmatter}[0]{\\listofexercise\\oldmainmatter}}{}`{=tex}"
Expand All @@ -276,7 +302,15 @@ def test_listing_latex_format(self):
toccolor: blue
---
`\usepackage{tocloft}`{=tex}
`
\makeatletter
\@ifpackageloaded{subfig}{
\usepackage[subfigure]{tocloft}
}{
\usepackage{tocloft}
}
\makeatother
`{=tex}
`\usepackage{etoolbox}`{=tex}
Expand Down
21 changes: 19 additions & 2 deletions tests/test_para.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,29 @@ def test_numbering_latex(self):
r"""
---
header-includes:
- "`\\usepackage{tocloft}`{=tex}"
- |
`
\makeatletter
\@ifpackageloaded{subfig}{
\usepackage[subfigure]{tocloft}
}{
\usepackage{tocloft}
}
\makeatother
`{=tex}
- "`\\usepackage{etoolbox}`{=tex}"
- "`\\ifdef{\\mainmatter}{\\let\\oldmainmatter\\mainmatter\\renewcommand{\\mainmatter}[0]{\\oldmainmatter}}{}`{=tex}"
---
`\usepackage{tocloft}`{=tex}
`
\makeatletter
\@ifpackageloaded{subfig}{
\usepackage[subfigure]{tocloft}
}{
\usepackage{tocloft}
}
\makeatother
`{=tex}
`\usepackage{etoolbox}`{=tex}
Expand Down
21 changes: 19 additions & 2 deletions tests/test_referencing.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,29 @@ def test_referencing_latex(self):
r"""
---
header-includes:
- "`\\usepackage{tocloft}`{=tex}"
- |
`
\makeatletter
\@ifpackageloaded{subfig}{
\usepackage[subfigure]{tocloft}
}{
\usepackage{tocloft}
}
\makeatother
`{=tex}
- "`\\usepackage{etoolbox}`{=tex}"
- "`\\ifdef{\\mainmatter}{\\let\\oldmainmatter\\mainmatter\\renewcommand{\\mainmatter}[0]{\\oldmainmatter}}{}`{=tex}"
---
`\usepackage{tocloft}`{=tex}
`
\makeatletter
\@ifpackageloaded{subfig}{
\usepackage[subfigure]{tocloft}
}{
\usepackage{tocloft}
}
\makeatother
`{=tex}
`\usepackage{etoolbox}`{=tex}
Expand Down
42 changes: 38 additions & 4 deletions tests/test_referencing_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,16 @@ def test_referencing_link_latex(self):
r"""
---
header-includes:
- "`\\usepackage{tocloft}`{=tex}"
- |
`
\makeatletter
\@ifpackageloaded{subfig}{
\usepackage[subfigure]{tocloft}
}{
\usepackage{tocloft}
}
\makeatother
`{=tex}
- "`\\usepackage{etoolbox}`{=tex}"
- "`\\ifdef{\\mainmatter}{\\let\\oldmainmatter\\mainmatter\\renewcommand{\\mainmatter}[0]{\\oldmainmatter}}{}`{=tex}"
pandoc-numbering:
Expand All @@ -94,7 +103,15 @@ def test_referencing_link_latex(self):
format-link-title: "**%D %d %T %t %g %s %n %p**"
---
`\usepackage{tocloft}`{=tex}
`
\makeatletter
\@ifpackageloaded{subfig}{
\usepackage[subfigure]{tocloft}
}{
\usepackage{tocloft}
}
\makeatother
`{=tex}
`\usepackage{etoolbox}`{=tex}
Expand Down Expand Up @@ -192,7 +209,16 @@ def test_referencing_caption_latex(self):
r"""
---
header-includes:
- "`\\usepackage{tocloft}`{=tex}"
- |
`
\makeatletter
\@ifpackageloaded{subfig}{
\usepackage[subfigure]{tocloft}
}{
\usepackage{tocloft}
}
\makeatother
`{=tex}
- "`\\usepackage{etoolbox}`{=tex}"
- "`\\ifdef{\\mainmatter}{\\let\\oldmainmatter\\mainmatter\\renewcommand{\\mainmatter}[0]{\\oldmainmatter}}{}`{=tex}"
pandoc-numbering:
Expand All @@ -204,7 +230,15 @@ def test_referencing_caption_latex(self):
format-caption-title: "%D %d %T %t %g %s %n %c %p"
---
`\usepackage{tocloft}`{=tex}
`
\makeatletter
\@ifpackageloaded{subfig}{
\usepackage[subfigure]{tocloft}
}{
\usepackage{tocloft}
}
\makeatother
`{=tex}
`\usepackage{etoolbox}`{=tex}
Expand Down

0 comments on commit f857c74

Please sign in to comment.