Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ generated in the following situations:

### 3.0.0-dev

* [TRLC_RST] Render soft-wrapped description lines as a single RST
paragraph instead of splitting each line into its own paragraph.
Insert a blank line to start a new paragraph.

* [TRLC, BAZEL] Removed the support for the CVC5 binary, and hence the
`--use-cvc5-binary` option is no longer available.
The option `--verify` now uses the CVC5 Python package
Expand Down
2 changes: 1 addition & 1 deletion tools/trlc_rst/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ The following formatting is supported in requirement `description` fields:
| Code block | line ending with `::` followed by indented content | RST literal block |
| Bullet list | lines starting with `-` | RST bullet list |
| Numbered list | lines starting with `1.`, `2.`, … | RST enumerated list |
| Line breaks | any non-empty line | separated by blank lines in RST |
| Soft wraps | consecutive non-empty lines | joined into one RST paragraph; insert a blank line to start a new paragraph |

### Command-line Usage

Expand Down
10 changes: 10 additions & 0 deletions tools/trlc_rst/tests/paragraph-breaks/output.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Requirements
============
.. requirement:definition:: T.REQ_paragraph_breaks

The system shall do X
when condition Y is met.

This is a separate paragraph that
must not be merged with the first.

11 changes: 11 additions & 0 deletions tools/trlc_rst/tests/paragraph-breaks/reqs.trlc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package T

Requirement REQ_paragraph_breaks {
description = '''
The system shall do X
when condition Y is met.

This is a separate paragraph that
must not be merged with the first.
'''
}
5 changes: 5 additions & 0 deletions tools/trlc_rst/tests/paragraph-breaks/schema.rsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package T

type Requirement {
description optional String
}
8 changes: 8 additions & 0 deletions tools/trlc_rst/tests/soft-wraps/output.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Requirements
============
.. requirement:definition:: T.REQ_soft_wraps

The system shall do X
when condition Y is met
and Z is configured.

9 changes: 9 additions & 0 deletions tools/trlc_rst/tests/soft-wraps/reqs.trlc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package T

Requirement REQ_soft_wraps {
description = '''
The system shall do X
when condition Y is met
and Z is configured.
'''
}
5 changes: 5 additions & 0 deletions tools/trlc_rst/tests/soft-wraps/schema.rsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package T

type Requirement {
description optional String
}
13 changes: 2 additions & 11 deletions tools/trlc_rst/trlc_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,8 @@ def _preprocess_description(description: str, indent: int = 3) -> str:
- RST directives: ``.. image::``, ``.. figure::``, etc. with options
- Bullet lists: Lines starting with -
- Numbered lists: Lines starting with 1., 2., etc.
- Line breaks: Preserved between all content lines"""
- Soft wraps: Consecutive non-empty lines are joined into a single
RST paragraph; insert a blank line to start a new paragraph."""
if not description:
return description

Expand Down Expand Up @@ -574,16 +575,6 @@ def _md_image_sub(m):
next_line.lstrip()
)

# Add blank line after non-list lines to preserve line breaks
# (unless next line is empty, we're at the end, or we're in a code block)
elif (
not is_list_item
and not in_code_block
and i < len(lines) - 1
and lines[i + 1].strip()
):
processed_lines.append("")

prev_was_list_item = is_list_item
else:
# Preserve empty lines for paragraph separation
Expand Down
Loading