-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
markdown/rst: Support __map_ and nested parameters (#164)
* Support nested parameters and maps for RST * Add read_only info to RST template * Use map parameters for AutoDocumentation * Add test for markdown generation * Use jinja indentation instead of regex * Add dynamic_parameters also to DefaultConfig * Proper fromat of default yaml config * Proper format of the default yaml file * Fix imported function names * Add a jinja2 filter to create valid multiline c++ string literals * Handle empty strings for descriptions
- Loading branch information
1 parent
2734b70
commit 360be28
Showing
8 changed files
with
194 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
..._parameter_library_py/generate_parameter_library_py/jinja_templates/cpp/declare_parameter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 8 additions & 5 deletions
13
...e_parameter_library_py/generate_parameter_library_py/jinja_templates/rst/parameter_detail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
{{name}} ({{type}}){% if description|length %} | ||
{{description}} | ||
{{name}} ({{type}}){%- filter indent(width=2) %}{% if description|length %} | ||
{{description}} | ||
{% endif %} | ||
{%- if read_only %} | ||
Read only: {{read_only}} | ||
{% endif %} | ||
{%- if default_value|length %} | ||
Default: {{default_value}} | ||
Default: {{default_value}} | ||
{% endif %} | ||
{%- if constraints|length %} | ||
|
||
Constraints: | ||
Constraints: | ||
|
||
{%- filter indent(width=2) %} | ||
|
||
{{constraints}} | ||
{% endfilter -%} | ||
|
||
{% endif %} | ||
{% endfilter -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
generate_parameter_library_py/generate_parameter_library_py/string_filters_cpp.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# -*- coding: utf-8 -*- | ||
def valid_string_cpp(description): | ||
""" | ||
Filter a string to make it a valid C++ string literal. | ||
Args: | ||
description (str): The input string to be filtered. | ||
Returns: | ||
str: The filtered string that is a valid C++ string. | ||
""" | ||
if description: | ||
filtered_description = ( | ||
description.replace('\\', '\\\\').replace('"', '\\"').replace('`', '') | ||
) | ||
# create a quote delimited string for every line | ||
filtered_description = '\n'.join( | ||
f'"{line}"' for line in filtered_description.splitlines() | ||
) | ||
return filtered_description | ||
else: | ||
return '""' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters