From 5ddd7b121e1aea061b3e7b831dabbd13311929ff Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Tue, 22 Jan 2019 21:39:26 -0800
Subject: [PATCH] LaTeX reader: support `\endinput`. Closes #5233.

---
 src/Text/Pandoc/Readers/LaTeX.hs | 1 +
 test/command/5233.md             | 9 +++++++++
 2 files changed, 10 insertions(+)
 create mode 100644 test/command/5233.md

diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index f5d8527dd..5c0279fce 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -1765,6 +1765,7 @@ blockCommands = M.fromList
          addMeta "bibliography" . splitBibs . toksToString))
    , ("addbibresource", mempty <$ (skipopts *> braced >>=
          addMeta "bibliography" . splitBibs . toksToString))
+   , ("endinput", mempty <$ skipMany tok)
    -- includes
    , ("lstinputlisting", inputListing)
    , ("inputminted", inputMinted)
diff --git a/test/command/5233.md b/test/command/5233.md
new file mode 100644
index 000000000..0c92e955e
--- /dev/null
+++ b/test/command/5233.md
@@ -0,0 +1,9 @@
+```
+% pandoc -f latex -t plain
+foo
+\endinput
+bar
+^D
+foo
+```
+