git.iko.soy/typeable/pandoc
on master help sign in
Replace org #+KEYWORDS with #+keywords

As of ~2 years ago, lower case keywords became the standard (though they are handled case insensitive, as always): https://code.orgmode.org/bzg/org-mode/commit/13424336a6f30c50952d291e7a82906c1210daf0 Upper case keywords are exclusive to the manual: - https://orgmode.org/list/871s50zn6p.fsf@nicolasgoaziou.fr/ - https://orgmode.org/list/87tuuw3n15.fsf@nicolasgoaziou.fr/

commit0306eec5fa3591fc864d9e2e3c0b84a1229509e6 authorTEC <tec@tecosaur.com> dateWed 18 Nov 2020, 02:06 (6 years ago) parent224a501
16 files changed+237−237
data/templates/default.org+3−3 src/Text/Pandoc/Readers/Org/Blocks.hs+11−11 src/Text/Pandoc/Writers/Org.hs+16−16 test/Tests/Readers/Org/Block.hs+21−21 test/Tests/Readers/Org/Block/CodeBlock.hs+32−32 test/Tests/Readers/Org/Block/Figure.hs+8−8 test/Tests/Readers/Org/Block/Header.hs+3−3 test/Tests/Readers/Org/Block/Table.hs+2−2 test/Tests/Readers/Org/Inline.hs+1−1 test/Tests/Readers/Org/Meta.hs+25−25 test/command/3706.md+8−8 test/command/4186.md+8−8 test/command/5178.md+10−10 test/org-select-tags.org+2−2 test/tables.org+3−3 test/writer.org+84−84
data/templates/default.org+3−3
@@ -1,12 +1,12 @@
11$if(title)$
2−#+TITLE: $title$
2+#+title: $title$
33
44$endif$
55$if(author)$
6−#+AUTHOR: $for(author)$$author$$sep$; $endfor$
6+#+author: $for(author)$$author$$sep$; $endfor$
77$endif$
88$if(date)$
9−#+DATE: $date$
9+#+date: $date$
1010
1111$endif$
1212$for(header-includes)$
src/Text/Pandoc/Readers/Org/Blocks.hs+11−11
@@ -111,23 +111,23 @@ attrFromBlockAttributes BlockAttributes{..} =
111111stringyMetaAttribute :: Monad m => OrgParser m (Text, Text)
112112stringyMetaAttribute = try $ do
113113 metaLineStart
114− attrName <- T.toUpper <$> many1TillChar nonspaceChar (char ':')
114+ attrName <- T.toLower <$> many1TillChar nonspaceChar (char ':')
115115 skipSpaces
116116 attrValue <- anyLine <|> ("" <$ newline)
117117 return (attrName, attrValue)
118118
119119-- | Parse a set of block attributes. Block attributes are given through
120−-- lines like @#+CAPTION: block caption@ or @#+ATTR_HTML: :width 20@.
120+-- lines like @#+caption: block caption@ or @#+attr_html: :width 20@.
121121-- Parsing will fail if any line contains an attribute different from
122122-- those attributes known to work on blocks.
123123blockAttributes :: PandocMonad m => OrgParser m BlockAttributes
124124blockAttributes = try $ do
125125 kv <- many stringyMetaAttribute
126126 guard $ all (isBlockAttr . fst) kv
127− let caption = foldl' (appendValues "CAPTION") Nothing kv
128− let kvAttrs = foldl' (appendValues "ATTR_HTML") Nothing kv
129− let name = lookup "NAME" kv
130− let label = lookup "LABEL" kv
127+ let caption = foldl' (appendValues "caption") Nothing kv
128+ let kvAttrs = foldl' (appendValues "attr_html") Nothing kv
129+ let name = lookup "name" kv
130+ let label = lookup "label" kv
131131 caption' <- traverse (parseFromString inlines . (<> "\n")) caption
132132 kvAttrs' <- parseFromString keyValues . (<> "\n") $ fromMaybe mempty kvAttrs
133133 return BlockAttributes
@@ -139,9 +139,9 @@ blockAttributes = try $ do
139139 where
140140 isBlockAttr :: Text -> Bool
141141 isBlockAttr = flip elem
142− [ "NAME", "LABEL", "CAPTION"
143− , "ATTR_HTML", "ATTR_LATEX"
144− , "RESULTS"
142+ [ "name", "label", "caption"
143+ , "attr_html", "attr_latex"
144+ , "results"
145145 ]
146146
147147 appendValues :: Text -> Maybe Text -> (Text, Text) -> Maybe Text
@@ -170,10 +170,10 @@ keyValues = try $
170170
171171
172172--
173−-- Org Blocks (#+BEGIN_... / #+END_...)
173+-- Org Blocks (#+begin_... / #+end_...)
174174--
175175
176−-- | Read an org-mode block delimited by #+BEGIN_TYPE and #+END_TYPE.
176+-- | Read an org-mode block delimited by #+begin_type and #+end_type.
177177orgBlock :: PandocMonad m => OrgParser m (F Blocks)
178178orgBlock = try $ do
179179 blockAttrs <- blockAttributes
src/Text/Pandoc/Writers/Org.hs+16−16
@@ -106,7 +106,7 @@ blockToOrg (Para [Image attr txt (src,tgt)])
106106 | Just tit <- T.stripPrefix "fig:" tgt = do
107107 capt <- if null txt
108108 then return empty
109− else ("#+CAPTION: " <>) `fmap` inlineListToOrg txt
109+ else ("#+caption: " <>) `fmap` inlineListToOrg txt
110110 img <- inlineToOrg (Image attr txt (src,tit))
111111 return $ capt $$ img $$ blankline
112112blockToOrg (Para inlines) = do
@@ -121,11 +121,11 @@ blockToOrg (LineBlock lns) = do
121121 let joinWithBlankLines = mconcat . intersperse blankline
122122 let prettifyStanza ls = joinWithLinefeeds <$> mapM inlineListToOrg ls
123123 contents <- joinWithBlankLines <$> mapM prettifyStanza (splitStanza lns)
124− return $ blankline $$ "#+BEGIN_VERSE" $$
125− nest 2 contents $$ "#+END_VERSE" <> blankline
124+ return $ blankline $$ "#+begin_verse" $$
125+ nest 2 contents $$ "#+end_verse" <> blankline
126126blockToOrg (RawBlock "html" str) =
127− return $ blankline $$ "#+BEGIN_HTML" $$
128− nest 2 (literal str) $$ "#+END_HTML" $$ blankline
127+ return $ blankline $$ "#+begin_html" $$
128+ nest 2 (literal str) $$ "#+end_html" $$ blankline
129129blockToOrg b@(RawBlock f str)
130130 | isRawFormat f = return $ literal str
131131 | otherwise = do
@@ -148,19 +148,19 @@ blockToOrg (CodeBlock (_,classes,kvs) str) = do
148148 else ""
149149 let at = map pandocLangToOrg classes `intersect` orgLangIdentifiers
150150 let (beg, end) = case at of
151− [] -> ("#+BEGIN_EXAMPLE" <> numberlines, "#+END_EXAMPLE")
152− (x:_) -> ("#+BEGIN_SRC " <> x <> numberlines, "#+END_SRC")
151+ [] -> ("#+begin_example" <> numberlines, "#+end_example")
152+ (x:_) -> ("#+begin_src " <> x <> numberlines, "#+end_src")
153153 return $ literal beg $$ nest 2 (literal str) $$ text end $$ blankline
154154blockToOrg (BlockQuote blocks) = do
155155 contents <- blockListToOrg blocks
156− return $ blankline $$ "#+BEGIN_QUOTE" $$
157− nest 2 contents $$ "#+END_QUOTE" $$ blankline
156+ return $ blankline $$ "#+begin_quote" $$
157+ nest 2 contents $$ "#+end_quote" $$ blankline
158158blockToOrg (Table _ blkCapt specs thead tbody tfoot) = do
159159 let (caption', _, _, headers, rows) = toLegacyTable blkCapt specs thead tbody tfoot
160160 caption'' <- inlineListToOrg caption'
161161 let caption = if null caption'
162162 then empty
163− else "#+CAPTION: " <> caption''
163+ else "#+caption: " <> caption''
164164 headers' <- mapM blockListToOrg headers
165165 rawRows <- mapM (mapM blockListToOrg) rows
166166 let numChars = maximum . map offset
@@ -292,12 +292,12 @@ divToOrg attr bs = do
292292 case divBlockType attr of
293293 GreaterBlock blockName attr' ->
294294 -- Write as greater block. The ID, if present, is added via
295− -- the #+NAME keyword; other classes and key-value pairs
296− -- are kept as #+ATTR_HTML attributes.
295+ -- the #+name keyword; other classes and key-value pairs
296+ -- are kept as #+attr_html attributes.
297297 return $ blankline $$ attrHtml attr'
298− $$ "#+BEGIN_" <> literal blockName
298+ $$ "#+begin_" <> literal blockName
299299 $$ contents
300− $$ "#+END_" <> literal blockName $$ blankline
300+ $$ "#+end_" <> literal blockName $$ blankline
301301 Drawer drawerName (_,_,kvs) -> do
302302 -- Write as drawer. Only key-value pairs are retained.
303303 let keys = vcat $ map (\(k,v) ->
@@ -320,8 +320,8 @@ attrHtml :: Attr -> Doc Text
320320attrHtml ("" , [] , []) = mempty
321321attrHtml (ident, classes, kvs) =
322322 let
323− name = if T.null ident then mempty else "#+NAME: " <> literal ident <> cr
324− keyword = "#+ATTR_HTML"
323+ name = if T.null ident then mempty else "#+name: " <> literal ident <> cr
324+ keyword = "#+attr_html"
325325 classKv = ("class", T.unwords classes)
326326 kvStrings = map (\(k,v) -> ":" <> k <> " " <> v) (classKv:kvs)
327327 in name <> keyword <> ": " <> literal (T.unwords kvStrings) <> cr
test/Tests/Readers/Org/Block.hs+21−21
@@ -75,10 +75,10 @@ tests =
7575
7676 , testGroup "Comments"
7777 [ "Comment Block" =:
78− T.unlines [ "#+BEGIN_COMMENT"
78+ T.unlines [ "#+begin_comment"
7979 , "stuff"
8080 , "bla"
81− , "#+END_COMMENT"] =?>
81+ , "#+end_comment"] =?>
8282 (mempty::Blocks)
8383
8484 , "Comment line" =:
@@ -92,16 +92,16 @@ tests =
9292
9393 , testGroup "Blocks and fragments"
9494 [ "HTML block" =:
95− T.unlines [ "#+BEGIN_HTML"
95+ T.unlines [ "#+begin_html"
9696 , "<aside>HTML5 is pretty nice.</aside>"
97− , "#+END_HTML"
97+ , "#+end_html"
9898 ] =?>
9999 rawBlock "html" "<aside>HTML5 is pretty nice.</aside>\n"
100100
101101 , "Quote block" =:
102− T.unlines [ "#+BEGIN_QUOTE"
102+ T.unlines [ "#+begin_quote"
103103 , "/Niemand/ hat die Absicht, eine Mauer zu errichten!"
104− , "#+END_QUOTE"
104+ , "#+end_quote"
105105 ] =?>
106106 blockQuote (para (spcSep [ emph "Niemand", "hat", "die", "Absicht,"
107107 , "eine", "Mauer", "zu", "errichten!"
@@ -128,31 +128,31 @@ tests =
128128 ]
129129
130130 , "Verse block with blank lines" =:
131− T.unlines [ "#+BEGIN_VERSE"
131+ T.unlines [ "#+begin_verse"
132132 , "foo"
133133 , ""
134134 , "bar"
135− , "#+END_VERSE"
135+ , "#+end_verse"
136136 ] =?>
137137 lineBlock [ "foo", mempty, "bar" ]
138138
139139 , "Verse block with varying indentation" =:
140− T.unlines [ "#+BEGIN_VERSE"
140+ T.unlines [ "#+begin_verse"
141141 , " hello darkness"
142142 , "my old friend"
143− , "#+END_VERSE"
143+ , "#+end_verse"
144144 ] =?>
145145 lineBlock [ "\160\160hello darkness", "my old friend" ]
146146
147147 , "Raw block LaTeX" =:
148− T.unlines [ "#+BEGIN_LaTeX"
148+ T.unlines [ "#+begin_latex"
149149 , "The category $\\cat{Set}$ is adhesive."
150− , "#+END_LaTeX"
150+ , "#+end_latex"
151151 ] =?>
152152 rawBlock "latex" "The category $\\cat{Set}$ is adhesive.\n"
153153
154154 , "Raw LaTeX line" =:
155− "#+LATEX: \\let\\foo\\bar" =?>
155+ "#+latex: \\let\\foo\\bar" =?>
156156 rawBlock "latex" "\\let\\foo\\bar"
157157
158158 , "Raw Beamer line" =:
@@ -160,13 +160,13 @@ tests =
160160 rawBlock "beamer" "\\pause"
161161
162162 , "Raw HTML line" =:
163− "#+HTML: <aside>not important</aside>" =?>
163+ "#+html: <aside>not important</aside>" =?>
164164 rawBlock "html" "<aside>not important</aside>"
165165
166166 , "Export block HTML" =:
167− T.unlines [ "#+BEGIN_export html"
167+ T.unlines [ "#+begin_export html"
168168 , "<samp>Hello, World!</samp>"
169− , "#+END_export"
169+ , "#+end_export"
170170 ] =?>
171171 rawBlock "html" "<samp>Hello, World!</samp>\n"
172172
@@ -197,13 +197,13 @@ tests =
197197 ] =?>
198198 rawBlock "html" "\n<span>boring</span>\n\n"
199199
200− , "Accept `ATTR_HTML` attributes for generic block" =:
201− T.unlines [ "#+ATTR_HTML: :title hello, world :id test :class fun code"
202− , "#+BEGIN_TEST"
200+ , "Accept `attr_html` attributes for generic block" =:
201+ T.unlines [ "#+attr_html: :title hello, world :id test :class fun code"
202+ , "#+begin_test"
203203 , "nonsense"
204− , "#+END_TEST"
204+ , "#+end_test"
205205 ] =?>
206− let attr = ("test", ["fun", "code", "TEST"], [("title", "hello, world")])
206+ let attr = ("test", ["fun", "code", "test"], [("title", "hello, world")])
207207 in divWith attr (para "nonsense")
208208 ]
209209
test/Tests/Readers/Org/Block/CodeBlock.hs+32−32
@@ -23,48 +23,48 @@ import qualified Data.Text as T
2323tests :: [TestTree]
2424tests =
2525 [ "Source block" =:
26− T.unlines [ " #+BEGIN_SRC haskell"
26+ T.unlines [ " #+begin_src haskell"
2727 , " main = putStrLn greeting"
2828 , " where greeting = \"moin\""
29− , " #+END_SRC" ] =?>
29+ , " #+end_src" ] =?>
3030 let attr' = ("", ["haskell"], [])
3131 code' = "main = putStrLn greeting\n" <>
3232 " where greeting = \"moin\"\n"
3333 in codeBlockWith attr' code'
3434
3535 , "Source block with indented code" =:
36− T.unlines [ " #+BEGIN_SRC haskell"
36+ T.unlines [ " #+begin_src haskell"
3737 , " main = putStrLn greeting"
3838 , " where greeting = \"moin\""
39− , " #+END_SRC" ] =?>
39+ , " #+end_src" ] =?>
4040 let attr' = ("", ["haskell"], [])
4141 code' = "main = putStrLn greeting\n" <>
4242 " where greeting = \"moin\"\n"
4343 in codeBlockWith attr' code'
4444
4545 , "Source block with tab-indented code" =:
46− T.unlines [ "\t#+BEGIN_SRC haskell"
46+ T.unlines [ "\t#+begin_src haskell"
4747 , "\tmain = putStrLn greeting"
4848 , "\t where greeting = \"moin\""
49− , "\t#+END_SRC" ] =?>
49+ , "\t#+end_src" ] =?>
5050 let attr' = ("", ["haskell"], [])
5151 code' = "main = putStrLn greeting\n" <>
5252 " where greeting = \"moin\"\n"
5353 in codeBlockWith attr' code'
5454
5555 , "Empty source block" =:
56− T.unlines [ " #+BEGIN_SRC haskell"
57− , " #+END_SRC" ] =?>
56+ T.unlines [ " #+begin_src haskell"
57+ , " #+end_src" ] =?>
5858 let attr' = ("", ["haskell"], [])
5959 code' = ""
6060 in codeBlockWith attr' code'
6161
6262 , "Source block between paragraphs" =:
6363 T.unlines [ "Low German greeting"
64− , " #+BEGIN_SRC haskell"
64+ , " #+begin_src haskell"
6565 , " main = putStrLn greeting"
6666 , " where greeting = \"Moin!\""
67− , " #+END_SRC" ] =?>
67+ , " #+end_src" ] =?>
6868 let attr' = ("", ["haskell"], [])
6969 code' = "main = putStrLn greeting\n" <>
7070 " where greeting = \"Moin!\"\n"
@@ -72,10 +72,10 @@ tests =
7272 , codeBlockWith attr' code'
7373 ]
7474 , "Source block with babel arguments" =:
75− T.unlines [ "#+BEGIN_SRC emacs-lisp :exports both"
75+ T.unlines [ "#+begin_src emacs-lisp :exports both"
7676 , "(progn (message \"Hello, World!\")"
7777 , " (+ 23 42))"
78− , "#+END_SRC" ] =?>
78+ , "#+end_src" ] =?>
7979 let classes = [ "commonlisp" ] -- as kate doesn't know emacs-lisp syntax
8080 params = [ ("org-language", "emacs-lisp")
8181 , ("exports", "both")
@@ -85,10 +85,10 @@ tests =
8585 in codeBlockWith ("", classes, params) code'
8686
8787 , "Source block with results and :exports both" =:
88− T.unlines [ "#+BEGIN_SRC emacs-lisp :exports both"
88+ T.unlines [ "#+begin_src emacs-lisp :exports both"
8989 , "(progn (message \"Hello, World!\")"
9090 , " (+ 23 42))"
91− , "#+END_SRC"
91+ , "#+end_src"
9292 , ""
9393 , "#+RESULTS:"
9494 , ": 65"] =?>
@@ -104,10 +104,10 @@ tests =
104104 codeBlockWith ("", ["example"], []) results'
105105
106106 , "Source block with results and :exports code" =:
107− T.unlines [ "#+BEGIN_SRC emacs-lisp :exports code"
107+ T.unlines [ "#+begin_src emacs-lisp :exports code"
108108 , "(progn (message \"Hello, World!\")"
109109 , " (+ 23 42))"
110− , "#+END_SRC"
110+ , "#+end_src"
111111 , ""
112112 , "#+RESULTS:"
113113 , ": 65" ] =?>
@@ -120,10 +120,10 @@ tests =
120120 in codeBlockWith ("", classes, params) code'
121121
122122 , "Source block with results and :exports results" =:
123− T.unlines [ "#+BEGIN_SRC emacs-lisp :exports results"
123+ T.unlines [ "#+begin_src emacs-lisp :exports results"
124124 , "(progn (message \"Hello, World!\")"
125125 , " (+ 23 42))"
126− , "#+END_SRC"
126+ , "#+end_src"
127127 , ""
128128 , "#+RESULTS:"
129129 , ": 65" ] =?>
@@ -131,37 +131,37 @@ tests =
131131 in codeBlockWith ("", ["example"], []) results'
132132
133133 , "Source block with results and :exports none" =:
134− T.unlines [ "#+BEGIN_SRC emacs-lisp :exports none"
134+ T.unlines [ "#+begin_src emacs-lisp :exports none"
135135 , "(progn (message \"Hello, World!\")"
136136 , " (+ 23 42))"
137− , "#+END_SRC"
137+ , "#+end_src"
138138 , ""
139139 , "#+RESULTS:"
140140 , ": 65" ] =?>
141141 (mempty :: Blocks)
142142
143143 , "Source block with toggling header arguments" =:
144− T.unlines [ "#+BEGIN_SRC sh :noeval"
144+ T.unlines [ "#+begin_src sh :noeval"
145145 , "echo $HOME"
146− , "#+END_SRC"
146+ , "#+end_src"
147147 ] =?>
148148 let classes = [ "bash" ]
149149 params = [ ("org-language", "sh"), ("noeval", "yes") ]
150150 in codeBlockWith ("", classes, params) "echo $HOME\n"
151151
152152 , "Source block with line number switch" =:
153− T.unlines [ "#+BEGIN_SRC sh -n 10"
153+ T.unlines [ "#+begin_src sh -n 10"
154154 , ":() { :|:& };:"
155− , "#+END_SRC"
155+ , "#+end_src"
156156 ] =?>
157157 let classes = [ "bash", "numberLines" ]
158158 params = [ ("org-language", "sh"), ("startFrom", "10") ]
159159 in codeBlockWith ("", classes, params) ":() { :|:& };:\n"
160160
161161 , "Source block with multi-word parameter values" =:
162− T.unlines [ "#+BEGIN_SRC dot :cmdline -Kdot -Tpng "
162+ T.unlines [ "#+begin_src dot :cmdline -Kdot -Tpng "
163163 , "digraph { id [label=\"ID\"] }"
164− , "#+END_SRC"
164+ , "#+end_src"
165165 ] =?>
166166 let classes = [ "dot" ]
167167 params = [ ("cmdline", "-Kdot -Tpng") ]
@@ -177,12 +177,12 @@ tests =
177177 "A chosen representation of\na rule.\n"
178178
179179 , "Code block with caption" =:
180− T.unlines [ "#+CAPTION: Functor laws in Haskell"
181− , "#+NAME: functor-laws"
182− , "#+BEGIN_SRC haskell"
180+ T.unlines [ "#+caption: Functor laws in Haskell"
181+ , "#+name: functor-laws"
182+ , "#+begin_src haskell"
183183 , "fmap id = id"
184184 , "fmap (p . q) = (fmap p) . (fmap q)"
185− , "#+END_SRC"
185+ , "#+end_src"
186186 ] =?>
187187 divWith
188188 nullAttr
@@ -195,9 +195,9 @@ tests =
195195 ])))
196196
197197 , "Non-letter chars in source block parameters" =:
198− T.unlines [ "#+BEGIN_SRC C :tangle xxxx.c :city Zürich"
198+ T.unlines [ "#+begin_src C :tangle xxxx.c :city Zürich"
199199 , "code body"
200− , "#+END_SRC"
200+ , "#+end_src"
201201 ] =?>
202202 let params = [ ("org-language", "C")
203203 , ("tangle", "xxxx.c")
test/Tests/Readers/Org/Block/Figure.hs+8−8
@@ -44,9 +44,9 @@ tests =
4444 "Used as a metapher in evolutionary biology.")
4545
4646 , "Figure with HTML attributes" =:
47− T.unlines [ "#+CAPTION: mah brain just explodid"
48− , "#+NAME: lambdacat"
49− , "#+ATTR_HTML: :style color: blue :role button"
47+ T.unlines [ "#+caption: mah brain just explodid"
48+ , "#+name: lambdacat"
49+ , "#+attr_html: :style color: blue :role button"
5050 , "[[file:lambdacat.jpg]]"
5151 ] =?>
5252 let kv = [("style", "color: blue"), ("role", "button")]
@@ -55,22 +55,22 @@ tests =
5555 in para (imageWith (mempty, mempty, kv) "lambdacat.jpg" name caption)
5656
5757 , "LaTeX attributes are ignored" =:
58− T.unlines [ "#+CAPTION: Attribute after caption"
59− , "#+ATTR_LATEX: :float nil"
58+ T.unlines [ "#+caption: Attribute after caption"
59+ , "#+attr_latex: :float nil"
6060 , "[[file:test.png]]"
6161 ] =?>
6262 para (image "test.png" "fig:" "Attribute after caption")
6363
6464 , "Labelled figure" =:
65− T.unlines [ "#+CAPTION: My figure"
66− , "#+LABEL: fig:myfig"
65+ T.unlines [ "#+caption: My figure"
66+ , "#+label: fig:myfig"
6767 , "[[file:blub.png]]"
6868 ] =?>
6969 let attr = ("fig:myfig", mempty, mempty)
7070 in para (imageWith attr "blub.png" "fig:" "My figure")
7171
7272 , "Figure with empty caption" =:
73− T.unlines [ "#+CAPTION:"
73+ T.unlines [ "#+caption:"
7474 , "[[file:guess.jpg]]"
7575 ] =?>
7676 para (image "guess.jpg" "fig:" "")
test/Tests/Readers/Org/Block/Header.hs+3−3
@@ -99,7 +99,7 @@ tests =
9999 headerWith ("waiting-header", [], []) 1 "WAITING header"
100100
101101 , "Custom todo keywords" =:
102− T.unlines [ "#+TODO: WAITING CANCELLED"
102+ T.unlines [ "#+todo: WAITING CANCELLED"
103103 , "* WAITING compile"
104104 , "* CANCELLED lunch"
105105 ] =?>
@@ -109,7 +109,7 @@ tests =
109109 <> headerWith ("lunch", [], []) 1 (doneSpan <> space <> "lunch")
110110
111111 , "Custom todo keywords with multiple done-states" =:
112− T.unlines [ "#+TODO: WAITING | DONE CANCELLED "
112+ T.unlines [ "#+todo: WAITING | DONE CANCELLED "
113113 , "* WAITING compile"
114114 , "* CANCELLED lunch"
115115 , "* DONE todo-feature"
@@ -248,7 +248,7 @@ tests =
248248 headerWith ("look", [], []) 1 "important"
249249
250250 , "third and forth level headers" =:
251− T.unlines [ "#+OPTIONS: p:t h:3"
251+ T.unlines [ "#+options: p:t h:3"
252252 , "*** Third"
253253 , " CLOSED: [2018-09-05 Wed 13:58]"
254254 , " Text 3"
test/Tests/Readers/Org/Block/Table.hs+2−2
@@ -167,7 +167,7 @@ tests =
167167 ]
168168
169169 , "Table with caption" =:
170− T.unlines [ "#+CAPTION: Hitchhiker's Multiplication Table"
170+ T.unlines [ "#+caption: Hitchhiker's Multiplication Table"
171171 , "| x | 6 |"
172172 , "| 9 | 42 |"
173173 ] =?>
@@ -180,7 +180,7 @@ tests =
180180 ]
181181
182182 , "named table" =:
183− T.unlines [ "#+NAME: x-marks-the-spot"
183+ T.unlines [ "#+name: x-marks-the-spot"
184184 , "| x |"
185185 ] =?>
186186 divWith ("x-marks-the-spot", mempty, mempty)
test/Tests/Readers/Org/Inline.hs+1−1
@@ -210,7 +210,7 @@ tests =
210210 <> image "sunset.jpg" "" "")
211211
212212 , "Image with html attributes" =:
213− T.unlines [ "#+ATTR_HTML: :width 50%"
213+ T.unlines [ "#+attr_html: :width 50%"
214214 , "[[file:guinea-pig.gif]]"
215215 ] =?>
216216 para (imageWith ("", [], [("width", "50%")]) "guinea-pig.gif" "" "")
test/Tests/Readers/Org/Meta.hs+25−25
@@ -44,7 +44,7 @@ tests =
4444
4545 , testGroup "Export settings"
4646 [ "Title" =:
47− "#+TITLE: Hello, World" =?>
47+ "#+title: Hello, World" =?>
4848 let titleInline = toList $ "Hello," <> space <> "World"
4949 meta = setMeta "title" (MetaInlines titleInline) nullMeta
5050 in Pandoc meta mempty
@@ -69,21 +69,21 @@ tests =
6969 ]
7070
7171 , "Date" =:
72− "#+Date: Feb. *28*, 2014" =?>
72+ "#+date: Feb. *28*, 2014" =?>
7373 let date = toList . spcSep $ [ "Feb.", strong "28" <> ",", "2014" ]
7474 meta = setMeta "date" (MetaInlines date) nullMeta
7575 in Pandoc meta mempty
7676
7777 , testGroup "Description"
7878 [ "Single line" =:
79− "#+DESCRIPTION: Explanatory text" =?>
79+ "#+description: Explanatory text" =?>
8080 let description = [Str "Explanatory", Space, Str "text"]
8181 meta = setMeta "description" (MetaInlines description) nullMeta
8282 in Pandoc meta mempty
8383
8484 , "Multiline" =:
85− T.unlines [ "#+DESCRIPTION: /Short/ introduction"
86− , "#+DESCRIPTION: to Org-mode"
85+ T.unlines [ "#+description: /Short/ introduction"
86+ , "#+description: to Org-mode"
8787 ] =?>
8888 let description = [ Emph [Str "Short"], Space, Str "introduction"
8989 , SoftBreak
@@ -94,54 +94,54 @@ tests =
9494 ]
9595
9696 , "Subtitle" =:
97− T.unlines [ "#+SUBTITLE: Your Life in"
98− , "#+SUBTITLE: /Plain/ Text"
97+ T.unlines [ "#+subtitle: Your Life in"
98+ , "#+subtitle: /Plain/ Text"
9999 ] =?>
100100 let subtitle = "Your Life in" <> softbreak <> emph "Plain" <> " Text"
101101 in Pandoc (setMeta "subtitle" (toMetaValue subtitle) nullMeta) mempty
102102
103103 , "Keywords" =:
104− T.unlines [ "#+KEYWORDS: pandoc, testing,"
105− , "#+KEYWORDS: Org"
104+ T.unlines [ "#+keywords: pandoc, testing,"
105+ , "#+keywords: Org"
106106 ] =?>
107107 let keywords = toList $ "pandoc, testing," <> softbreak <> "Org"
108108 meta = setMeta "keywords" (MetaInlines keywords) nullMeta
109109 in Pandoc meta mempty
110110
111111 , "Institute" =:
112− "#+INSTITUTE: ACME Inc." =?>
112+ "#+institute: ACME Inc." =?>
113113 Pandoc (setMeta "institute" ("ACME Inc." :: Inlines) nullMeta) mempty
114114
115115 , testGroup "LaTeX"
116116 [ "LATEX_HEADER" =:
117− "#+LaTeX_header: \\usepackage{tikz}" =?>
117+ "#+latex_header: \\usepackage{tikz}" =?>
118118 let latexInlines = rawInline "latex" "\\usepackage{tikz}"
119119 inclList = MetaList [MetaInlines (toList latexInlines)]
120120 meta = setMeta "header-includes" inclList nullMeta
121121 in Pandoc meta mempty
122122
123123 , "LATEX_HEADER_EXTRA" =:
124− "#+LATEX_HEADER_EXTRA: \\usepackage{calc}" =?>
124+ "#+latex_header_extra: \\usepackage{calc}" =?>
125125 let latexInlines = rawInline "latex" "\\usepackage{calc}"
126126 inclList = toMetaValue [latexInlines]
127127 in Pandoc (setMeta "header-includes" inclList nullMeta) mempty
128128
129129 , testGroup "LaTeX_CLASS"
130130 [ "stored as documentclass" =:
131− "#+LATEX_CLASS: article" =?>
131+ "#+latex_class: article" =?>
132132 let meta = setMeta "documentclass" (MetaString "article") nullMeta
133133 in Pandoc meta mempty
134134
135135 , "last definition takes precedence" =:
136− T.unlines [ "#+LATEX_CLASS: this will not be used"
137− , "#+LATEX_CLASS: report"
136+ T.unlines [ "#+latex_class: this will not be used"
137+ , "#+latex_class: report"
138138 ] =?>
139139 let meta = setMeta "documentclass" (MetaString "report") nullMeta
140140 in Pandoc meta mempty
141141 ]
142142
143143 , "LATEX_CLASS_OPTIONS as classoption" =:
144− "#+LATEX_CLASS_OPTIONS: [a4paper]" =?>
144+ "#+latex_class_options: [a4paper]" =?>
145145 let meta = setMeta "classoption" (MetaString "a4paper") nullMeta
146146 in Pandoc meta mempty
147147 ]
@@ -155,8 +155,8 @@ tests =
155155 in Pandoc meta mempty
156156
157157 , "HTML_HEAD_EXTRA behaves like HTML_HEAD" =:
158− T.unlines [ "#+HTML_HEAD: <meta name=\"generator\" content=\"pandoc\">"
159− , "#+HTML_HEAD_EXTRA: <meta charset=\"utf-8\">"
158+ T.unlines [ "#+html_head: <meta name=\"generator\" content=\"pandoc\">"
159+ , "#+html_head_extra: <meta charset=\"utf-8\">"
160160 ] =?>
161161 let generator = rawInline "html"
162162 "<meta name=\"generator\" content=\"pandoc\">"
@@ -167,9 +167,9 @@ tests =
167167 ]
168168
169169 , testGroup "Non-export keywords"
170− [ testGroup "#+LINK"
170+ [ testGroup "#+link"
171171 [ "Link abbreviation" =:
172− T.unlines [ "#+LINK: wp https://en.wikipedia.org/wiki/%s"
172+ T.unlines [ "#+link: wp https://en.wikipedia.org/wiki/%s"
173173 , "[[wp:Org_mode][Wikipedia on Org-mode]]"
174174 ] =?>
175175 para (link "https://en.wikipedia.org/wiki/Org_mode" ""
@@ -177,7 +177,7 @@ tests =
177177
178178 , "Link abbreviation, defined after first use" =:
179179 T.unlines [ "[[zl:non-sense][Non-sense articles]]"
180− , "#+LINK: zl http://zeitlens.com/tags/%s.html"
180+ , "#+link: zl http://zeitlens.com/tags/%s.html"
181181 ] =?>
182182 para (link "http://zeitlens.com/tags/non-sense.html" ""
183183 ("Non-sense" <> space <> "articles"))
@@ -214,11 +214,11 @@ tests =
214214 ]
215215
216216 , "Unknown keyword" =:
217− T.unlines [ "#+UNKNOWN_KEYWORD: Chumbawamba"
218− , "#+ANOTHER_UNKNOWN: Blur"
217+ T.unlines [ "#+unknown_keyword: Chumbawamba"
218+ , "#+another_unknown: Blur"
219219 ] =?>
220− rawBlock "org" "#+UNKNOWN_KEYWORD: Chumbawamba" <>
221− rawBlock "org" "#+ANOTHER_UNKNOWN: Blur"
220+ rawBlock "org" "#+unknown_keyword: Chumbawamba" <>
221+ rawBlock "org" "#+another_unknown: Blur"
222222 ]
223223
224224 , "Properties drawer" =:
test/command/3706.md+8−8
@@ -2,12 +2,12 @@ Results marker can be hidden in block attributes (#3706)
22
33```
44pandoc -f org -t native
5−#+BEGIN_SRC R :exports results :colnames yes
5+#+begin_src r :exports results :colnames yes
66 data.frame(Id = 1:3, Desc = rep("La",3))
7−#+END_SRC
7+#+end_src
88
9−#+CAPTION: Lalelu.
10−#+LABEL: tab
9+#+caption: Lalelu.
10+#+label: tab
1111#+RESULTS:
1212| Id | Desc |
1313|----+------|
@@ -49,12 +49,12 @@ pandoc -f org -t native
4949
5050```
5151pandoc -f org -t native
52−#+BEGIN_SRC R :exports none :colnames yes
52+#+begin_src R :exports none :colnames yes
5353 data.frame(Id = 1:2, Desc = rep("La",2))
54−#+END_SRC
54+#+end_src
5555
56−#+CAPTION: Lalelu.
57−#+LABEL: tab
56+#+caption: Lalelu.
57+#+label: tab
5858#+RESULTS:
5959| Id | Desc |
6060|----+------|
test/command/4186.md+8−8
@@ -1,8 +1,8 @@
11```
22% pandoc -f org -t native
3−#+BEGIN_EXAMPLE -i
3+#+begin_example -i
44 This should retain the four leading spaces
5−#+END_EXAMPLE
5+#+end_example
66^D
77[CodeBlock ("",["example"],[]) " This should retain the four leading spaces\n"]
88```
@@ -10,10 +10,10 @@
1010```
1111% pandoc -f org -t html
1212- depth 1
13− #+NAME: bob
14− #+BEGIN_EXAMPLE -i
13+ #+name: bob
14+ #+begin_example -i
1515 Vertical alignment is four spaces beyond the appearance of the word "depth".
16− #+END_EXAMPLE
16+ #+end_example
1717 - depth 2
1818 #+begin_example
1919 Vertically aligned with the second appearance of the word "depth".
@@ -27,10 +27,10 @@
2727 inner list element.
2828 #+end_example
2929 Still inside the inner list element
30− #+NAME: carrie
31− #+BEGIN_EXAMPLE
30+ #+name: carrie
31+ #+begin_example
3232 This belongs to the outer list element, and is aligned accordingly, since the NAME attribute is not indented deeply enough. It is not enough for the BEGIN alone to be aligned deeply if the block is meant to have a NAME.
33− #+END_EXAMPLE
33+ #+end_example
3434 Still in the shallower list element since the preceding example
3535 block forced the deeper list element to terminate.
3636Outside all lists.
test/command/5178.md+10−10
@@ -6,21 +6,21 @@
66 main = putStrLn "Hello World!"
77 unsafePerformIO main
88^D
9−#+BEGIN_SRC haskell -n 42
9+#+begin_src haskell -n 42
1010 main = putStrLn "Hello World!"
1111 unsafePerformIO main
12−#+END_SRC
12+#+end_src
1313```
1414
1515```
1616% pandoc -f org -t native
17−#+BEGIN_SRC lisp -n 20
17+#+begin_src lisp -n 20
1818 (+ 1 1)
19−#+END_SRC
19+#+end_src
2020
21−#+BEGIN_SRC lisp +n 10
21+#+begin_src lisp +n 10
2222 (+ 2 2)
23−#+END_SRC
23+#+end_src
2424^D
2525[CodeBlock ("",["commonlisp","numberLines"],[("org-language","lisp"),("startFrom","20")]) "(+ 1 1)\n"
2626,CodeBlock ("",["commonlisp","numberLines","continuedSourceBlock"],[("org-language","lisp"),("startFrom","10")]) "(+ 2 2)\n"]
@@ -31,11 +31,11 @@
3131[CodeBlock ("",["commonlisp","numberLines"],[("org-language","lisp"),("startFrom","20")]) "(+ 1 1)\n"
3232,CodeBlock ("",["commonlisp","numberLines","continuedSourceBlock"],[("org-language","lisp"),("startFrom","10")]) "(+ 2 2)\n"]
3333^D
34−#+BEGIN_SRC lisp -n 20
34+#+begin_src lisp -n 20
3535 (+ 1 1)
36−#+END_SRC
36+#+end_src
3737
38−#+BEGIN_SRC lisp +n 10
38+#+begin_src lisp +n 10
3939 (+ 2 2)
40−#+END_SRC
40+#+end_src
4141```
test/org-select-tags.org+2−2
@@ -1,5 +1,5 @@
1−#+SELECT_TAGS: yes no
2−#+EXCLUDE_TAGS: no
1+#+select_tags: yes no
2+#+exclude_tags: no
33
44In a document containing one or more trees containing a tag
55listed in SELECT_TAGS, only those trees and their ancestor nodes will appear;
test/tables.org+3−3
@@ -5,7 +5,7 @@ Simple table with caption:
55| 12 | 12 | 12 | 12 |
66| 123 | 123 | 123 | 123 |
77| 1 | 1 | 1 | 1 |
8−#+CAPTION: Demonstration of simple table syntax.
8+#+caption: Demonstration of simple table syntax.
99
1010Simple table without caption:
1111
@@ -22,7 +22,7 @@ Simple table indented two spaces:
2222| 12 | 12 | 12 | 12 |
2323| 123 | 123 | 123 | 123 |
2424| 1 | 1 | 1 | 1 |
25−#+CAPTION: Demonstration of simple table syntax.
25+#+caption: Demonstration of simple table syntax.
2626
2727Multiline table with caption:
2828
@@ -30,7 +30,7 @@ Multiline table with caption:
3030|-----------------+--------------+---------------+-------------------------------------------------------|
3131| First | row | 12.0 | Example of a row that spans multiple lines. |
3232| Second | row | 5.0 | Here's another one. Note the blank line between rows. |
33−#+CAPTION: Here's the caption. It may span multiple lines.
33+#+caption: Here's the caption. It may span multiple lines.
3434
3535Multiline table without caption:
3636
test/writer.org+84−84
@@ -1,7 +1,7 @@
1−#+TITLE: Pandoc Test Suite
1+#+title: Pandoc Test Suite
22
3−#+AUTHOR: John MacFarlane; Anonymous
4−#+DATE: July 17, 2006
3+#+author: John MacFarlane; Anonymous
4+#+date: July 17, 2006
55
66This is a set of tests for pandoc. Most of them are adapted from John Gruber's
77markdown test suite.
@@ -73,18 +73,18 @@ here.
7373 :END:
7474E-mail style:
7575
76−#+BEGIN_QUOTE
76+#+begin_quote
7777 This is a block quote. It is pretty short.
78−#+END_QUOTE
78+#+end_quote
7979
80−#+BEGIN_QUOTE
80+#+begin_quote
8181 Code in a block quote:
8282
83− #+BEGIN_EXAMPLE
83+ #+begin_example
8484 sub status {
8585 print "working";
8686 }
87− #+END_EXAMPLE
87+ #+end_example
8888
8989 A list:
9090
@@ -93,14 +93,14 @@ E-mail style:
9393
9494 Nested block quotes:
9595
96− #+BEGIN_QUOTE
96+ #+begin_quote
9797 nested
98− #+END_QUOTE
98+ #+end_quote
9999
100− #+BEGIN_QUOTE
100+ #+begin_quote
101101 nested
102− #+END_QUOTE
103−#+END_QUOTE
102+ #+end_quote
103+#+end_quote
104104
105105This should not be a block quote: 2 > 1.
106106
@@ -114,7 +114,7 @@ And a following paragraph.
114114 :END:
115115Code:
116116
117−#+BEGIN_EXAMPLE
117+#+begin_example
118118 ---- (should be four hyphens)
119119
120120 sub status {
@@ -122,15 +122,15 @@ Code:
122122 }
123123
124124 this code block is indented by one tab
125−#+END_EXAMPLE
125+#+end_example
126126
127127And:
128128
129−#+BEGIN_EXAMPLE
129+#+begin_example
130130 this code block is indented by two tabs
131131
132132 These should not be escaped: \$ \\ \> \[ \{
133−#+END_EXAMPLE
133+#+end_example
134134
135135--------------
136136
@@ -347,13 +347,13 @@ Multiple blocks with italics:
347347
348348- /orange/ :: orange fruit
349349
350− #+BEGIN_EXAMPLE
350+ #+begin_example
351351 { orange code block }
352− #+END_EXAMPLE
352+ #+end_example
353353
354− #+BEGIN_QUOTE
354+ #+begin_quote
355355 orange block quote
356− #+END_QUOTE
356+ #+end_quote
357357
358358Multiple definitions, tight:
359359
@@ -399,45 +399,45 @@ bar
399399
400400Interpreted markdown in a table:
401401
402−#+BEGIN_HTML
402+#+begin_html
403403 <table>
404−#+END_HTML
404+#+end_html
405405
406−#+BEGIN_HTML
406+#+begin_html
407407 <tr>
408−#+END_HTML
408+#+end_html
409409
410−#+BEGIN_HTML
410+#+begin_html
411411 <td>
412−#+END_HTML
412+#+end_html
413413
414414This is /emphasized/
415415
416−#+BEGIN_HTML
416+#+begin_html
417417 </td>
418−#+END_HTML
418+#+end_html
419419
420−#+BEGIN_HTML
420+#+begin_html
421421 <td>
422−#+END_HTML
422+#+end_html
423423
424424And this is *strong*
425425
426−#+BEGIN_HTML
426+#+begin_html
427427 </td>
428−#+END_HTML
428+#+end_html
429429
430−#+BEGIN_HTML
430+#+begin_html
431431 </tr>
432−#+END_HTML
432+#+end_html
433433
434−#+BEGIN_HTML
434+#+begin_html
435435 </table>
436−#+END_HTML
436+#+end_html
437437
438−#+BEGIN_HTML
438+#+begin_html
439439 <script type="text/javascript">document.write('This *should not* be interpreted as markdown');</script>
440−#+END_HTML
440+#+end_html
441441
442442Here's a simple block:
443443
@@ -445,17 +445,17 @@ foo
445445
446446This should be a code block, though:
447447
448−#+BEGIN_EXAMPLE
448+#+begin_example
449449 <div>
450450 foo
451451 </div>
452−#+END_EXAMPLE
452+#+end_example
453453
454454As should this:
455455
456−#+BEGIN_EXAMPLE
456+#+begin_example
457457 <div>foo</div>
458−#+END_EXAMPLE
458+#+end_example
459459
460460Now, nested:
461461
@@ -463,80 +463,80 @@ foo
463463
464464This should just be an HTML comment:
465465
466−#+BEGIN_HTML
466+#+begin_html
467467 <!-- Comment -->
468−#+END_HTML
468+#+end_html
469469
470470Multiline:
471471
472−#+BEGIN_HTML
472+#+begin_html
473473 <!--
474474 Blah
475475 Blah
476476 -->
477−#+END_HTML
477+#+end_html
478478
479−#+BEGIN_HTML
479+#+begin_html
480480 <!--
481481 This is another comment.
482482 -->
483−#+END_HTML
483+#+end_html
484484
485485Code block:
486486
487−#+BEGIN_EXAMPLE
487+#+begin_example
488488 <!-- Comment -->
489−#+END_EXAMPLE
489+#+end_example
490490
491491Just plain comment, with trailing spaces on the line:
492492
493−#+BEGIN_HTML
493+#+begin_html
494494 <!-- foo -->
495−#+END_HTML
495+#+end_html
496496
497497Code:
498498
499−#+BEGIN_EXAMPLE
499+#+begin_example
500500 <hr />
501−#+END_EXAMPLE
501+#+end_example
502502
503503Hr's:
504504
505−#+BEGIN_HTML
505+#+begin_html
506506 <hr>
507−#+END_HTML
507+#+end_html
508508
509−#+BEGIN_HTML
509+#+begin_html
510510 <hr />
511−#+END_HTML
511+#+end_html
512512
513−#+BEGIN_HTML
513+#+begin_html
514514 <hr />
515−#+END_HTML
515+#+end_html
516516
517−#+BEGIN_HTML
517+#+begin_html
518518 <hr>
519−#+END_HTML
519+#+end_html
520520
521−#+BEGIN_HTML
521+#+begin_html
522522 <hr />
523−#+END_HTML
523+#+end_html
524524
525−#+BEGIN_HTML
525+#+begin_html
526526 <hr />
527−#+END_HTML
527+#+end_html
528528
529−#+BEGIN_HTML
529+#+begin_html
530530 <hr class="foo" id="bar" />
531−#+END_HTML
531+#+end_html
532532
533−#+BEGIN_HTML
533+#+begin_html
534534 <hr class="foo" id="bar" />
535−#+END_HTML
535+#+end_html
536536
537−#+BEGIN_HTML
537+#+begin_html
538538 <hr class="foo" id="bar">
539−#+END_HTML
539+#+end_html
540540
541541--------------
542542
@@ -727,9 +727,9 @@ Indented [[/url][thrice]].
727727
728728This should [not][] be a link.
729729
730−#+BEGIN_EXAMPLE
730+#+begin_example
731731 [not]: /url
732−#+END_EXAMPLE
732+#+end_example
733733
734734Foo [[/url/][bar]].
735735
@@ -760,15 +760,15 @@ With an ampersand: [[http://example.com/?foo=1&bar=2]]
760760
761761An e-mail address: [[mailto:nobody@nowhere.net][nobody@nowhere.net]]
762762
763−#+BEGIN_QUOTE
763+#+begin_quote
764764 Blockquoted: [[http://example.com/]]
765−#+END_QUOTE
765+#+end_quote
766766
767767Auto-links should not occur here: =<http://example.com/>=
768768
769−#+BEGIN_EXAMPLE
769+#+begin_example
770770 or here: <http://example.com/>
771−#+END_EXAMPLE
771+#+end_example
772772
773773--------------
774774
@@ -778,7 +778,7 @@ Auto-links should not occur here: =<http://example.com/>=
778778 :END:
779779From "Voyage dans la Lune" by Georges Melies (1902):
780780
781−#+CAPTION: lalune
781+#+caption: lalune
782782[[file:lalune.jpg]]
783783
784784Here is a movie [[file:movie.jpg]] icon.
@@ -793,9 +793,9 @@ Here is a footnote reference,[fn:1] and another.[fn:2] This should /not/ be a
793793footnote reference, because it contains a space.[^my note] Here is an inline
794794note.[fn:3]
795795
796−#+BEGIN_QUOTE
796+#+begin_quote
797797 Notes can go in quotes.[fn:4]
798−#+END_QUOTE
798+#+end_quote
799799
8008001. And in list items.[fn:5]
801801
@@ -809,9 +809,9 @@ This paragraph should not be part of the note, as it is not indented.
809809 Subsequent blocks are indented to show that they belong to the footnote
810810 (as with list items).
811811
812− #+BEGIN_EXAMPLE
812+ #+begin_example
813813 { <code> }
814− #+END_EXAMPLE
814+ #+end_example
815815
816816 If you want, you can indent every line, but you can also be lazy and
817817 just indent the first line of each block.