Skip to content

Commit 4f9887f

Browse files
Use antsibull-docs-parser for markup processing (#124)
* Use antsibull-docs-parser for markup processing. * Bump antsibull-docs-parser version to 0.3.0. * Fix grammar. Co-authored-by: Maxwell G <[email protected]> * Make sure to check out and install local antsibull-docs-parser. --------- Co-authored-by: Maxwell G <[email protected]>
1 parent 2fa17b6 commit 4f9887f

File tree

30 files changed

+70
-3269
lines changed

30 files changed

+70
-3269
lines changed

.github/workflows/antsibull-docs.yml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333
- '3.11'
3434
antsibull_core_ref:
3535
- main
36+
antsibull_docs_parser_ref:
37+
- main
3638
include:
3739
- options: '--use-current --use-html-blobs --no-breadcrumbs community.crypto community.docker'
3840
python: '3.9'
@@ -51,6 +53,13 @@ jobs:
5153
path: antsibull-core
5254
ref: ${{ matrix.antsibull_core_ref }}
5355

56+
- name: Check out dependent project antsibull-docs-parser
57+
uses: actions/checkout@v3
58+
with:
59+
repository: ansible-community/antsibull-docs-parser
60+
path: antsibull-docs-parser
61+
ref: ${{ matrix.antsibull_docs_parser_ref }}
62+
5463
- name: Set up Python ${{ matrix.python }}
5564
uses: actions/setup-python@v4
5665
with:
@@ -59,7 +68,7 @@ jobs:
5968
- name: Install dependencies
6069
run: |
6170
python -m pip install --upgrade pip
62-
pip install -e .[coverage] ../antsibull-core
71+
pip install -e .[coverage] ../antsibull-core ../antsibull-docs-parser
6372
working-directory: antsibull-docs
6473

6574
- name: Use antsibull-docs sphinx-init
@@ -147,6 +156,12 @@ jobs:
147156
repository: ansible-community/antsibull-core
148157
path: antsibull-core
149158

159+
- name: Check out dependent project antsibull-docs-parser
160+
uses: actions/checkout@v3
161+
with:
162+
repository: ansible-community/antsibull-docs-parser
163+
path: antsibull-docs-parser
164+
150165
- name: Set up Python 3.11
151166
uses: actions/setup-python@v4
152167
with:
@@ -155,7 +170,7 @@ jobs:
155170
- name: Install dependencies
156171
run: |
157172
python -m pip install --upgrade pip
158-
pip install -e .[coverage] ../antsibull-core
173+
pip install -e .[coverage] ../antsibull-core ../antsibull-docs-parser
159174
working-directory: antsibull-docs
160175

161176
- name: Get hold of deps file
@@ -197,6 +212,12 @@ jobs:
197212
repository: ansible-community/antsibull-core
198213
path: antsibull-core
199214

215+
- name: Check out dependent project antsibull-docs-parser
216+
uses: actions/checkout@v3
217+
with:
218+
repository: ansible-community/antsibull-docs-parser
219+
path: antsibull-docs-parser
220+
200221
- name: Set up Python 3.11
201222
uses: actions/setup-python@v4
202223
with:
@@ -205,7 +226,7 @@ jobs:
205226
- name: Install dependencies
206227
run: |
207228
python -m pip install --upgrade pip
208-
pip install -e .[coverage] ../antsibull-core
229+
pip install -e .[coverage] ../antsibull-core ../antsibull-docs-parser
209230
working-directory: antsibull-docs
210231

211232
- name: Get hold of ansible.in file

.github/workflows/nox.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ jobs:
3535
with:
3636
repository: ansible-community/antsibull-core
3737
path: antsibull-core
38+
- name: Check out dependent project antsibull-docs-parser
39+
uses: actions/checkout@v3
40+
with:
41+
repository: ansible-community/antsibull-docs-parser
42+
path: antsibull-docs-parser
3843
- name: Setup nox
3944
uses: wntrblm/[email protected]
4045
with:
@@ -56,6 +61,11 @@ jobs:
5661
with:
5762
repository: ansible-community/antsibull-core
5863
path: antsibull-core
64+
- name: Check out dependent project antsibull-docs-parser
65+
uses: actions/checkout@v3
66+
with:
67+
repository: ansible-community/antsibull-docs-parser
68+
path: antsibull-docs-parser
5969
- name: Setup nox
6070
uses: wntrblm/[email protected]
6171
with:

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,19 @@ and install the requirements needed to run the tests there.
7171

7272
---
7373

74-
antsibull-docs depends on the sister antsibull-core project.
75-
By default, `nox` will install a development version of this project from
74+
antsibull-docs depends on the sister antsibull-core and antsibull-docs-parser projects.
75+
By default, `nox` will install a development version of these projects from
7676
Github.
77-
If you're hacking on antsibull-core alongside antsibull-docs, nox will automatically
78-
install the project from `../antsibull-core` when running tests if those paths
79-
exist.
77+
If you're hacking on antsibull-core and/or antsibull-docs-parser alongside antsibull-docs,
78+
nox will automatically install the projects from `../antsibull-core` and
79+
`../antsibull-docs-parser` when running tests if those paths exist.
8080
You can change this behavior through the `OTHER_ANTSIBULL_MODE` env var:
8181

8282
- `OTHER_ANTSIBULL_MODE=auto` — the default behavior described above
83-
- `OTHER_ANTSIBULL_MODE=local` — install the project from `../antsibull-core`.
84-
Fail if that paths doesn't exist.
83+
- `OTHER_ANTSIBULL_MODE=local` — install the projects from `../antsibull-core`
84+
and `../antsibull-docs-parser`. Fail if those paths don't exist.
8585
- `OTHER_ANTSIBULL_MODE=git` — install the projects from the Github main branch
86-
- `OTHER_ANTSIBULL_MODE=pypi` — install the latest version from PyPI
86+
- `OTHER_ANTSIBULL_MODE=pypi` — install the latest versions from PyPI
8787

8888

8989
To run specific tests:
@@ -97,11 +97,12 @@ To create a more complete local development env:
9797

9898
``` console
9999
git clone https://github.com/ansible-community/antsibull-core.git
100+
git clone https://github.com/ansible-community/antsibull-docs-parser.git
100101
git clone https://github.com/ansible-community/antsibull-docs.git
101102
cd antsibull-docs
102103
python3 -m venv venv
103104
. ./venv/bin/activate
104-
pip install -e '.[dev]' -e ../antsibull-core
105+
pip install -e '.[dev]' -e ../antsibull-core -e ../antsibull-docs-parser
105106
[...]
106107
nox
107108
```
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
minor_changes:
2+
- "The dependency `antsibull-docs-parser <https://github.com/ansible-community/antsibull-docs-parser>`__ has been added and is used for processing Ansible markup (https://github.com/ansible-community/antsibull-docs/pull/124)."

noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def other_antsibull(
4040
if mode is None:
4141
mode = DEFAULT_MODE
4242
to_install: list[str | Path] = []
43-
args = ("antsibull-core", )
43+
args = ("antsibull-core", "antsibull-docs-parser")
4444
for project in args:
4545
path = Path("../", project)
4646
path_exists = path.is_dir()

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ requires-python = ">=3.9"
2626
dependencies = [
2727
"ansible-pygments",
2828
"antsibull-core >= 1.2.0, < 3.0.0",
29+
"antsibull-docs-parser ~= 0.3.0",
2930
"asyncio-pool",
3031
"docutils",
3132
"jinja2 >= 3.0",

src/antsibull_docs/lint_plugin_docs.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
from antsibull_core.vendored.json_utils import _filter_non_json_lines
1818
from antsibull_core.venv import FakeVenvRunner
1919

20+
from antsibull_docs_parser import dom
21+
from antsibull_docs_parser.parser import Context as ParserContext
22+
from antsibull_docs_parser.parser import parse as parse_markup
23+
2024
from sphinx_antsibull_ext import roles as antsibull_roles
2125

2226
from .augment_docs import augment_docs
@@ -31,9 +35,6 @@
3135
from .docs_parsing.routing import load_all_collection_routing, remove_redirect_duplicates
3236
from .jinja2.environment import doc_environment
3337
from .lint_helpers import load_collection_info
34-
from .markup import dom
35-
from .markup.parser import Context as ParserContext
36-
from .markup.parser import parse as parse_markup
3738
from .rstcheck import check_rst_content
3839
from .utils.collection_name_transformer import CollectionNameTransformer
3940
from .write_docs.plugins import create_plugin_rst, guess_relative_filename, has_broken_docs

src/antsibull_docs/markup/_counter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import typing as t
1111

12-
from . import dom
12+
from antsibull_docs_parser import dom
1313

1414

1515
class _Counter(dom.Walker):

src/antsibull_docs/markup/_parser_impl.py

Lines changed: 0 additions & 87 deletions
This file was deleted.

0 commit comments

Comments
 (0)