Skip to content

Commit 9461680

Browse files
authored
plugin subcommand: remove superfluous dot in filename (#318)
* Remove superfluous dot. * Add test for correct filename. * Add baseline test.
1 parent 5f98994 commit 9461680

File tree

6 files changed

+301
-2
lines changed

6 files changed

+301
-2
lines changed

.github/workflows/antsibull-docs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,10 @@ jobs:
143143
working-directory: antsibull-docs
144144

145145
- name: Test plugin rendering
146+
shell: bash
146147
run: |
147148
coverage run -p --source antsibull_docs -m antsibull_docs.cli.antsibull_docs plugin --plugin-type module --dest-dir . community.crypto.acme_account_info
149+
test -f community.crypto.acme_account_info_module.rst
148150
working-directory: antsibull-docs
149151
if: contains(matrix.options, '--use-current')
150152

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
bugfixes:
2+
- "The output filename used by the ``plugin`` subcommand contained two dots before the ``rst`` extension
3+
(https://github.com/ansible-community/antsibull-docs/issues/317, https://github.com/ansible-community/antsibull-docs/pull/318)."

src/antsibull_docs/cli/doc_commands/plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def generate_docs() -> int:
183183
collection_name,
184184
plugin,
185185
output_dir=app_ctx.extra["dest_dir"],
186-
output_filename=f"{plugin_name}_{plugin_type}.{output_format.output_extension}",
186+
output_filename=f"{plugin_name}_{plugin_type}{output_format.output_extension}",
187187
output_format=output_format,
188188
filename_generator=filename_generator,
189189
add_antsibull_docs_version=app_ctx.add_antsibull_docs_version,
Lines changed: 283 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,283 @@
1+
.. Document meta
2+
3+
:orphan:
4+
5+
.. |antsibull-internal-nbsp| unicode:: 0xA0
6+
:trim:
7+
8+
.. meta::
9+
:antsibull-docs: <ANTSIBULL_DOCS_VERSION>
10+
11+
.. Anchors
12+
13+
.. _ansible_collections.ns2.col.foo_lookup:
14+
15+
.. Anchors: short name for ansible.builtin
16+
17+
.. Title
18+
19+
ns2.col.foo lookup -- Look up some foo :ansopt:`ns2.col.foo#lookup:bar`
20+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
21+
22+
.. Collection note
23+
24+
.. note::
25+
This lookup plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_.
26+
27+
It is not included in ``ansible-core``.
28+
To check whether it is installed, run :code:`ansible-galaxy collection list`.
29+
30+
To install it, use: :code:`ansible-galaxy collection install ns2.col`.
31+
32+
To use it in a playbook, specify: :code:`ns2.col.foo`.
33+
34+
.. version_added
35+
36+
.. rst-class:: ansible-version-added
37+
38+
New in ns2.col 1.0.0
39+
40+
.. contents::
41+
:local:
42+
:depth: 1
43+
44+
.. Deprecated
45+
46+
47+
Synopsis
48+
--------
49+
50+
.. Description
51+
52+
- This looks up some foo.
53+
- Whatever that is.
54+
55+
56+
.. Aliases
57+
58+
59+
.. Requirements
60+
61+
62+
63+
64+
.. Terms
65+
66+
Terms
67+
-----
68+
69+
.. tabularcolumns:: \X{1}{3}\X{2}{3}
70+
71+
.. list-table::
72+
:width: 100%
73+
:widths: auto
74+
:header-rows: 1
75+
:class: longtable ansible-option-table
76+
77+
* - Parameter
78+
- Comments
79+
80+
* - .. raw:: html
81+
82+
<div class="ansible-option-cell">
83+
<div class="ansibleOptionAnchor" id="parameter-_terms"></div>
84+
85+
.. _ansible_collections.ns2.col.foo_lookup__parameter-_terms:
86+
87+
.. rst-class:: ansible-option-title
88+
89+
**Terms**
90+
91+
.. raw:: html
92+
93+
<a class="ansibleOptionLink" href="#parameter-_terms" title="Permalink to this option"></a>
94+
95+
.. ansible-option-type-line::
96+
97+
:ansible-option-type:`list` / :ansible-option-elements:`elements=string` / :ansible-option-required:`required`
98+
99+
100+
101+
102+
.. raw:: html
103+
104+
</div>
105+
106+
- .. raw:: html
107+
108+
<div class="ansible-option-cell">
109+
110+
The stuff to look up.
111+
112+
113+
.. raw:: html
114+
115+
</div>
116+
117+
118+
119+
120+
121+
.. Options
122+
123+
Keyword parameters
124+
------------------
125+
126+
This describes keyword parameters of the lookup. These are the values ``key1=value1``, ``key2=value2`` and so on in the following
127+
examples: ``lookup('ns2.col.foo', key1=value1, key2=value2, ...)`` and ``query('ns2.col.foo', key1=value1, key2=value2, ...)``
128+
129+
.. tabularcolumns:: \X{1}{3}\X{2}{3}
130+
131+
.. list-table::
132+
:width: 100%
133+
:widths: auto
134+
:header-rows: 1
135+
:class: longtable ansible-option-table
136+
137+
* - Parameter
138+
- Comments
139+
140+
* - .. raw:: html
141+
142+
<div class="ansible-option-cell">
143+
<div class="ansibleOptionAnchor" id="parameter-bar"></div>
144+
145+
.. _ansible_collections.ns2.col.foo_lookup__parameter-bar:
146+
147+
.. rst-class:: ansible-option-title
148+
149+
**bar**
150+
151+
.. raw:: html
152+
153+
<a class="ansibleOptionLink" href="#parameter-bar" title="Permalink to this option"></a>
154+
155+
.. ansible-option-type-line::
156+
157+
:ansible-option-type:`string`
158+
159+
160+
161+
162+
.. raw:: html
163+
164+
</div>
165+
166+
- .. raw:: html
167+
168+
<div class="ansible-option-cell">
169+
170+
Foo bar.
171+
172+
173+
.. raw:: html
174+
175+
</div>
176+
177+
178+
.. Attributes
179+
180+
181+
.. Notes
182+
183+
Notes
184+
-----
185+
186+
.. note::
187+
- When keyword and positional parameters are used together, positional parameters must be listed before keyword parameters:
188+
``lookup('ns2.col.foo', term1, term2, key1=value1, key2=value2)`` and ``query('ns2.col.foo', term1, term2, key1=value1, key2=value2)``
189+
190+
.. Seealso
191+
192+
193+
.. Examples
194+
195+
Examples
196+
--------
197+
198+
.. code-block:: yaml+jinja
199+
200+
- name: Look up bar
201+
ansible.builtin.debug:
202+
msg: "{{ lookup('ns2.col.foo', 'bar') }}"
203+
204+
205+
206+
.. Facts
207+
208+
209+
.. Return values
210+
211+
Return Value
212+
------------
213+
214+
.. tabularcolumns:: \X{1}{3}\X{2}{3}
215+
216+
.. list-table::
217+
:width: 100%
218+
:widths: auto
219+
:header-rows: 1
220+
:class: longtable ansible-option-table
221+
222+
* - Key
223+
- Description
224+
225+
* - .. raw:: html
226+
227+
<div class="ansible-option-cell">
228+
<div class="ansibleOptionAnchor" id="return-_raw"></div>
229+
230+
.. _ansible_collections.ns2.col.foo_lookup__return-_raw:
231+
232+
.. rst-class:: ansible-option-title
233+
234+
**Return value**
235+
236+
.. raw:: html
237+
238+
<a class="ansibleOptionLink" href="#return-_raw" title="Permalink to this return value"></a>
239+
240+
.. ansible-option-type-line::
241+
242+
:ansible-option-type:`list` / :ansible-option-elements:`elements=string`
243+
244+
.. raw:: html
245+
246+
</div>
247+
248+
- .. raw:: html
249+
250+
<div class="ansible-option-cell">
251+
252+
The resulting stuff.
253+
254+
255+
.. rst-class:: ansible-option-line
256+
257+
:ansible-option-returned-bold:`Returned:` success
258+
259+
260+
.. raw:: html
261+
262+
</div>
263+
264+
265+
266+
.. Status (Presently only deprecated)
267+
268+
269+
.. Authors
270+
271+
Authors
272+
~~~~~~~
273+
274+
- Felix Fontein (@felixfontein)
275+
276+
277+
.. hint::
278+
Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.
279+
280+
.. Extra links
281+
282+
283+
.. Parsing errors

tests/functional/build-docs-baseline.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ make_docsite_baseline() {
1313
echo "Building baseline ${DEST}..."
1414
rm -rf "${DEST}"
1515
mkdir -p "${DEST}"
16-
ANSIBLE_COLLECTIONS_PATHS= ANSIBLE_COLLECTIONS_PATH=collections/ python antsibull-docs-stub.py collection --dest-dir "${DEST}" --use-current "$@" 2>&1 | (
16+
ANSIBLE_COLLECTIONS_PATHS= ANSIBLE_COLLECTIONS_PATH=collections/ python antsibull-docs-stub.py ${COMMAND:-collection --use-current} --dest-dir "${DEST}" "$@" 2>&1 | (
1717
set +e
1818
grep -v "ERROR:antsibull:func=create_plugin_rst:mod=antsibull_docs.write_docs.plugins:nonfatal_errors="
1919
set -e
@@ -47,6 +47,7 @@ make_docsite_baseline baseline-no-breadcrumbs ns.col1 ns.col2 ns2.col ns2.flatco
4747
make_docsite_baseline baseline-no-indexes ns.col1 ns2.col ns2.flatcol --fail-on-error --no-indexes --no-add-antsibull-docs-version
4848
make_docsite_baseline baseline-use-html-blobs ns2.col --fail-on-error --use-html-blobs
4949
make_docsite_baseline baseline-squash-hierarchy ns2.col --fail-on-error --squash-hierarchy
50+
COMMAND="plugin" make_docsite_baseline baseline-plugin --plugin-type lookup ns2.col.foo --fail-on-error
5051
make_docsite_baseline baseline-simplified-rst ns.col1 ns.col2 ns2.col ns2.flatcol --output-format simplified-rst
5152
make_docsite_baseline baseline-simplified-rst-squash-hierarchy ns2.col --fail-on-error --squash-hierarchy --no-add-antsibull-docs-version --output-format simplified-rst
5253

tests/functional/test_docs_baseline.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,16 @@
7878
],
7979
"baseline-squash-hierarchy",
8080
),
81+
(
82+
[
83+
"plugin",
84+
"--plugin-type",
85+
"lookup",
86+
"ns2.col.foo",
87+
"--fail-on-error",
88+
],
89+
"baseline-plugin",
90+
),
8191
(
8292
[
8393
"collection",

0 commit comments

Comments
 (0)