Skip to content

Commit

Permalink
馃憣 IMPROVE: Add bullet attribute to bullet_list node (#465)
Browse files Browse the repository at this point in the history
This brings it inline with the AST produced by RST
  • Loading branch information
chrisjsewell committed Dec 16, 2021
1 parent 11fb239 commit b7ab7fc
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 26 deletions.
2 changes: 2 additions & 0 deletions myst_parser/docutils_renderer.py
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
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
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
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
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
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
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
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
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
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
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
Expand Up @@ -18,7 +18,7 @@
texte 4 en
<strong>
gras
<bullet_list>
<bullet_list bullet="*">
<list_item>
<paragraph>
texte 5 en
Expand Down
Expand Up @@ -18,7 +18,7 @@
texte 4 en
<strong>
gras
<bullet_list>
<bullet_list bullet="*">
<list_item>
<paragraph>
texte 5 en
Expand Down
Expand Up @@ -18,7 +18,7 @@
texte 4 en
<strong>
gras
<bullet_list>
<bullet_list bullet="*">
<list_item>
<paragraph>
texte 5 en
Expand Down
Expand Up @@ -18,7 +18,7 @@
texte 4 en
<strong>
gras
<bullet_list>
<bullet_list bullet="*">
<list_item>
<paragraph>
texte 5 en
Expand Down

0 comments on commit b7ab7fc

Please sign in to comment.