From 4438ff17fb2ce8a1d9991e5c530aaaf5547b7bc4 Mon Sep 17 00:00:00 2001
From: Jesse Rosenthal <jrosenthal@jhu.edu>
Date: Thu, 18 Feb 2016 23:35:38 -0500
Subject: [PATCH] LaTeX writer: clean up options parser.

Make sure that we require the closing bracket.
---
 src/Text/Pandoc/Writers/LaTeX.hs | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 5ac166de2..4e4279ec5 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -1259,10 +1259,11 @@ deNote x = x
 pDocumentOptions :: P.Parsec String () [String]
 pDocumentOptions = do
   P.char '['
-  P.sepBy
-    (P.many $
-     P.spaces *> P.noneOf (" ,]" :: String) <* P.spaces)
+  opts <- P.sepBy
+    (P.many $ P.spaces *> P.noneOf (" ,]" :: String) <* P.spaces)
     (P.char ',')
+  P.char ']'
+  return opts
 
 pDocumentClass :: P.Parsec String () String
 pDocumentClass =