@@ -97,7 +97,8 @@ def create_plugin_rst(collection_name: str,
97
97
plugin_short_name : str , plugin_type : str ,
98
98
plugin_record : t .Dict [str , t .Any ], nonfatal_errors : t .Sequence [str ],
99
99
plugin_tmpl : Template , error_tmpl : Template ,
100
- use_html_blobs : bool = False ) -> str :
100
+ use_html_blobs : bool = False ,
101
+ for_official_docsite : bool = False ) -> str :
101
102
"""
102
103
Create the rst page for one plugin.
103
104
@@ -114,6 +115,8 @@ def create_plugin_rst(collection_name: str,
114
115
:arg error_tmpl: Template to use when there wasn't enough documentation for the plugin.
115
116
:arg use_html_blobs: If set to ``True``, will use HTML blobs for parameter and return value
116
117
tables instead of using RST tables.
118
+ :kwarg for_official_docsite: Default False. Set to True to use wording specific for the
119
+ official docsite on docs.ansible.com.
117
120
"""
118
121
flog = mlog .fields (func = 'create_plugin_rst' )
119
122
flog .debug ('Enter' )
@@ -163,6 +166,7 @@ def create_plugin_rst(collection_name: str,
163
166
edit_on_github_url = edit_on_github_url ,
164
167
collection_links = collection_links .links ,
165
168
collection_communication = collection_links .communication ,
169
+ for_official_docsite = for_official_docsite ,
166
170
)
167
171
else :
168
172
if nonfatal_errors :
@@ -185,6 +189,7 @@ def create_plugin_rst(collection_name: str,
185
189
edit_on_github_url = edit_on_github_url ,
186
190
collection_links = collection_links .links ,
187
191
collection_communication = collection_links .communication ,
192
+ for_official_docsite = for_official_docsite ,
188
193
)
189
194
else :
190
195
plugin_contents = _render_template (
@@ -202,6 +207,7 @@ def create_plugin_rst(collection_name: str,
202
207
edit_on_github_url = edit_on_github_url ,
203
208
collection_links = collection_links .links ,
204
209
collection_communication = collection_links .communication ,
210
+ for_official_docsite = for_official_docsite ,
205
211
)
206
212
207
213
flog .debug ('Leave' )
@@ -216,7 +222,8 @@ async def write_plugin_rst(collection_name: str,
216
222
plugin_tmpl : Template , error_tmpl : Template , dest_dir : str ,
217
223
path_override : t .Optional [str ] = None ,
218
224
squash_hierarchy : bool = False ,
219
- use_html_blobs : bool = False ) -> None :
225
+ use_html_blobs : bool = False ,
226
+ for_official_docsite : bool = False ) -> None :
220
227
"""
221
228
Write the rst page for one plugin.
222
229
@@ -239,6 +246,8 @@ async def write_plugin_rst(collection_name: str,
239
246
created.
240
247
:arg use_html_blobs: If set to ``True``, will use HTML blobs for parameter and return value
241
248
tables instead of using RST tables.
249
+ :kwarg for_official_docsite: Default False. Set to True to use wording specific for the
250
+ official docsite on docs.ansible.com.
242
251
"""
243
252
flog = mlog .fields (func = 'write_plugin_rst' )
244
253
flog .debug ('Enter' )
@@ -256,6 +265,7 @@ async def write_plugin_rst(collection_name: str,
256
265
plugin_tmpl = plugin_tmpl ,
257
266
error_tmpl = error_tmpl ,
258
267
use_html_blobs = use_html_blobs ,
268
+ for_official_docsite = for_official_docsite ,
259
269
)
260
270
261
271
if path_override is not None :
@@ -284,7 +294,8 @@ async def write_stub_rst(collection_name: str, collection_meta: AnsibleCollectio
284
294
tombstone_tmpl : Template ,
285
295
dest_dir : str ,
286
296
path_override : t .Optional [str ] = None ,
287
- squash_hierarchy : bool = False ) -> None :
297
+ squash_hierarchy : bool = False ,
298
+ for_official_docsite : bool = False ) -> None :
288
299
"""
289
300
Write the rst page for one plugin stub.
290
301
@@ -303,6 +314,8 @@ async def write_stub_rst(collection_name: str, collection_meta: AnsibleCollectio
303
314
:arg squash_hierarchy: If set to ``True``, no directory hierarchy will be used.
304
315
Undefined behavior if documentation for multiple collections are
305
316
created.
317
+ :kwarg for_official_docsite: Default False. Set to True to use wording specific for the
318
+ official docsite on docs.ansible.com.
306
319
"""
307
320
flog = mlog .fields (func = 'write_stub_rst' )
308
321
flog .debug ('Enter' )
@@ -321,6 +334,7 @@ async def write_stub_rst(collection_name: str, collection_meta: AnsibleCollectio
321
334
collection_links = collection_links .links ,
322
335
collection_communication = collection_links .communication ,
323
336
tombstone = routing_data ['tombstone' ],
337
+ for_official_docsite = for_official_docsite ,
324
338
)
325
339
else : # 'redirect' in routing_data
326
340
plugin_contents = _render_template (
@@ -335,6 +349,7 @@ async def write_stub_rst(collection_name: str, collection_meta: AnsibleCollectio
335
349
redirect = routing_data ['redirect' ],
336
350
redirect_is_symlink = routing_data .get ('redirect_is_symlink' ) or False ,
337
351
deprecation = routing_data .get ('deprecation' ),
352
+ for_official_docsite = for_official_docsite ,
338
353
)
339
354
340
355
if path_override is not None :
@@ -362,7 +377,8 @@ async def output_all_plugin_rst(collection_to_plugin_info: CollectionInfoT,
362
377
collection_metadata : t .Mapping [str , AnsibleCollectionMetadata ],
363
378
link_data : t .Mapping [str , CollectionLinks ],
364
379
squash_hierarchy : bool = False ,
365
- use_html_blobs : bool = False ) -> None :
380
+ use_html_blobs : bool = False ,
381
+ for_official_docsite : bool = False ) -> None :
366
382
"""
367
383
Output rst files for each plugin.
368
384
@@ -379,6 +395,8 @@ async def output_all_plugin_rst(collection_to_plugin_info: CollectionInfoT,
379
395
created.
380
396
:arg use_html_blobs: If set to ``True``, will use HTML blobs for parameter and return value
381
397
tables instead of using RST tables.
398
+ :kwarg for_official_docsite: Default False. Set to True to use wording specific for the
399
+ official docsite on docs.ansible.com.
382
400
"""
383
401
# Setup the jinja environment
384
402
env = doc_environment (('antsibull_docs.data' , 'docsite' ))
@@ -406,7 +424,8 @@ async def output_all_plugin_rst(collection_to_plugin_info: CollectionInfoT,
406
424
nonfatal_errors [plugin_type ][plugin_name ],
407
425
plugin_type_tmpl , error_tmpl ,
408
426
dest_dir , squash_hierarchy = squash_hierarchy ,
409
- use_html_blobs = use_html_blobs )))
427
+ use_html_blobs = use_html_blobs ,
428
+ for_official_docsite = for_official_docsite )))
410
429
411
430
# Write docs for each plugin
412
431
await asyncio .gather (* writers )
@@ -418,7 +437,8 @@ async def output_all_plugin_stub_rst(stubs_info: t.Mapping[
418
437
collection_metadata : t .Mapping [
419
438
str , AnsibleCollectionMetadata ],
420
439
link_data : t .Mapping [str , CollectionLinks ],
421
- squash_hierarchy : bool = False ) -> None :
440
+ squash_hierarchy : bool = False ,
441
+ for_official_docsite : bool = False ) -> None :
422
442
"""
423
443
Output rst files for each plugin stub.
424
444
@@ -430,6 +450,8 @@ async def output_all_plugin_stub_rst(stubs_info: t.Mapping[
430
450
:arg squash_hierarchy: If set to ``True``, no directory hierarchy will be used.
431
451
Undefined behavior if documentation for multiple collections are
432
452
created.
453
+ :kwarg for_official_docsite: Default False. Set to True to use wording specific for the
454
+ official docsite on docs.ansible.com.
433
455
"""
434
456
# Setup the jinja environment
435
457
env = doc_environment (('antsibull_docs.data' , 'docsite' ))
@@ -449,7 +471,8 @@ async def output_all_plugin_stub_rst(stubs_info: t.Mapping[
449
471
link_data [collection_name ],
450
472
plugin_short_name , plugin_type ,
451
473
routing_data , redirect_tmpl , tombstone_tmpl ,
452
- dest_dir , squash_hierarchy = squash_hierarchy )))
474
+ dest_dir , squash_hierarchy = squash_hierarchy ,
475
+ for_official_docsite = for_official_docsite )))
453
476
454
477
# Write docs for each plugin
455
478
await asyncio .gather (* writers )
@@ -479,7 +502,8 @@ async def write_collection_list(collections: t.Iterable[str], namespaces: t.Iter
479
502
collections = collections ,
480
503
namespaces = namespaces ,
481
504
breadcrumbs = breadcrumbs ,
482
- for_official_docsite = for_official_docsite )
505
+ for_official_docsite = for_official_docsite ,
506
+ )
483
507
index_file = os .path .join (dest_dir , 'index.rst' )
484
508
485
509
await write_file (index_file , index_contents )
@@ -509,7 +533,8 @@ async def write_collection_namespace_index(namespace: str, collections: t.Iterab
509
533
namespace = namespace ,
510
534
collections = collections ,
511
535
breadcrumbs = breadcrumbs ,
512
- for_official_docsite = for_official_docsite )
536
+ for_official_docsite = for_official_docsite ,
537
+ )
513
538
index_file = os .path .join (dest_dir , 'index.rst' )
514
539
515
540
await write_file (index_file , index_contents )
@@ -518,7 +543,8 @@ async def write_collection_namespace_index(namespace: str, collections: t.Iterab
518
543
async def write_plugin_type_index (plugin_type : str ,
519
544
per_collection_plugins : t .Mapping [str , t .Mapping [str , str ]],
520
545
template : Template ,
521
- dest_filename : str ) -> None :
546
+ dest_filename : str ,
547
+ for_official_docsite : bool = False ) -> None :
522
548
"""
523
549
Write an index page for each plugin type.
524
550
@@ -527,12 +553,16 @@ async def write_plugin_type_index(plugin_type: str,
527
553
short_description.
528
554
:arg template: A template to render the plugin index.
529
555
:arg dest_filename: The destination filename.
556
+ :kwarg for_official_docsite: Default False. Set to True to use wording specific for the
557
+ official docsite on docs.ansible.com.
530
558
"""
531
559
index_contents = _render_template (
532
560
template ,
533
561
dest_filename ,
534
562
plugin_type = plugin_type ,
535
- per_collection_plugins = per_collection_plugins )
563
+ per_collection_plugins = per_collection_plugins ,
564
+ for_official_docsite = for_official_docsite ,
565
+ )
536
566
537
567
await write_file (dest_filename , index_contents )
538
568
@@ -544,7 +574,8 @@ async def write_plugin_lists(collection_name: str,
544
574
collection_meta : AnsibleCollectionMetadata ,
545
575
extra_docs_data : CollectionExtraDocsInfoT ,
546
576
link_data : CollectionLinks ,
547
- breadcrumbs : bool = True ) -> None :
577
+ breadcrumbs : bool = True ,
578
+ for_official_docsite : bool = False ) -> None :
548
579
"""
549
580
Write an index page for each collection.
550
581
@@ -558,6 +589,8 @@ async def write_plugin_lists(collection_name: str,
558
589
:arg link_data: Links for the collection.
559
590
:kwarg breadcrumbs: Default True. Set to False if breadcrumbs for collections should be
560
591
disabled. This will disable breadcrumbs but save on memory usage.
592
+ :kwarg for_official_docsite: Default False. Set to True to use wording specific for the
593
+ official docsite on docs.ansible.com.
561
594
"""
562
595
index_contents = _render_template (
563
596
template ,
@@ -572,6 +605,7 @@ async def write_plugin_lists(collection_name: str,
572
605
collection_description = link_data .description ,
573
606
collection_links = link_data .links ,
574
607
collection_communication = link_data .communication ,
608
+ for_official_docsite = for_official_docsite ,
575
609
)
576
610
577
611
# This is only safe because we made sure that the top of the directory tree we're writing to
@@ -661,13 +695,16 @@ async def output_collection_namespace_indexes(collection_namespaces: t.Mapping[s
661
695
662
696
663
697
async def output_plugin_indexes (plugin_info : PluginCollectionInfoT ,
664
- dest_dir : str ) -> None :
698
+ dest_dir : str ,
699
+ for_official_docsite : bool = False ) -> None :
665
700
"""
666
701
Generate top-level plugin index pages for all plugins of a type in all collections.
667
702
668
703
:arg plugin_info: Mapping of plugin_type to Mapping of collection_name to Mapping of
669
704
plugin_name to short_description.
670
705
:arg dest_dir: The directory to place the documentation in.
706
+ :kwarg for_official_docsite: Default False. Set to True to use wording specific for the
707
+ official docsite on docs.ansible.com.
671
708
"""
672
709
flog = mlog .fields (func = 'output_plugin_indexes' )
673
710
flog .debug ('Enter' )
@@ -690,7 +727,8 @@ async def output_plugin_indexes(plugin_info: PluginCollectionInfoT,
690
727
filename = os .path .join (collection_toplevel , f'index_{ plugin_type } .rst' )
691
728
writers .append (await pool .spawn (
692
729
write_plugin_type_index (
693
- plugin_type , per_collection_data , plugin_list_tmpl , filename )))
730
+ plugin_type , per_collection_data , plugin_list_tmpl , filename ,
731
+ for_official_docsite = for_official_docsite )))
694
732
695
733
await asyncio .gather (* writers )
696
734
@@ -703,8 +741,8 @@ async def output_indexes(collection_to_plugin_info: CollectionInfoT,
703
741
extra_docs_data : t .Mapping [str , CollectionExtraDocsInfoT ],
704
742
link_data : t .Mapping [str , CollectionLinks ],
705
743
squash_hierarchy : bool = False ,
706
- breadcrumbs : bool = True
707
- ) -> None :
744
+ breadcrumbs : bool = True ,
745
+ for_official_docsite : bool = False ) -> None :
708
746
"""
709
747
Generate collection-level index pages for the collections.
710
748
@@ -718,6 +756,8 @@ async def output_indexes(collection_to_plugin_info: CollectionInfoT,
718
756
Undefined behavior if documentation for multiple collections are created.
719
757
:kwarg breadcrumbs: Default True. Set to False if breadcrumbs for collections should be
720
758
disabled. This will disable breadcrumbs but save on memory usage.
759
+ :kwarg for_official_docsite: Default False. Set to True to use wording specific for the
760
+ official docsite on docs.ansible.com.
721
761
"""
722
762
flog = mlog .fields (func = 'output_indexes' )
723
763
flog .debug ('Enter' )
@@ -753,7 +793,8 @@ async def output_indexes(collection_to_plugin_info: CollectionInfoT,
753
793
collection_dir , collection_metadata [collection_name ],
754
794
extra_docs_data [collection_name ],
755
795
link_data [collection_name ],
756
- breadcrumbs = breadcrumbs )))
796
+ breadcrumbs = breadcrumbs ,
797
+ for_official_docsite = for_official_docsite )))
757
798
758
799
await asyncio .gather (* writers )
759
800
0 commit comments