Implement indentation for :ffdoc:

This commit is contained in:
Kovid Goyal 2024-11-11 11:12:50 +05:30
parent c55e66a40a
commit ec445d6c32
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 7 additions and 1 deletions

View File

@ -33,7 +33,12 @@ def formatter_funcs():
ffml = FFMLProcessor() ffml = FFMLProcessor()
all_funcs = formatter_functions().get_builtins() all_funcs = formatter_functions().get_builtins()
for func_name, func in all_funcs.items(): for func_name, func in all_funcs.items():
ans[func_name] = ffml.document_to_rst(func.doc, func_name) text = ffml.document_to_rst(func.doc, func_name)
# indent the text since :ffdoc: is used inside lists
# if we need no indent we can create a new role like
# :ffdoc-no-indent:
text = '\n '.join(text.splitlines())
ans[func_name] = text.strip()
db.close() db.close()
del db del db
return ans return ans

View File

@ -77,6 +77,7 @@ def generate_template_language_help(language):
a(f'.. class:: {func.__class__.__name__}\n\n') a(f'.. class:: {func.__class__.__name__}\n\n')
a(ffml.document_to_rst(func.doc, name)) a(ffml.document_to_rst(func.doc, name))
a('\n\n') a('\n\n')
db.close()
del db del db
a(POSTAMBLE) a(POSTAMBLE)