summaryrefslogtreecommitdiffstats
path: root/parser/pageparser/pagelexer.go
diff options
context:
space:
mode:
Diffstat (limited to 'parser/pageparser/pagelexer.go')
-rw-r--r--parser/pageparser/pagelexer.go17
1 files changed, 13 insertions, 4 deletions
diff --git a/parser/pageparser/pagelexer.go b/parser/pageparser/pagelexer.go
index b68850b10..e02475d42 100644
--- a/parser/pageparser/pagelexer.go
+++ b/parser/pageparser/pagelexer.go
@@ -408,15 +408,22 @@ func (l *pageLexer) lexFrontMatterSection(tp ItemType, delimr rune, name string,
}
}
+ // Let front matter start at line 1
+ wasEndOfLine := l.consumeCRLF()
// We don't care about the delimiters.
l.ignore()
+ var r rune
+
for {
- r := l.next()
- if r == eof {
- return l.errorf("EOF looking for end %s front matter delimiter", name)
+ if !wasEndOfLine {
+ r = l.next()
+ if r == eof {
+ return l.errorf("EOF looking for end %s front matter delimiter", name)
+ }
}
- if isEndOfLine(r) {
+
+ if wasEndOfLine || isEndOfLine(r) {
if l.hasPrefix(delim) {
l.emit(tp)
l.pos += 3
@@ -425,6 +432,8 @@ func (l *pageLexer) lexFrontMatterSection(tp ItemType, delimr rune, name string,
break
}
}
+
+ wasEndOfLine = false
}
return lexMainSection