diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Writers/ConTeXt.hs | 7 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 6 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Writers/ConTeXt.hs b/src/Text/Pandoc/Writers/ConTeXt.hs index 63113ac82..f0f4cd00e 100644 --- a/src/Text/Pandoc/Writers/ConTeXt.hs +++ b/src/Text/Pandoc/Writers/ConTeXt.hs @@ -31,7 +31,7 @@ Conversion of 'Pandoc' format into ConTeXt. -} module Text.Pandoc.Writers.ConTeXt ( writeConTeXt ) where import Control.Monad.State.Strict -import Data.Char (ord) +import Data.Char (ord, isDigit) import Data.List (intercalate, intersperse) import Data.Maybe (mapMaybe) import Data.Text (Text) @@ -104,8 +104,9 @@ pandocToConTeXt options (Pandoc meta blocks) = do $ defField "number-sections" (writerNumberSections options) $ maybe id (defField "context-lang") mblang $ (case getField "papersize" metadata of - Just ("a4" :: String) -> resetField "papersize" - ("A4" :: String) + Just (('a':d:ds) :: String) + | all isDigit (d:ds) -> resetField "papersize" + (('A':d:ds) :: String) _ -> id) metadata let context' = defField "context-dir" (toContextDir $ getField "dir" context) context diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 156af4bb2..8620f989b 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -253,8 +253,10 @@ pandocToLaTeX options (Pandoc meta blocks) = do defField "section-titles" True $ defField "geometry" geometryFromMargins $ (case getField "papersize" metadata of - Just ("A4" :: String) -> resetField "papersize" - ("a4" :: String) + -- uppercase a4, a5, etc. + Just (('A':d:ds) :: String) + | all isDigit (d:ds) -> resetField "papersize" + (('a':d:ds) :: String) _ -> id) metadata let context' = |