mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Table was not rendering correctly.
Fix Sphinx docs: replace csv-table with list-table for formatting functions The documentation table of formatting/query functions was not rendering because `.. csv-table::` requires strict RFC4180 CSV escaping. The table contains nested quotes, inch marks (e.g. `3' - 0"`), backticks, and code examples, which cause the CSV parser in docutils to treat rows as malformed and drop the entire directive. Replaced the directive with `.. list-table::`, which parses reStructuredText instead of CSV and safely supports inline code, quotes, and multi-line cells. Also moved the examples text outside the directive block and ensured a blank line after the table so Sphinx does not interpret following paragraphs as table rows. No content changes — documentation now renders correctly. Generated with the assistance of an AI coding tool.
This commit is contained in:
@@ -240,22 +240,84 @@ in spreadsheets. For example ``upper("foo")`` will produce ``FOO``. You may
|
||||
nest formulas, for example ``concat(title("foo"), lower("Bar"))`` will produce
|
||||
``Foobar``. Strings must be double quoted.
|
||||
|
||||
.. csv-table::
|
||||
:header: "Function", "Example", "Result", "Description"
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
:widths: 28 28 16 28
|
||||
|
||||
* - Function
|
||||
- Example
|
||||
- Result
|
||||
- Description
|
||||
|
||||
* - ``upper({{value}})``
|
||||
- ``upper("Foo")``
|
||||
- ``FOO``
|
||||
- Uppercases a string.
|
||||
|
||||
* - ``lower({{value}})``
|
||||
- ``lower("Foo")``
|
||||
- ``foo``
|
||||
- Lowercases a string.
|
||||
|
||||
* - ``title({{value}})``
|
||||
- ``title("foo")``
|
||||
- ``Foo``
|
||||
- Titlecases a string.
|
||||
|
||||
* - ``concat({{value}}[, {{value2}}]*)``
|
||||
- ``concat("foo", "bar")``
|
||||
- ``foobar``
|
||||
- Concatenates two or more strings.
|
||||
|
||||
* - ``round({{value}}, {{precision}})``
|
||||
- ``round(3.123, 0.1)``
|
||||
- ``3.1``
|
||||
- Rounds ``{{value}}`` to the nearest ``{{precision}}``.
|
||||
|
||||
* - ``int({{value}})``
|
||||
- ``int(3.123)``
|
||||
- ``3``
|
||||
- Truncates the decimal part of the ``{{value}}``.
|
||||
|
||||
* - ``number({{value}}[, {{decimal_separator}}[, {{thousands_separator}}]])``
|
||||
- ``number(1234.56, ",", ".")``
|
||||
- ``1.234,56``
|
||||
- Formats ``{{value}}`` with an optional custom ``{{decimal_separator}}`` and ``{{thousands_separator}}``. The default separators are ``.`` and ``,``.
|
||||
|
||||
* - ``metric_length({{value}}, {{precision}}, {{decimals}})``
|
||||
- ``metric_length(3.123, 0.1, 2)``
|
||||
- ``3.10``
|
||||
- Rounds ``{{value}}`` to the nearest ``{{precision}}`` then displays using a certain amount of decimal places.
|
||||
|
||||
* - ``imperial_length({{value}}, {{precision}}, {{input_unit}}, {{output_unit}}, {{suppress_zero_inches}})``
|
||||
- ``imperial_length(3.0, 4, "foot", "foot", true)``
|
||||
OR
|
||||
``imperial_length(3.0, 4, "foot", "foot", false)``
|
||||
- ``3'``
|
||||
OR
|
||||
``3' - 0"``
|
||||
- The ``{{value}}`` may be specified either as ``foot`` or ``inch`` depending on ``{{input_unit}}``. The ``{{value}}`` is rounded to the nearest ``1/{{precision}}`` inch, then formatted using fractional feet and inches if ``{{output_unit}}`` is ``foot``, or just inches if ``{{output_unit}}`` is ``inch``. When ``{{suppress_zero_inches}}`` is ``true`` (default), measurements with zero inches omit the inch portion (e.g., ``3'`` instead of ``3' - 0"``).
|
||||
|
||||
* - ``sort({{values}})``
|
||||
- ``sort({{mats.Name}})``
|
||||
- ``Name1, Name2``
|
||||
- Sorts a list of items.
|
||||
|
||||
* - ``reverse({{values}})``
|
||||
- ``reverse({{mats.Name}})``
|
||||
- ``Name2, Name1``
|
||||
- Reverses a list of items.
|
||||
|
||||
* - ``join({{separator}}, {{values}})``
|
||||
- ``join("-", {{mats.Name}})``
|
||||
- ``Name1-Name2``
|
||||
- Joins a list of items with a custom separator. By default, lists are rendered as comma separated.
|
||||
|
||||
* - ``{{value1}}[+-*/]{{value2}}``
|
||||
- ``{{z}}+3``
|
||||
- ``5``
|
||||
- Does arithmetic. Operators such as ``+``, ``-``, ``*``, and ``/`` are allowed and can be mixed with variables and formatting functions.
|
||||
|
||||
"``upper({{value}})``", "``upper(""Foo"")``", "``FOO``", "Uppercases a string."
|
||||
"``lower({{value}})``", "``lower(""Foo"")``", "``foo``", "Lowercases a string."
|
||||
"``title({{value}})``", "``title(""foo"")``", "``Foo``", "Titlecases a string."
|
||||
"``concat({{value}}[, {{value2}}]*)``", "``concat(""foo"", ""bar"")``", "``foobar``", "Concatenates two or more strings."
|
||||
"``round({{value}}, {{precision}})``", "``round(3.123, 0.1)``", "``3.1``", "Rounds ``{{value}}`` to the nearest ``{{precision}}``."
|
||||
"``int({{value}})``", "``int(3.123)``", "``3``", "Truncates the decimal part of the ``{{value}}``."
|
||||
"``number({{value}}[, {{decimal_separator}}[, {{thousands_separator}}]])``", "``number(1234.56, "","", ""."")``", "``1.234,56``", "Formats {{value}} with an optional custom {{decimal_separator}} and {{thousands_separator}}. The default separators are ``.`` and ``,``."
|
||||
"``metric_length({{value}}, {{precision}}, {{decimals}})``", "``metric_length(3.123, 0.1, 2)``", "``3.10``", "Rounds ``{{value}}`` to the nearest ``{{precision}}`` then displays using a certain amount of decimal places."
|
||||
"``imperial_length({{value}}, {{precision}}, {{input_unit}}, {{output_unit}}, {{suppress_zero_inches}})``", "``imperial_length(3.0, 4, ""foot"", ""foot"", true)`` OR ``imperial_length(3.0, 4, ""foot"", ""foot"", false)``", "``3'`` OR ``3' - 0""``", "The ``{{value}}`` may be specified either as ``foot`` or ``inch`` depending on ``{{input_unit}}``. The ``{{value}}`` is then rounded to the nearest ``1/{{precision}}`` inch, then formatted using fractional feet and inches if ``{{output_unit}}`` is set to ``foot``, or just inches if ``{{output_unit}}`` is set to ``inch``. When ``{{suppress_zero_inches}}`` is ``true`` (default), measurements with zero inches will omit the inch portion (e.g., ``3'`` instead of ``3' - 0""``)."
|
||||
"``sort({{values}})``", "``sort({{mats.Name}})``", "``Name1, Name2``", "Sorts a list of items."
|
||||
"``reverse({{values}})``", "``reverse({{mats.Name}})``", "``Name2, Name1``", "Reverses a list of items."
|
||||
"``join({{separator}}, {{values}})``", "``join("-", {{mats.Name}})``", "``Name1-Name2``", "Joins a list of items with a custom separator. By default, all lists a rendered as comma separated."
|
||||
"``{{value1}}[+-*/]{{value2}}``", "``{{z}}+3``", "``5``", "Does arithmetic. Typical operators such as +, -, \*, and / are allowed and can be mixed with other variables and formatting functions."
|
||||
|
||||
When using queries in an IfcAnnotation tag surround with backticks.
|
||||
Examples:
|
||||
|
||||
Reference in New Issue
Block a user