commit 1acb0d8394e38bd030f358481228e416567e7531 (patch)
parent 17ed3d13e0ac6e04071f81bae2c02694351407e2
Author: Alex Karle <alex@alexkarle.com>
Date: Mon, 20 Dec 2021 01:10:38 -0500
Remove extra newlines from lists/list items
I'm not sure why I convinced myself these were necessary... it *is*
necessary to render the newlines in the list item content (because the
spaces are NOT rendered -> no smush), but it's not necessary to have
newlines between the tags :)
Saving internet bandwidth one newline at a time!
Diffstat:
5 files changed, 25 insertions(+), 26 deletions(-)
diff --git a/blag.c b/blag.c
@@ -54,14 +54,14 @@ void putesc(int c) {
void newlist(state *s) {
s->in = LIST;
s->previndent = s->indent;
- printf("\n<%s>\n<li>\n", s->ol ? "ol" : "ul");
+ printf("<%s>\n<li>\n", s->ol ? "ol" : "ul");
s->listdepth++;
}
int endlist(state *s) {
s->in = LIST;
s->previndent = s->indent;
- printf("\n</li>\n</%s>\n", s->ol ? "ol" : "ul");
+ printf("</li>\n</%s>\n", s->ol ? "ol" : "ul");
return --s->listdepth;
}
@@ -183,10 +183,10 @@ int parse() {
newlist(&s);
} else if (s.previndent > s.indent) {
endlist(&s);
- printf("\n</li>\n<li>\n");
+ printf("</li>\n<li>\n");
} else {
s.in = LIST;
- printf("\n</li>\n<li>\n");
+ printf("</li>\n<li>\n");
}
}
} else {
diff --git a/test/big.html b/test/big.html
@@ -13,52 +13,40 @@ This is an example blag file!
</p>
<h2>Sub Header 2</h2>
<h3>Woah a third header?</h3>
-
<ul>
<li>
We can have lists??
-
<ul>
<li>
And nested lists??
-
</li>
<li>
And <code>code</code> within lists?
-
</li>
<li>
but not <code>*bold*</code> within code
-
</li>
</ul>
-
</li>
<li>
A tier1 item
-
</li>
</ul>
<p>
This is a new paragraph
that wraps nicely
</p>
-
<ol>
<li>
This is a numbered list
-
</li>
<li>
Cool, huh?
-
<ol>
<li>
yes!
-
</li>
</ol>
-
</li>
</ol>
<p>
diff --git a/test/listwrap.html b/test/listwrap.html
@@ -0,0 +1,15 @@
+<ul>
+<li>
+this is a list
+with a wrapped item
+<ul>
+<li>
+and a subitem
+that wraps too!
+</li>
+</ul>
+</li>
+</ul>
+<p>
+cool!
+</p>
diff --git a/test/listwrap.txt b/test/listwrap.txt
@@ -0,0 +1,6 @@
+- this is a list
+ with a wrapped item
+ - and a subitem
+ that wraps too!
+
+cool!
diff --git a/test/ulist.html b/test/ulist.html
@@ -1,36 +1,26 @@
-
<ul>
<li>
item 1
-
<ul>
<li>
subi
-
</li>
<li>
subi 2
-
</li>
</ul>
-
</li>
<li>
item 2
-
</li>
</ul>
-
<ul>
<li>
it1
-
<ul>
<li>
s1
-
</li>
</ul>
-
</li>
</ul>