Skip to content

Commit 4c7e7b2

Browse files
committed
Merge branch 'ahanak-global-title' into develop
2 parents e5ab6d1 + 02f6347 commit 4c7e7b2

File tree

9 files changed

+131
-110
lines changed

9 files changed

+131
-110
lines changed

.github/workflows/python-package.yml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,18 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
python-version: ['3.10', '3.11', '3.12', '3.13']
18-
pandoc-version: ['3.6']
17+
python-version: ['3.11', '3.12', '3.13', '3.14']
18+
pandoc-version: [3.9]
1919
steps:
2020
- uses: actions/checkout@v4
2121
- name: Set up Python ${{ matrix.python-version }}
2222
uses: actions/setup-python@v5
2323
with:
2424
python-version: ${{ matrix.python-version }}
2525
- name: Install Hatch
26-
run: pipx install hatch
26+
run: |
27+
pipx install hatch
28+
pipx inject --force hatch virtualenv<21
2729
- name: Install dependencies
2830
run: |
2931
wget https://github.com/jgm/pandoc/releases/download/${{ matrix.pandoc-version }}/pandoc-${{ matrix.pandoc-version }}-1-amd64.deb
@@ -37,15 +39,17 @@ jobs:
3739
strategy:
3840
matrix:
3941
python-version: ['3.12']
40-
pandoc-version: [2.11.4, '2.12', '2.13', 2.14.2, '2.15', 2.16.2, 2.17.1.1, '2.18', 2.19.2, 3.0.1, 3.1.13, 3.2.1, '3.3', '3.4', 3.5, '3.6']
42+
pandoc-version: [2.11.4, '2.12', '2.13', 2.14.2, '2.15', 2.16.2, 2.17.1.1, '2.18', 2.19.2, 3.0.1, 3.1.13, 3.2.1, '3.3', '3.4', 3.5, 3.6.3, 3.7.0.2, 3.8.3]
4143
steps:
42-
- uses: actions/checkout@v4
44+
- uses: actions/checkout@v6
4345
- name: Set up Python ${{ matrix.python-version }}
44-
uses: actions/setup-python@v5
46+
uses: actions/setup-python@v6
4547
with:
4648
python-version: ${{ matrix.python-version }}
4749
- name: Install Hatch
48-
run: pipx install hatch
50+
run: |
51+
pipx install hatch
52+
pipx inject --force hatch virtualenv<21
4953
- name: Install dependencies
5054
run: |
5155
wget https://github.com/jgm/pandoc/releases/download/${{ matrix.pandoc-version }}/pandoc-${{ matrix.pandoc-version }}-1-amd64.deb
@@ -59,15 +63,17 @@ jobs:
5963
strategy:
6064
matrix:
6165
python-version: ['3.12']
62-
pandoc-version: ['3.6']
66+
pandoc-version: [3.9]
6367
steps:
64-
- uses: actions/checkout@v4
68+
- uses: actions/checkout@v6
6569
- name: Set up Python
66-
uses: actions/setup-python@v5
70+
uses: actions/setup-python@v6
6771
with:
6872
python-version: ${{ matrix.python-version }}
6973
- name: Install Hatch
70-
run: pipx install hatch
74+
run: |
75+
pipx install hatch
76+
pipx inject --force hatch virtualenv<21
7177
- name: Install dependencies
7278
run: |
7379
wget https://github.com/jgm/pandoc/releases/download/${{ matrix.pandoc-version }}/pandoc-${{ matrix.pandoc-version }}-1-amd64.deb
@@ -84,15 +90,17 @@ jobs:
8490
strategy:
8591
matrix:
8692
python-version: ['3.12']
87-
pandoc-version: ['3.6']
93+
pandoc-version: [3.9]
8894
steps:
89-
- uses: actions/checkout@v4
95+
- uses: actions/checkout@v6
9096
- name: Set up Python
91-
uses: actions/setup-python@v5
97+
uses: actions/setup-python@v6
9298
with:
9399
python-version: ${{ matrix.python-version }}
94100
- name: Install Hatch
95-
run: pipx install hatch
101+
run: |
102+
pipx install hatch
103+
pipx inject --force hatch virtualenv<21
96104
- name: Install dependencies
97105
run: |
98106
wget https://github.com/jgm/pandoc/releases/download/${{ matrix.pandoc-version }}/pandoc-${{ matrix.pandoc-version }}-1-amd64.deb

.github/workflows/python-publish.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ jobs:
2222
with:
2323
python-version: ${{ matrix.python-version }}
2424
- name: Install Hatch
25-
run: pipx install hatch
25+
run: |
26+
pipx install hatch
27+
pipx inject --force hatch virtualenv<21
2628
- name: Build and publish
2729
env:
2830
HATCH_INDEX_USER: ${{ secrets.PYPI_USERNAME }}

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v5.0.0
3+
rev: v6.0.0
44
hooks:
55
- id: check-toml
66
- id: check-yaml
77

88
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
9-
rev: v2.14.0
9+
rev: v2.16.0
1010
hooks:
1111
- id: pretty-format-toml
1212
args: [--autofix, --no-sort]
1313
- id: pretty-format-yaml
1414
args: [--autofix]
1515

1616
- repo: https://github.com/asottile/pyupgrade
17-
rev: v3.18.0
17+
rev: v3.21.0
1818
hooks:
1919
- id: pyupgrade
20-
args: [--py310-plus]
20+
args: [--py311-plus]
2121

2222
- repo: local
2323
hooks:
@@ -38,7 +38,7 @@ repos:
3838
pass_filenames: false
3939
- id: lock
4040
name: lock
41-
entry: uv lock --upgrade
41+
entry: hatch run uv lock --upgrade
4242
language: system
4343
pass_filenames: false
4444

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Installation
1616
[![Downloads](https://img.shields.io/pypi/dm/pandoc-beamer-block?logo=pypi&logoColor=white)](https://pepy.tech/project/pandoc-beamer-block)
1717
[![Development Status](https://img.shields.io/pypi/status/pandoc-beamer-block.svg?logo=pypi&logoColor=white)](https://pypi.org/project/pandoc-beamer-block/)
1818
[![Python version](https://img.shields.io/pypi/pyversions/pandoc-beamer-block.svg?logo=Python&logoColor=white)](https://pypi.org/project/pandoc-beamer-block/)
19-
[![Pandoc version](https://img.shields.io/badge/pandoc-2.11%20..%203.6-blue.svg?logo=markdown)](https://pandoc.org/)
19+
[![Pandoc version](https://img.shields.io/badge/pandoc-2.11%20..%203.9-blue.svg?logo=markdown)](https://pandoc.org/)
2020
[![Latest release](https://img.shields.io/github/release-date/chdemko/pandoc-beamer-block.svg?logo=github)](https://github.com/chdemko/pandoc-beamer-block/releases)
2121
[![Last commit](https://img.shields.io/github/last-commit/chdemko/pandoc-beamer-block/develop?logo=github)](https://github.com/chdemko/pandoc-beamer-block/commit/develop/)
2222
[![Repo Size](https://img.shields.io/github/repo-size/chdemko/pandoc-beamer-block.svg?logo=github)](http://pandoc-beamer-block.readthedocs.io/en/latest/)

docs/usage.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pandoc-beamer-block:
1919
- classes: [info]
2020
- classes: [alert]
2121
type: alert
22+
title: Danger
2223
~~~
2324

2425
The metadata block above is used to add a `block` environment around
@@ -31,6 +32,7 @@ Each entry of `pandoc-beamer-block` is a YAML dictionary containing:
3132
transformation will be applied. This parameter is mandatory.
3233
* `type`: the block type (either `alert`, `example`, `info`, `theorem`,
3334
`proof`, `corollary`, `definition`, `lemma` and `fact`)
35+
* `title`: an optional default title to use
3436

3537
## Example
3638

pyproject.toml

Lines changed: 13 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dynamic = ["version"]
77
name = "pandoc-beamer-block"
88
description = "A pandoc filter for adding beamer block on specific div"
99
readme = "README.md"
10-
requires-python = ">=3.10,<3.14"
10+
requires-python = ">=3.11,<3.15"
1111
license = {text = "BSD-3-Clause"}
1212
license-files = {paths = ["LICENSE"]}
1313
authors = [{name = "Christophe Demko", email = "chdemko@gmail.com"}]
@@ -31,10 +31,10 @@ classifiers = [
3131
"Topic :: Text Processing :: Filters",
3232
# Specify the Python versions you support here. In particular, ensure
3333
# that you indicate whether you support Python 2, Python 3 or both.
34-
"Programming Language :: Python :: 3.10",
3534
"Programming Language :: Python :: 3.11",
3635
"Programming Language :: Python :: 3.12",
3736
"Programming Language :: Python :: 3.13",
37+
"Programming Language :: Python :: 3.14",
3838
# Natural language used
3939
"Natural Language :: English"
4040
]
@@ -62,45 +62,20 @@ local_scheme = "no-local-version"
6262
packages = ["src/pandoc_beamer_block"]
6363

6464
[[tool.hatch.envs.hatch-test.matrix]]
65-
python = ["3.10", "3.11", "3.12", "3.13"]
65+
python = ["3.11", "3.12", "3.13", "3.14"]
6666

6767
[tool.hatch.envs.hatch-static-analysis]
6868
dependencies = [
6969
# Types
7070
"types-PyYAML~=6.0",
7171
# Formatter
72-
"black[jupyter]~=24.10",
72+
"black[jupyter]~=26.1",
7373
# Style checkers
74-
"doc8~=1.1",
75-
"mypy~=1.13",
76-
"flake8~=7.1",
77-
"flake8-pyproject~=1.2",
78-
"flake8-annotations-complexity~=0.0",
79-
"flake8-black~=0.3",
80-
"flake8-blind-except~=0.2",
81-
"flake8-bugbear~=24.8",
82-
"flake8-builtins~=2.5",
83-
"flake8-cognitive-complexity~=0.1",
84-
"flake8-comprehensions~=3.15",
85-
"flake8-docstrings~=1.7",
86-
"flake8-expression-complexity~=0.0",
87-
"flake8-fixme~=1.1",
88-
"flake8-functions~=0.0",
89-
"flake8-import-order~=0.18",
90-
"flake8-mypy~=17.8",
91-
"flake8-pyi~=24.9",
92-
"flake8-pydocstyle~=0.2",
93-
"flake8-return~=1.2",
94-
"flake8-simplify~=0.21",
95-
"flake8-spellcheck~=0.28",
96-
"flake8-use-fstring~=1.4",
97-
"flake8-variables-names~=0.0",
98-
"pep8-naming~=0.14",
99-
"darglint~=1.8.1",
100-
"pydoclint[flake8]~=0.5",
74+
"doc8~=2.0",
75+
"mypy~=1.19",
10176
"teyit~=0.4",
102-
"refurb~=2.0",
103-
"ruff~=0.8"
77+
"refurb~=2.3",
78+
"ruff~=0.15"
10479
]
10580

10681
[tool.hatch.envs.hatch-static-analysis.scripts]
@@ -114,8 +89,7 @@ format-fix = [
11489
lint-check = [
11590
"refurb {args:src docs}",
11691
"ruff check {args:src docs}",
117-
"teyit --show-stats --fail-on-change {args:tests}",
118-
"flake8 {args:src docs}"
92+
"teyit --show-stats --fail-on-change {args:tests}"
11993
]
12094
lint-fix = [
12195
"ruff check --fix {args:src docs}"
@@ -124,7 +98,7 @@ lint-fix = [
12498
[tool.hatch.envs.lint]
12599
dependencies = [
126100
"slotscheck~=0.19",
127-
"pylint~=3.3"
101+
"pylint~=4.0"
128102
]
129103

130104
[tool.hatch.envs.lint.scripts]
@@ -135,9 +109,9 @@ check = [
135109

136110
[tool.hatch.envs.docs]
137111
dependencies = [
138-
"myst-parser~=4.0",
139-
"Sphinx~=8.1",
140-
"sphinx-rtd-theme~=3.0",
112+
"myst-parser~=5.0",
113+
"Sphinx~=9.1",
114+
"sphinx-rtd-theme~=3.1",
141115
"sphinx-copybutton~=0.5"
142116
]
143117

src/pandoc_beamer_block/_main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def prepare(doc: Doc):
3333
):
3434
definition["classes"] = frozenset(definition["classes"])
3535
definition["type"] = definition.get("type", "info")
36+
definition["title"] = definition.get("title", "")
3637
doc.defined.append(definition)
3738

3839

@@ -110,7 +111,7 @@ def block(elem: Element, doc: Doc) -> list[Element] | None:
110111
output_format="latex",
111112
)
112113
else:
113-
title = ""
114+
title = definition["title"]
114115

115116
if definition["type"] == "alert":
116117
return latex(elem, "alertblock", title)

tests/test_block.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ def test_title_complex(self):
127127
---
128128
pandoc-beamer-block:
129129
- classes: ['class1', 'class2']
130+
title: Ignored
130131
---
131132
::: {.class1 .class2 title="**My Title**"}
132133
:::
@@ -141,3 +142,25 @@ def test_title_complex(self):
141142
)
142143
self.assertIn("\\begin{block}{\\textbf{My Title}}", text)
143144
self.assertIn("\\end{block}", text)
145+
146+
def test_title_default(self):
147+
doc = BlockTest.conversion(
148+
"""
149+
---
150+
pandoc-beamer-block:
151+
- classes: ['class1']
152+
title: My Title
153+
---
154+
::: class1 :::
155+
:::
156+
""",
157+
"beamer",
158+
)
159+
text = convert_text(
160+
doc,
161+
input_format="panflute",
162+
output_format="latex",
163+
extra_args=["--wrap=none"],
164+
)
165+
self.assertIn("\\begin{block}{My Title}", text)
166+
self.assertIn("\\end{block}", text)

0 commit comments

Comments
 (0)