-
Notifications
You must be signed in to change notification settings - Fork 1
Support need items generation from marked RST in source code #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
9785087
100ebc7
c3c853e
b37bef2
8690aed
1fa2491
d36ab55
2ff9da1
0f11569
36e5f9e
12c71d6
27fabb1
2c39e64
1a0aac3
57ea20f
ffc42ca
1f831dd
6368b4f
64b278f
b0ca459
9f7bbdb
0945f0d
5c93e30
9639c03
97e0e9b
01029db
35b77eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -3,7 +3,29 @@ | |||||
| Directive | ||||||
| ========= | ||||||
|
|
||||||
| .. attention:: ``src-trace`` directive currently only supports :ref:`one-line need definition <oneline>`. | ||||||
| .. attention:: ``src-trace`` directive do NOT supports :ref:`Sphinx-Needs ID Refs <analyse_need_id_refs>`. | ||||||
|
||||||
| .. attention:: ``src-trace`` directive do NOT supports :ref:`Sphinx-Needs ID Refs <analyse_need_id_refs>`. | |
| .. attention:: ``src-trace`` directive does NOT support :ref:`Sphinx-Needs ID Refs <analyse_need_id_refs>`. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| Simplified reStructuredText Parser | ||
| ================================== | ||
|
|
||
| The :ref:`analyse <analyse>` module provides a simplified parser for reStructuredText (reST) directives using the ``Lark`` parsing library. | ||
| It is designed to only parse the RST text extracted by :ref:`RST markers <analyse_rst>`, focusing on specific directive types and their associated options and content. | ||
| By doing so, the parser avoids the complexity of a full reST parser while still capturing the essential structure needed for Sphinx-Needs integration from the source code. | ||
|
|
||
| The parser does't have the Sphinx-Needs directive validation logic. It only checks the syntax of the RST directives and extracts the directive type, argument, options, and content. | ||
juiwenchen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| **Limitations** | ||
|
|
||
| Since the parser does not implement the full reST specification, it has some limitations: | ||
|
|
||
| - Comments in the RST text are not supported. | ||
| - The parser expects consistent indentation for options and content blocks. | ||
| - It only takes an inline directive argument/title (no multi-line arguments/titles). | ||
| - It only takes inline option values (no multi-line option values). | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,6 +3,36 @@ | |||||||||||||||||
| Changelog | ||||||||||||||||||
| ========= | ||||||||||||||||||
|
|
||||||||||||||||||
| .. _`unreleased`: | ||||||||||||||||||
|
|
||||||||||||||||||
| Unreleased | ||||||||||||||||||
| ----------- | ||||||||||||||||||
|
|
||||||||||||||||||
| New and Improved | ||||||||||||||||||
| ................ | ||||||||||||||||||
|
|
||||||||||||||||||
| - ✨ Added RST directive parser for ``analyse`` module to resolve the marked RST into Sphinx-Needs related data. | ||||||||||||||||||
|
|
||||||||||||||||||
| Marked RST blocks can be resolved from the marked RST text in source files using the simplified RST directive parser. | ||||||||||||||||||
| The resolved RST blocks will be dumped into the JSON output along with other extracted markers. | ||||||||||||||||||
| To make the parser more stable, 3 new configuration options are added to control the parsing behavior: | ||||||||||||||||||
|
|
||||||||||||||||||
| - ``leading_sequences``: List of leading character sequences to strip from each line. | ||||||||||||||||||
|
|
||||||||||||||||||
| This option allows users to specify a list of leading character sequences (e.g., ``*``, ``-``) that should be stripped | ||||||||||||||||||
| from each line of the marked RST block before parsing. | ||||||||||||||||||
|
Comment on lines
+20
to
+23
|
||||||||||||||||||
| - ``leading_sequences``: List of leading character sequences to strip from each line. | |
| This option allows users to specify a list of leading character sequences (e.g., ``*``, ``-``) that should be stripped | |
| from each line of the marked RST block before parsing. | |
| - ``strip_leading_sequences``: List of leading character sequences to strip from each line. | |
| This option allows users to specify a list of leading character sequences (e.g., ``*``, ``-``) that should be stripped | |
| from each line of the marked RST block before parsing, by setting the ``strip_leading_sequences`` option. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make this non-jui-wen specific please