summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-05-04 23:33:40 +0200
committerLaurenz <laurmaedje@gmail.com>2022-05-04 23:34:02 +0200
commit15ef72cca427c63b2e545d645b49ff27aecffad6 (patch)
treea9ec17c8be0b3f2f577907a4ccedd91fe853907e
parent1bca9ccecb9edb583a0a94bd3611147b66909ab9 (diff)
Fix empty heading
-rw-r--r--src/parse/mod.rs2
-rw-r--r--tests/ref/structure/heading.pngbin22641 -> 24525 bytes
-rw-r--r--tests/ref/structure/list.pngbin20169 -> 20656 bytes
-rw-r--r--tests/typ/structure/heading.typ6
-rw-r--r--tests/typ/structure/list.typ4
5 files changed, 11 insertions, 1 deletions
diff --git a/src/parse/mod.rs b/src/parse/mod.rs
index b473c9af..86d18cba 100644
--- a/src/parse/mod.rs
+++ b/src/parse/mod.rs
@@ -285,7 +285,7 @@ fn heading(p: &mut Parser, at_start: bool) {
while p.eat_if(NodeKind::Eq) {}
if at_start && p.peek().map_or(true, |kind| kind.is_space()) {
- p.eat_while(|kind| kind.is_space());
+ p.eat_while(|kind| kind == &NodeKind::Space(0));
markup_line(p);
marker.end(p, NodeKind::Heading);
} else {
diff --git a/tests/ref/structure/heading.png b/tests/ref/structure/heading.png
index 3e12b2cf..7ad228ab 100644
--- a/tests/ref/structure/heading.png
+++ b/tests/ref/structure/heading.png
Binary files differ
diff --git a/tests/ref/structure/list.png b/tests/ref/structure/list.png
index 7a60e1e5..5d0f03c0 100644
--- a/tests/ref/structure/list.png
+++ b/tests/ref/structure/list.png
Binary files differ
diff --git a/tests/typ/structure/heading.typ b/tests/typ/structure/heading.typ
index de95c35b..496181bd 100644
--- a/tests/typ/structure/heading.typ
+++ b/tests/typ/structure/heading.typ
@@ -1,6 +1,12 @@
// Test headings.
---
+#show node: heading as text(blue, node.body)
+
+=
+No heading
+
+---
// Different number of equals signs.
= Level 1
diff --git a/tests/typ/structure/list.typ b/tests/typ/structure/list.typ
index 77e153c7..5c410a3f 100644
--- a/tests/typ/structure/list.typ
+++ b/tests/typ/structure/list.typ
@@ -1,6 +1,10 @@
// Test lists.
---
+-
+No list
+
+---
_Shopping list_
#list(attached: true)[Apples][Potatoes][Juice]