Skip to content

Commit

Permalink
Fix lists output
Browse files Browse the repository at this point in the history
  • Loading branch information
aarroyoc committed Jan 18, 2023
1 parent 93dc3b7 commit 3606e95
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions djota.pl
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,9 @@
{ phrase(ast_html_(Child), ChildHtml) },
"<blockquote>", ChildHtml, "</blockquote>".
ast_html_node_(list(type(_, bullet(_), Mode), Items)) -->
"<li>",
"<ul>",
ast_html_node_items_(Items, Mode),
"</li>".
"</ul>".
ast_html_node_(code(Spec, Code)) -->
{ dif(Spec, "=html"), phrase(escape_html_(Html), Code) },
"<pre><code>", Html, "</pre></code>".
Expand Down Expand Up @@ -304,15 +304,15 @@
ast_html_node_items_([], _) --> "".
ast_html_node_items_([item(Item)|Items], loose) -->
{ phrase(ast_html_(Item), Html) },
"<ul>",
"<li>",
Html,
"</ul>",
"</li>",
ast_html_node_items_(Items, loose).
ast_html_node_items_([item([paragraph(Item)])|Items], tight) -->
{ phrase(ast_html_(Item), Html) },
"<ul>",
"<li>",
Html,
"</ul>",
"</li>",
ast_html_node_items_(Items, tight).

escape_html_([]) --> [].
Expand Down
2 changes: 1 addition & 1 deletion test.lgt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ test(list_ast) :-
djota:djot_ast("- Hola\namigos\n\n - Sublist\n- Adios\namigos", [list(type(0, bullet("-"), loose),[item([paragraph([str("Hola amigos")]),list(type(0, bullet("-"), tight),[item([paragraph([str("Sublist")])])])]),item([paragraph([str("Adios amigos")])])])]).

test(list) :-
djota:djot("- Hola\namigos\n\n - Sublist\n- Adios\namigos", "<li><ul><p>Hola amigos</p><li><ul>Sublist</ul></li></ul><ul><p>Adios amigos</p></ul></li>").
djota:djot("- Hola\namigos\n\n - Sublist\n- Adios\namigos", "<ul><li><p>Hola amigos</p><ul><li>Sublist</li></ul></li><li><p>Adios amigos</p></li></ul>").

test(code_block) :-
djota:djot("````\nThis is how you do a code block:\n\n``` ruby\nx = 5 * 6\n```\n````", "<pre><code>\nThis is how you do a code block:\n\n``` ruby\nx = 5 * 6\n```</pre></code>"),
Expand Down

0 comments on commit 3606e95

Please sign in to comment.