Skip to content

Commit e76ef5f

Browse files
silbychristopherkenny
authored andcommitted
Consume blanks after =encoding in pod reader (jgm#10544)
The reader did not properly consume empty lines after =encoding commands, which produced various incorrect parses depending on the content between there and the next command. Fixes jgm#10537
1 parent 16081b8 commit e76ef5f

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

src/Text/Pandoc/Readers/Pod.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ encoding :: PandocMonad m => PodParser m Blocks
112112
encoding = do
113113
cmd "encoding"
114114
anyLine
115+
optional blanklines
115116
logMessage $ IgnoredElement "=encoding; Pandoc requires UTF-8 input"
116117
return mempty
117118

test/command/10537.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
```
2+
% pandoc -f pod -t html
3+
=encoding utf8
4+
5+
=head1 NAME
6+
7+
Test document
8+
^D
9+
<h1>NAME</h1>
10+
<p>Test document</p>
11+
```
12+
13+
```
14+
% pandoc -f pod -t html
15+
=encoding utf8
16+
17+
18+
=head1 NAME
19+
20+
Test document
21+
^D
22+
<h1>NAME</h1>
23+
<p>Test document</p>
24+
```

test/pod-reader.native

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
, Space
2323
, Str "pandoc."
2424
]
25-
, Para
26-
[ Str "=head2" , Space , Str "Head" , Space , Str "2" ]
25+
, Header 2 ( "" , [] , [] ) [ Str "Head" , Space , Str "2" ]
2726
, Header
2827
3
2928
( "" , [] , [] )

0 commit comments

Comments
 (0)