Skip to content

Commit

Permalink
Just another attempt to fix param tables
Browse files Browse the repository at this point in the history
  • Loading branch information
john-science committed Jan 31, 2025
1 parent 8991109 commit a2b2c74
Showing 1 changed file with 24 additions and 19 deletions.
43 changes: 24 additions & 19 deletions doc/.static/dochelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ def createListTable(
Returns
-------
str: RST list-table string
str
RST list-table string
"""
# we need valid input data
assert len(rows) > 1, "Not enough input data."
Expand Down Expand Up @@ -110,21 +111,24 @@ def createListTable(

def generateParamTable(klass, fwParams, app=None):
"""
Return a string containing one or more restructured text list tables containing
parameter descriptions for the passed ArmiObject class.
Return a string containing one or more restructured text list tables containing parameter
descriptions for the passed ArmiObject class.
Parameters
----------
klass : ArmiObject subclass
The Class for which parameter tables should be generated
fwParams : ParameterDefinitionCollection
A parameter definition collection containing the parameters that are always
defined for the passed ``klass``. The rest of the parameters come from the
plugins registered with the passed ``app``
A parameter definition collection containing the parameters that are always defined for the
passed ``klass``. The rest of the parameters come from the plugins registered with the
passed ``app``
app : App, optional
The ARMI-based application to draw plugins from.
Returns
-------
str
RST-formatted string table
"""
from armi import apps

Expand All @@ -142,14 +146,15 @@ def generateParamTable(klass, fwParams, app=None):
defs[plugin] = pDefs

headerContent = """
.. list-table:: {} Parameters from {{}}
:class: ssp-tiny
:widths: 30 40 30
:header-rows: 1
* - Name
- Description
- Units
.. container:: break_before ssp-landscape
.. list-table:: {} Parameters from {{}}
:class: ssp-tiny
:widths: 30 40 30
:header-rows: 1
* - Name
- Description
- Units
""".format(
klass.__name__
)
Expand All @@ -161,9 +166,9 @@ def generateParamTable(klass, fwParams, app=None):
content.append(f".. _{srcName}-{klass.__name__}-param-table:")
pluginContent = headerContent.format(srcName)
for pd in pdefs:
pluginContent += f""" * - {pd.name}
- {escapeSpecialCharacters(str(pd.description))}
- {escapeSpecialCharacters(pd.units)}
pluginContent += f""" * - {pd.name}
- {escapeSpecialCharacters(str(pd.description))}
- {escapeSpecialCharacters(pd.units)}
"""
content.append(pluginContent + "\n")

Expand Down

0 comments on commit a2b2c74

Please sign in to comment.