aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsilby <[email protected]>2025-01-15 12:07:26 -0800
committerGitHub <[email protected]>2025-01-15 12:07:26 -0800
commit806dcb08498fd04e23ecec1ec89ecd0d8005fcd0 (patch)
tree858ac85298af05d7b19c8ac055c4d3d518347333
parent2b6554c475e6e6e500b8cbb39c90b28cc122c423 (diff)
Consume blanks after =encoding in pod reader (#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 #10537
-rw-r--r--src/Text/Pandoc/Readers/Pod.hs1
-rw-r--r--test/command/10537.md24
-rw-r--r--test/pod-reader.native3
3 files changed, 26 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Pod.hs b/src/Text/Pandoc/Readers/Pod.hs
index 544d7f3ae..4f4529eba 100644
--- a/src/Text/Pandoc/Readers/Pod.hs
+++ b/src/Text/Pandoc/Readers/Pod.hs
@@ -112,6 +112,7 @@ encoding :: PandocMonad m => PodParser m Blocks
encoding = do
cmd "encoding"
anyLine
+ optional blanklines
logMessage $ IgnoredElement "=encoding; Pandoc requires UTF-8 input"
return mempty
diff --git a/test/command/10537.md b/test/command/10537.md
new file mode 100644
index 000000000..14cf304d6
--- /dev/null
+++ b/test/command/10537.md
@@ -0,0 +1,24 @@
+```
+% pandoc -f pod -t html
+=encoding utf8
+
+=head1 NAME
+
+Test document
+^D
+<h1>NAME</h1>
+<p>Test document</p>
+```
+
+```
+% pandoc -f pod -t html
+=encoding utf8
+
+
+=head1 NAME
+
+Test document
+^D
+<h1>NAME</h1>
+<p>Test document</p>
+```
diff --git a/test/pod-reader.native b/test/pod-reader.native
index 07603a80f..39572e9b9 100644
--- a/test/pod-reader.native
+++ b/test/pod-reader.native
@@ -22,8 +22,7 @@
, Space
, Str "pandoc."
]
-, Para
- [ Str "=head2" , Space , Str "Head" , Space , Str "2" ]
+, Header 2 ( "" , [] , [] ) [ Str "Head" , Space , Str "2" ]
, Header
3
( "" , [] , [] )