MCPcopy
hub / github.com/KhronosGroup/Vulkan-Docs / refPageShell

Function refPageShell

scripts/genRef.py:266–331  ·  view source on GitHub ↗

Generate body of a reference page. - pageName - string name of the page - pageDesc - string short description of the page - pageAliases - set of aliases of this page - fp - file to write to - head_content - text to include before the sections - sections - iterable returning

(pageName, pageDesc, pageAliases, fp, head_content = None, sections=None, tail_content=None, man_section=3)

Source from the content-addressed store, hash-verified

264
265
266def refPageShell(pageName, pageDesc, pageAliases, fp, head_content = None, sections=None, tail_content=None, man_section=3):
267 """Generate body of a reference page.
268
269 - pageName - string name of the page
270 - pageDesc - string short description of the page
271 - pageAliases - set of aliases of this page
272 - fp - file to write to
273 - head_content - text to include before the sections
274 - sections - iterable returning (title,body) for each section.
275 - tail_content - text to include after the sections
276 - man_section - Unix man page section"""
277
278 printCopyrightSourceComments(fp)
279
280 print(':data-uri:',
281 ':!icons:',
282 ':attribute-missing: warn',
283 conventions.extra_refpage_headers,
284 '',
285 sep='\n', file=fp)
286
287 if len(pageAliases) > 0:
288 # Generate page-aliases relative to {refpage-alias-path}.
289 # This is set in the refpages component antora.yml for Antora builds
290 # only; otherwise refpage-alias-path is set to empty to prevent
291 # warnings from asciidoctor.
292 # The page-aliases attribute is irrelevant to non-Antora builds.
293 pathaliases = ', '.join(f'{{refpage-alias-path}}{page}.adoc' for page in sorted(pageAliases))
294 aliases = 'ifndef::refpage-alias-path[:refpage-alias-path:]\n'
295 aliases += ':page-aliases: ' + pathaliases
296 else:
297 aliases = ''
298
299 s = f'{pageName}({man_section})'
300 print(f'= {s}',
301 aliases,
302 '',
303 conventions.extra_refpage_body,
304 '',
305 sep='\n', file=fp)
306 if pageDesc.strip() == '':
307 pageDesc = 'NO SHORT DESCRIPTION PROVIDED'
308 logWarn('refPageShell: no short description provided for', pageName)
309
310 print('== Name',
311 f'{pageName} - {pageDesc}',
312 '',
313 sep='\n', file=fp)
314
315 if head_content is not None:
316 print(head_content,
317 '',
318 sep='\n', file=fp)
319
320 if sections is not None:
321 for title, content in sections.items():
322 print(f'== {title}',
323 '',

Callers 2

refPageHeadFunction · 0.85
genExtensionFunction · 0.85

Calls 3

logWarnFunction · 0.90
itemsMethod · 0.80

Tested by

no test coverage detected