Fix: Replace usage of nodes.title by nodes.rubric#50
Conversation
…cturedtext.parse' fails.
…interprated different ways.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
| """ | ||
| Title | ||
| ===== | ||
|
|
||
| .. ewokstasks:: ewoksnoexisting.tasks.MyNonExistingTask | ||
| :task-type: class | ||
| """, |
There was a problem hiding this comment.
Adding the title because the rubric cannot be the first element. It needs a parent else restructuredtext.parse fails.
It seems the clearer way to fix this. Else we could have mock or maybe used another function than restructuredtext.parse but I haven't saw it.
| assert len(parsed_nodes) == 5 | ||
| _assert_class_task_nodes(parsed_nodes[1:]) |
There was a problem hiding this comment.
Then we just need to 'ignore' the title node.
| # warning: A rubric is like an informal heading that doesn’t correspond to the document’s structure, i.e. it does not create a table of contents node. | ||
| # see https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#presentational | ||
| # so ultimately it can be interpreted different ways. | ||
| assert_node(parsed_nodes[0], (nodes.subtitle, nodes.rubric, str), name) |
There was a problem hiding this comment.
This is the 'tricky part'. It seems that the rubric is presentational and can be converted to subtitle by DocUtils transform during the parsing.
This transformation can also be defined by themes...
Nevertheless from what I read from the issue and structure this will be better than using nodes.title.
nodes.title by nodes.rubric
| @@ -199,7 +199,7 @@ def additional_model_nodes( | |||
| for task in tasks: | |||
| for model_name, model_fields in task["submodels"].items(): | |||
| section = nodes.section("", ids=[model_name]) | |||
| section.append(nodes.title("", model_name.split(".")[-1])) | |||
| section.append(nodes.rubric("", model_name.split(".")[-1])) | |||
|
|
|||
| section.append(_field_list(directive, {"fields": model_fields})) | |||
| model_sections.append(section) | |||
| @@ -209,7 +209,7 @@ def additional_model_nodes( | |||
|
|
|||
| return nodes.section( | |||
| "", | |||
| nodes.title("", "Additional models"), | |||
| nodes.rubric("", "Additional models"), | |||
| *model_sections, | |||
| ids=["Additional models"], | |||
| ) | |||
There was a problem hiding this comment.
Those are the 'real' modification on the processing side. Others are to update the tests.
|
Do we still have the tasks in the index/TOC? For example https://ewoksfluo.readthedocs.io/en/stable/reference/tasks.html
|
|
Great effort but since we can't reproduce #6, I'd say we can close this and keep it for future reference in case it happens. |



Scope
Closes #6
nodes.titlebynodes.rubricassert_task_preamblehas been changed because it appears that thenodes.rubriccan be interpreted as nodes.subtitles... See dedicated note.note: CI fails because of an unrelated ruff error.