git.iko.soy/typeable/pandoc
on master help sign in
Org reader: read `#+INSTITUTE` values as text with markup
d2d5eb8Albert Krewinkel
doc/org.md+5
@@ -93,6 +93,11 @@ Pandoc recognizes some export options not used by Emacs Org.
93- HEADER-INCLUDES: like HTML_HEAD and, LATEX_HEADER, but treats
93- HEADER-INCLUDES: like HTML_HEAD and, LATEX_HEADER, but treats
94 the option's value as normal text with markup.
94 the option's value as normal text with markup.
95
95
96+- INSTITUTE: Affiliation of the author; the value is read as text
97+ with markup and is stored in the `institute` metadata field. The
98+ field is included by default on the title slide of beamer
99+ presentations.
100+
96
101
97Citations
102Citations
98=========
103=========
src/Text/Pandoc/Readers/Org/Meta.hs+13−7
@@ -73,20 +73,26 @@ metaKey = T.toLower <$> many1Char (noneOf ": \n\r")
73
73
74exportSettingHandlers :: PandocMonad m => Map Text (OrgParser m ())
74exportSettingHandlers :: PandocMonad m => Map Text (OrgParser m ())
75exportSettingHandlers = Map.fromList
75exportSettingHandlers = Map.fromList
76− [ ("result" , fmap pure anyLine `parseThen` discard) -- RESULT is never an export setting
76+ [ ("result" , fmap pure anyLine `parseThen` discard)
77+ -- Common settings
77− , ("author" , lineOfInlines `parseThen` collectLines "author")
78+ , ("author" , lineOfInlines `parseThen` collectLines "author")
78− , ("keywords" , lineOfInlines `parseThen` collectLines "keywords")
79− , ("date" , lineOfInlines `parseThen` setField "date")
79+ , ("date" , lineOfInlines `parseThen` setField "date")
80− , ("description", lineOfInlines `parseThen` collectLines "description")
80+ , ("description", lineOfInlines `parseThen` collectLines "description")
81+ , ("keywords" , lineOfInlines `parseThen` collectLines "keywords")
81− , ("title" , lineOfInlines `parseThen` collectLines "title")
82+ , ("title" , lineOfInlines `parseThen` collectLines "title")
82− , ("nocite" , lineOfInlines `parseThen` collectAsList "nocite")
83+ -- LaTeX
83 , ("latex_class", fmap pure anyLine `parseThen` setField "documentclass")
84 , ("latex_class", fmap pure anyLine `parseThen` setField "documentclass")
84 , ("latex_class_options", (pure . T.filter (`notElem` ("[]" :: String)) <$> anyLine)
85 , ("latex_class_options", (pure . T.filter (`notElem` ("[]" :: String)) <$> anyLine)
85 `parseThen` setField "classoption")
86 `parseThen` setField "classoption")
86 , ("latex_header", metaExportSnippet "latex" `parseThen`
87 , ("latex_header", metaExportSnippet "latex" `parseThen`
87 collectAsList "header-includes")
88 collectAsList "header-includes")
89+ -- HTML
88 , ("html_head" , metaExportSnippet "html" `parseThen`
90 , ("html_head" , metaExportSnippet "html" `parseThen`
89 collectAsList "header-includes")
91 collectAsList "header-includes")
92+ -- pandoc-specific
93+ , ("nocite" , lineOfInlines `parseThen` collectLines "nocite")
94+ , ("header-includes", lineOfInlines `parseThen` collectLines "header-includes")
95+ , ("institute" , lineOfInlines `parseThen` collectLines "institute")
90 ]
96 ]
91
97
92parseThen :: PandocMonad m
98parseThen :: PandocMonad m
test/Tests/Readers/Org/Meta.hs+4
@@ -133,6 +133,10 @@ tests =
133 inclList = MetaList [MetaInlines (toList html)]
133 inclList = MetaList [MetaInlines (toList html)]
134 meta = setMeta "header-includes" inclList nullMeta
134 meta = setMeta "header-includes" inclList nullMeta
135 in Pandoc meta mempty
135 in Pandoc meta mempty
136+
137+ , "Institute" =:
138+ "#+INSTITUTE: ACME Inc." =?>
139+ Pandoc (setMeta "institute" ("ACME Inc." :: Inlines) nullMeta) mempty
136 ]
140 ]
137
141
138 , "Properties drawer" =:
142 , "Properties drawer" =: