Skip to content
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

👌 IMPROVE: Add bullet attribute to bullet_list node #465

Merged
merged 2 commits into from
Dec 16, 2021
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
2 changes: 2 additions & 0 deletions myst_parser/docutils_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,8 @@ def render_text(self, token: SyntaxTreeNode) -> None:

def render_bullet_list(self, token: SyntaxTreeNode) -> None:
list_node = nodes.bullet_list()
if token.markup:
list_node["bullet"] = token.markup
if token.attrs.get("class"):
# this is used e.g. by tasklist
list_node["classes"] = str(token.attrs["class"]).split()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_renderers/fixtures/amsmath.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ In list:
\end{equation}
.
<document source="notset">
<bullet_list>
<bullet_list bullet="-">
<list_item>
<target ids="equation-mock-uuid">
<math_block classes="amsmath" docname="mock_docname" label="mock-uuid" nowrap="True" number="1" xml:space="preserve">
Expand Down
2 changes: 1 addition & 1 deletion tests/test_renderers/fixtures/sphinx_directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ acks (`sphinx.directives.other.Acks`):
.
<document source="notset">
<acks>
<bullet_list>
<bullet_list bullet="-">
<list_item>
<paragraph>
name
Expand Down
15 changes: 10 additions & 5 deletions tests/test_renderers/fixtures/syntax_elements.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,18 @@ Block Quote:
Bullet List:
.
- *foo*
* bar
.
<document source="notset">
<bullet_list>
<bullet_list bullet="-">
<list_item>
<paragraph>
<emphasis>
foo
<bullet_list bullet="*">
<list_item>
<paragraph>
bar
.

--------------------------
Expand All @@ -231,15 +236,15 @@ Nested Bullets
- d
.
<document source="notset">
<bullet_list>
<bullet_list bullet="-">
<list_item>
<paragraph>
a
<bullet_list>
<bullet_list bullet="-">
<list_item>
<paragraph>
b
<bullet_list>
<bullet_list bullet="-">
<list_item>
<paragraph>
c
Expand Down Expand Up @@ -601,7 +606,7 @@ finish
<block_quote>
<paragraph>
a
<bullet_list>
<bullet_list bullet="-">
<list_item>
<paragraph>
b
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,17 @@
a comment 2
<paragraph>
this is a second paragraph
<bullet_list>
<bullet_list bullet="-">
<list_item>
<paragraph>
a list
<bullet_list>
<bullet_list bullet="-">
<list_item>
<paragraph>
a sub list
<comment xml:space="preserve">
a comment 3
<bullet_list>
<bullet_list bullet="-">
<list_item>
<paragraph>
new list?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,17 @@
a comment 2
<paragraph>
this is a second paragraph
<bullet_list>
<bullet_list bullet="-">
<list_item>
<paragraph>
a list
<bullet_list>
<bullet_list bullet="-">
<list_item>
<paragraph>
a sub list
<comment xml:space="preserve">
a comment 3
<bullet_list>
<bullet_list bullet="-">
<list_item>
<paragraph>
new list?
Expand Down
6 changes: 3 additions & 3 deletions tests/test_sphinx/test_sphinx_builds/test_basic.sphinx3.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,17 @@
a comment 2
<paragraph>
this is a second paragraph
<bullet_list>
<bullet_list bullet="-">
<list_item>
<paragraph>
a list
<bullet_list>
<bullet_list bullet="-">
<list_item>
<paragraph>
a sub list
<comment xml:space="preserve">
a comment 3
<bullet_list>
<bullet_list bullet="-">
<list_item>
<paragraph>
new list?
Expand Down
6 changes: 3 additions & 3 deletions tests/test_sphinx/test_sphinx_builds/test_basic.sphinx4.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,17 @@
a comment 2
<paragraph>
this is a second paragraph
<bullet_list>
<bullet_list bullet="-">
<list_item>
<paragraph>
a list
<bullet_list>
<bullet_list bullet="-">
<list_item>
<paragraph>
a sub list
<comment xml:space="preserve">
a comment 3
<bullet_list>
<bullet_list bullet="-">
<list_item>
<paragraph>
new list?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
linkify URL:
<reference refuri="http://www.example.com">
www.example.com
<bullet_list classes="contains-task-list">
<bullet_list bullet="-" classes="contains-task-list">
<list_item classes="task-list-item">
<paragraph>
<raw format="html" xml:space="preserve">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
linkify URL:
<reference refuri="http://www.example.com">
www.example.com
<bullet_list classes="contains-task-list">
<bullet_list bullet="-" classes="contains-task-list">
<list_item classes="task-list-item">
<paragraph>
<raw format="html" xml:space="preserve">
Expand Down
2 changes: 1 addition & 1 deletion tests/test_sphinx/test_sphinx_builds/test_footnotes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<footnote_reference auto="1" docname="footnote_md" ids="id7" refid="e">
5
<block_quote>
<bullet_list>
<bullet_list bullet="-">
<list_item>
<transition classes="footnotes">
<footnote auto="1" backrefs="id1" docname="footnote_md" ids="c" names="c">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
texte 4 en
<strong>
gras
<bullet_list>
<bullet_list bullet="*">
<list_item>
<paragraph>
texte 5 en
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
texte 4 en
<strong>
gras
<bullet_list>
<bullet_list bullet="*">
<list_item>
<paragraph>
texte 5 en
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
texte 4 en
<strong>
gras
<bullet_list>
<bullet_list bullet="*">
<list_item>
<paragraph>
texte 5 en
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
texte 4 en
<strong>
gras
<bullet_list>
<bullet_list bullet="*">
<list_item>
<paragraph>
texte 5 en
Expand Down