diff options
author | TEC <tec@tecosaur.com> | 2020-11-18 02:06:30 +0800 |
---|---|---|
committer | Albert Krewinkel <albert+github@zeitkraut.de> | 2020-11-18 14:48:56 +0100 |
commit | 0306eec5fa3591fc864d9e2e3c0b84a1229509e6 (patch) | |
tree | cb2e769efb85b4a51be1b572c478117a7d1529ac /test/Tests/Readers/Org | |
parent | 224a501b29248a56bfb05f8092ea6db81b838f59 (diff) | |
download | pandoc-0306eec5fa3591fc864d9e2e3c0b84a1229509e6.tar.gz |
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/
Diffstat (limited to 'test/Tests/Readers/Org')
-rw-r--r-- | test/Tests/Readers/Org/Block.hs | 42 | ||||
-rw-r--r-- | test/Tests/Readers/Org/Block/CodeBlock.hs | 64 | ||||
-rw-r--r-- | test/Tests/Readers/Org/Block/Figure.hs | 16 | ||||
-rw-r--r-- | test/Tests/Readers/Org/Block/Header.hs | 6 | ||||
-rw-r--r-- | test/Tests/Readers/Org/Block/Table.hs | 4 | ||||
-rw-r--r-- | test/Tests/Readers/Org/Inline.hs | 2 | ||||
-rw-r--r-- | test/Tests/Readers/Org/Meta.hs | 50 |
7 files changed, 92 insertions, 92 deletions
diff --git a/test/Tests/Readers/Org/Block.hs b/test/Tests/Readers/Org/Block.hs index 895e3f05b..995bd0316 100644 --- a/test/Tests/Readers/Org/Block.hs +++ b/test/Tests/Readers/Org/Block.hs @@ -75,10 +75,10 @@ tests = , testGroup "Comments" [ "Comment Block" =: - T.unlines [ "#+BEGIN_COMMENT" + T.unlines [ "#+begin_comment" , "stuff" , "bla" - , "#+END_COMMENT"] =?> + , "#+end_comment"] =?> (mempty::Blocks) , "Comment line" =: @@ -92,16 +92,16 @@ tests = , testGroup "Blocks and fragments" [ "HTML block" =: - T.unlines [ "#+BEGIN_HTML" + T.unlines [ "#+begin_html" , "<aside>HTML5 is pretty nice.</aside>" - , "#+END_HTML" + , "#+end_html" ] =?> rawBlock "html" "<aside>HTML5 is pretty nice.</aside>\n" , "Quote block" =: - T.unlines [ "#+BEGIN_QUOTE" + T.unlines [ "#+begin_quote" , "/Niemand/ hat die Absicht, eine Mauer zu errichten!" - , "#+END_QUOTE" + , "#+end_quote" ] =?> blockQuote (para (spcSep [ emph "Niemand", "hat", "die", "Absicht," , "eine", "Mauer", "zu", "errichten!" @@ -128,31 +128,31 @@ tests = ] , "Verse block with blank lines" =: - T.unlines [ "#+BEGIN_VERSE" + T.unlines [ "#+begin_verse" , "foo" , "" , "bar" - , "#+END_VERSE" + , "#+end_verse" ] =?> lineBlock [ "foo", mempty, "bar" ] , "Verse block with varying indentation" =: - T.unlines [ "#+BEGIN_VERSE" + T.unlines [ "#+begin_verse" , " hello darkness" , "my old friend" - , "#+END_VERSE" + , "#+end_verse" ] =?> lineBlock [ "\160\160hello darkness", "my old friend" ] , "Raw block LaTeX" =: - T.unlines [ "#+BEGIN_LaTeX" + T.unlines [ "#+begin_latex" , "The category $\\cat{Set}$ is adhesive." - , "#+END_LaTeX" + , "#+end_latex" ] =?> rawBlock "latex" "The category $\\cat{Set}$ is adhesive.\n" , "Raw LaTeX line" =: - "#+LATEX: \\let\\foo\\bar" =?> + "#+latex: \\let\\foo\\bar" =?> rawBlock "latex" "\\let\\foo\\bar" , "Raw Beamer line" =: @@ -160,13 +160,13 @@ tests = rawBlock "beamer" "\\pause" , "Raw HTML line" =: - "#+HTML: <aside>not important</aside>" =?> + "#+html: <aside>not important</aside>" =?> rawBlock "html" "<aside>not important</aside>" , "Export block HTML" =: - T.unlines [ "#+BEGIN_export html" + T.unlines [ "#+begin_export html" , "<samp>Hello, World!</samp>" - , "#+END_export" + , "#+end_export" ] =?> rawBlock "html" "<samp>Hello, World!</samp>\n" @@ -197,13 +197,13 @@ tests = ] =?> rawBlock "html" "\n<span>boring</span>\n\n" - , "Accept `ATTR_HTML` attributes for generic block" =: - T.unlines [ "#+ATTR_HTML: :title hello, world :id test :class fun code" - , "#+BEGIN_TEST" + , "Accept `attr_html` attributes for generic block" =: + T.unlines [ "#+attr_html: :title hello, world :id test :class fun code" + , "#+begin_test" , "nonsense" - , "#+END_TEST" + , "#+end_test" ] =?> - let attr = ("test", ["fun", "code", "TEST"], [("title", "hello, world")]) + let attr = ("test", ["fun", "code", "test"], [("title", "hello, world")]) in divWith attr (para "nonsense") ] diff --git a/test/Tests/Readers/Org/Block/CodeBlock.hs b/test/Tests/Readers/Org/Block/CodeBlock.hs index 42ad09d86..adf6661ca 100644 --- a/test/Tests/Readers/Org/Block/CodeBlock.hs +++ b/test/Tests/Readers/Org/Block/CodeBlock.hs @@ -23,48 +23,48 @@ import qualified Data.Text as T tests :: [TestTree] tests = [ "Source block" =: - T.unlines [ " #+BEGIN_SRC haskell" + T.unlines [ " #+begin_src haskell" , " main = putStrLn greeting" , " where greeting = \"moin\"" - , " #+END_SRC" ] =?> + , " #+end_src" ] =?> let attr' = ("", ["haskell"], []) code' = "main = putStrLn greeting\n" <> " where greeting = \"moin\"\n" in codeBlockWith attr' code' , "Source block with indented code" =: - T.unlines [ " #+BEGIN_SRC haskell" + T.unlines [ " #+begin_src haskell" , " main = putStrLn greeting" , " where greeting = \"moin\"" - , " #+END_SRC" ] =?> + , " #+end_src" ] =?> let attr' = ("", ["haskell"], []) code' = "main = putStrLn greeting\n" <> " where greeting = \"moin\"\n" in codeBlockWith attr' code' , "Source block with tab-indented code" =: - T.unlines [ "\t#+BEGIN_SRC haskell" + T.unlines [ "\t#+begin_src haskell" , "\tmain = putStrLn greeting" , "\t where greeting = \"moin\"" - , "\t#+END_SRC" ] =?> + , "\t#+end_src" ] =?> let attr' = ("", ["haskell"], []) code' = "main = putStrLn greeting\n" <> " where greeting = \"moin\"\n" in codeBlockWith attr' code' , "Empty source block" =: - T.unlines [ " #+BEGIN_SRC haskell" - , " #+END_SRC" ] =?> + T.unlines [ " #+begin_src haskell" + , " #+end_src" ] =?> let attr' = ("", ["haskell"], []) code' = "" in codeBlockWith attr' code' , "Source block between paragraphs" =: T.unlines [ "Low German greeting" - , " #+BEGIN_SRC haskell" + , " #+begin_src haskell" , " main = putStrLn greeting" , " where greeting = \"Moin!\"" - , " #+END_SRC" ] =?> + , " #+end_src" ] =?> let attr' = ("", ["haskell"], []) code' = "main = putStrLn greeting\n" <> " where greeting = \"Moin!\"\n" @@ -72,10 +72,10 @@ tests = , codeBlockWith attr' code' ] , "Source block with babel arguments" =: - T.unlines [ "#+BEGIN_SRC emacs-lisp :exports both" + T.unlines [ "#+begin_src emacs-lisp :exports both" , "(progn (message \"Hello, World!\")" , " (+ 23 42))" - , "#+END_SRC" ] =?> + , "#+end_src" ] =?> let classes = [ "commonlisp" ] -- as kate doesn't know emacs-lisp syntax params = [ ("org-language", "emacs-lisp") , ("exports", "both") @@ -85,10 +85,10 @@ tests = in codeBlockWith ("", classes, params) code' , "Source block with results and :exports both" =: - T.unlines [ "#+BEGIN_SRC emacs-lisp :exports both" + T.unlines [ "#+begin_src emacs-lisp :exports both" , "(progn (message \"Hello, World!\")" , " (+ 23 42))" - , "#+END_SRC" + , "#+end_src" , "" , "#+RESULTS:" , ": 65"] =?> @@ -104,10 +104,10 @@ tests = codeBlockWith ("", ["example"], []) results' , "Source block with results and :exports code" =: - T.unlines [ "#+BEGIN_SRC emacs-lisp :exports code" + T.unlines [ "#+begin_src emacs-lisp :exports code" , "(progn (message \"Hello, World!\")" , " (+ 23 42))" - , "#+END_SRC" + , "#+end_src" , "" , "#+RESULTS:" , ": 65" ] =?> @@ -120,10 +120,10 @@ tests = in codeBlockWith ("", classes, params) code' , "Source block with results and :exports results" =: - T.unlines [ "#+BEGIN_SRC emacs-lisp :exports results" + T.unlines [ "#+begin_src emacs-lisp :exports results" , "(progn (message \"Hello, World!\")" , " (+ 23 42))" - , "#+END_SRC" + , "#+end_src" , "" , "#+RESULTS:" , ": 65" ] =?> @@ -131,37 +131,37 @@ tests = in codeBlockWith ("", ["example"], []) results' , "Source block with results and :exports none" =: - T.unlines [ "#+BEGIN_SRC emacs-lisp :exports none" + T.unlines [ "#+begin_src emacs-lisp :exports none" , "(progn (message \"Hello, World!\")" , " (+ 23 42))" - , "#+END_SRC" + , "#+end_src" , "" , "#+RESULTS:" , ": 65" ] =?> (mempty :: Blocks) , "Source block with toggling header arguments" =: - T.unlines [ "#+BEGIN_SRC sh :noeval" + T.unlines [ "#+begin_src sh :noeval" , "echo $HOME" - , "#+END_SRC" + , "#+end_src" ] =?> let classes = [ "bash" ] params = [ ("org-language", "sh"), ("noeval", "yes") ] in codeBlockWith ("", classes, params) "echo $HOME\n" , "Source block with line number switch" =: - T.unlines [ "#+BEGIN_SRC sh -n 10" + T.unlines [ "#+begin_src sh -n 10" , ":() { :|:& };:" - , "#+END_SRC" + , "#+end_src" ] =?> let classes = [ "bash", "numberLines" ] params = [ ("org-language", "sh"), ("startFrom", "10") ] in codeBlockWith ("", classes, params) ":() { :|:& };:\n" , "Source block with multi-word parameter values" =: - T.unlines [ "#+BEGIN_SRC dot :cmdline -Kdot -Tpng " + T.unlines [ "#+begin_src dot :cmdline -Kdot -Tpng " , "digraph { id [label=\"ID\"] }" - , "#+END_SRC" + , "#+end_src" ] =?> let classes = [ "dot" ] params = [ ("cmdline", "-Kdot -Tpng") ] @@ -177,12 +177,12 @@ tests = "A chosen representation of\na rule.\n" , "Code block with caption" =: - T.unlines [ "#+CAPTION: Functor laws in Haskell" - , "#+NAME: functor-laws" - , "#+BEGIN_SRC haskell" + T.unlines [ "#+caption: Functor laws in Haskell" + , "#+name: functor-laws" + , "#+begin_src haskell" , "fmap id = id" , "fmap (p . q) = (fmap p) . (fmap q)" - , "#+END_SRC" + , "#+end_src" ] =?> divWith nullAttr @@ -195,9 +195,9 @@ tests = ]))) , "Non-letter chars in source block parameters" =: - T.unlines [ "#+BEGIN_SRC C :tangle xxxx.c :city Zürich" + T.unlines [ "#+begin_src C :tangle xxxx.c :city Zürich" , "code body" - , "#+END_SRC" + , "#+end_src" ] =?> let params = [ ("org-language", "C") , ("tangle", "xxxx.c") diff --git a/test/Tests/Readers/Org/Block/Figure.hs b/test/Tests/Readers/Org/Block/Figure.hs index 829ef0496..56ddde9d8 100644 --- a/test/Tests/Readers/Org/Block/Figure.hs +++ b/test/Tests/Readers/Org/Block/Figure.hs @@ -44,9 +44,9 @@ tests = "Used as a metapher in evolutionary biology.") , "Figure with HTML attributes" =: - T.unlines [ "#+CAPTION: mah brain just explodid" - , "#+NAME: lambdacat" - , "#+ATTR_HTML: :style color: blue :role button" + T.unlines [ "#+caption: mah brain just explodid" + , "#+name: lambdacat" + , "#+attr_html: :style color: blue :role button" , "[[file:lambdacat.jpg]]" ] =?> let kv = [("style", "color: blue"), ("role", "button")] @@ -55,22 +55,22 @@ tests = in para (imageWith (mempty, mempty, kv) "lambdacat.jpg" name caption) , "LaTeX attributes are ignored" =: - T.unlines [ "#+CAPTION: Attribute after caption" - , "#+ATTR_LATEX: :float nil" + T.unlines [ "#+caption: Attribute after caption" + , "#+attr_latex: :float nil" , "[[file:test.png]]" ] =?> para (image "test.png" "fig:" "Attribute after caption") , "Labelled figure" =: - T.unlines [ "#+CAPTION: My figure" - , "#+LABEL: fig:myfig" + T.unlines [ "#+caption: My figure" + , "#+label: fig:myfig" , "[[file:blub.png]]" ] =?> let attr = ("fig:myfig", mempty, mempty) in para (imageWith attr "blub.png" "fig:" "My figure") , "Figure with empty caption" =: - T.unlines [ "#+CAPTION:" + T.unlines [ "#+caption:" , "[[file:guess.jpg]]" ] =?> para (image "guess.jpg" "fig:" "") diff --git a/test/Tests/Readers/Org/Block/Header.hs b/test/Tests/Readers/Org/Block/Header.hs index 31056b5b5..d38d26efb 100644 --- a/test/Tests/Readers/Org/Block/Header.hs +++ b/test/Tests/Readers/Org/Block/Header.hs @@ -99,7 +99,7 @@ tests = headerWith ("waiting-header", [], []) 1 "WAITING header" , "Custom todo keywords" =: - T.unlines [ "#+TODO: WAITING CANCELLED" + T.unlines [ "#+todo: WAITING CANCELLED" , "* WAITING compile" , "* CANCELLED lunch" ] =?> @@ -109,7 +109,7 @@ tests = <> headerWith ("lunch", [], []) 1 (doneSpan <> space <> "lunch") , "Custom todo keywords with multiple done-states" =: - T.unlines [ "#+TODO: WAITING | DONE CANCELLED " + T.unlines [ "#+todo: WAITING | DONE CANCELLED " , "* WAITING compile" , "* CANCELLED lunch" , "* DONE todo-feature" @@ -248,7 +248,7 @@ tests = headerWith ("look", [], []) 1 "important" , "third and forth level headers" =: - T.unlines [ "#+OPTIONS: p:t h:3" + T.unlines [ "#+options: p:t h:3" , "*** Third" , " CLOSED: [2018-09-05 Wed 13:58]" , " Text 3" diff --git a/test/Tests/Readers/Org/Block/Table.hs b/test/Tests/Readers/Org/Block/Table.hs index ab404648e..31c994d3f 100644 --- a/test/Tests/Readers/Org/Block/Table.hs +++ b/test/Tests/Readers/Org/Block/Table.hs @@ -167,7 +167,7 @@ tests = ] , "Table with caption" =: - T.unlines [ "#+CAPTION: Hitchhiker's Multiplication Table" + T.unlines [ "#+caption: Hitchhiker's Multiplication Table" , "| x | 6 |" , "| 9 | 42 |" ] =?> @@ -180,7 +180,7 @@ tests = ] , "named table" =: - T.unlines [ "#+NAME: x-marks-the-spot" + T.unlines [ "#+name: x-marks-the-spot" , "| x |" ] =?> divWith ("x-marks-the-spot", mempty, mempty) diff --git a/test/Tests/Readers/Org/Inline.hs b/test/Tests/Readers/Org/Inline.hs index 7c8a4496c..9edd328c3 100644 --- a/test/Tests/Readers/Org/Inline.hs +++ b/test/Tests/Readers/Org/Inline.hs @@ -210,7 +210,7 @@ tests = <> image "sunset.jpg" "" "") , "Image with html attributes" =: - T.unlines [ "#+ATTR_HTML: :width 50%" + T.unlines [ "#+attr_html: :width 50%" , "[[file:guinea-pig.gif]]" ] =?> para (imageWith ("", [], [("width", "50%")]) "guinea-pig.gif" "" "") diff --git a/test/Tests/Readers/Org/Meta.hs b/test/Tests/Readers/Org/Meta.hs index 0bd63b15d..3290e718b 100644 --- a/test/Tests/Readers/Org/Meta.hs +++ b/test/Tests/Readers/Org/Meta.hs @@ -44,7 +44,7 @@ tests = , testGroup "Export settings" [ "Title" =: - "#+TITLE: Hello, World" =?> + "#+title: Hello, World" =?> let titleInline = toList $ "Hello," <> space <> "World" meta = setMeta "title" (MetaInlines titleInline) nullMeta in Pandoc meta mempty @@ -69,21 +69,21 @@ tests = ] , "Date" =: - "#+Date: Feb. *28*, 2014" =?> + "#+date: Feb. *28*, 2014" =?> let date = toList . spcSep $ [ "Feb.", strong "28" <> ",", "2014" ] meta = setMeta "date" (MetaInlines date) nullMeta in Pandoc meta mempty , testGroup "Description" [ "Single line" =: - "#+DESCRIPTION: Explanatory text" =?> + "#+description: Explanatory text" =?> let description = [Str "Explanatory", Space, Str "text"] meta = setMeta "description" (MetaInlines description) nullMeta in Pandoc meta mempty , "Multiline" =: - T.unlines [ "#+DESCRIPTION: /Short/ introduction" - , "#+DESCRIPTION: to Org-mode" + T.unlines [ "#+description: /Short/ introduction" + , "#+description: to Org-mode" ] =?> let description = [ Emph [Str "Short"], Space, Str "introduction" , SoftBreak @@ -94,54 +94,54 @@ tests = ] , "Subtitle" =: - T.unlines [ "#+SUBTITLE: Your Life in" - , "#+SUBTITLE: /Plain/ Text" + T.unlines [ "#+subtitle: Your Life in" + , "#+subtitle: /Plain/ Text" ] =?> let subtitle = "Your Life in" <> softbreak <> emph "Plain" <> " Text" in Pandoc (setMeta "subtitle" (toMetaValue subtitle) nullMeta) mempty , "Keywords" =: - T.unlines [ "#+KEYWORDS: pandoc, testing," - , "#+KEYWORDS: Org" + T.unlines [ "#+keywords: pandoc, testing," + , "#+keywords: Org" ] =?> let keywords = toList $ "pandoc, testing," <> softbreak <> "Org" meta = setMeta "keywords" (MetaInlines keywords) nullMeta in Pandoc meta mempty , "Institute" =: - "#+INSTITUTE: ACME Inc." =?> + "#+institute: ACME Inc." =?> Pandoc (setMeta "institute" ("ACME Inc." :: Inlines) nullMeta) mempty , testGroup "LaTeX" [ "LATEX_HEADER" =: - "#+LaTeX_header: \\usepackage{tikz}" =?> + "#+latex_header: \\usepackage{tikz}" =?> let latexInlines = rawInline "latex" "\\usepackage{tikz}" inclList = MetaList [MetaInlines (toList latexInlines)] meta = setMeta "header-includes" inclList nullMeta in Pandoc meta mempty , "LATEX_HEADER_EXTRA" =: - "#+LATEX_HEADER_EXTRA: \\usepackage{calc}" =?> + "#+latex_header_extra: \\usepackage{calc}" =?> let latexInlines = rawInline "latex" "\\usepackage{calc}" inclList = toMetaValue [latexInlines] in Pandoc (setMeta "header-includes" inclList nullMeta) mempty , testGroup "LaTeX_CLASS" [ "stored as documentclass" =: - "#+LATEX_CLASS: article" =?> + "#+latex_class: article" =?> let meta = setMeta "documentclass" (MetaString "article") nullMeta in Pandoc meta mempty , "last definition takes precedence" =: - T.unlines [ "#+LATEX_CLASS: this will not be used" - , "#+LATEX_CLASS: report" + T.unlines [ "#+latex_class: this will not be used" + , "#+latex_class: report" ] =?> let meta = setMeta "documentclass" (MetaString "report") nullMeta in Pandoc meta mempty ] , "LATEX_CLASS_OPTIONS as classoption" =: - "#+LATEX_CLASS_OPTIONS: [a4paper]" =?> + "#+latex_class_options: [a4paper]" =?> let meta = setMeta "classoption" (MetaString "a4paper") nullMeta in Pandoc meta mempty ] @@ -155,8 +155,8 @@ tests = in Pandoc meta mempty , "HTML_HEAD_EXTRA behaves like HTML_HEAD" =: - T.unlines [ "#+HTML_HEAD: <meta name=\"generator\" content=\"pandoc\">" - , "#+HTML_HEAD_EXTRA: <meta charset=\"utf-8\">" + T.unlines [ "#+html_head: <meta name=\"generator\" content=\"pandoc\">" + , "#+html_head_extra: <meta charset=\"utf-8\">" ] =?> let generator = rawInline "html" "<meta name=\"generator\" content=\"pandoc\">" @@ -167,9 +167,9 @@ tests = ] , testGroup "Non-export keywords" - [ testGroup "#+LINK" + [ testGroup "#+link" [ "Link abbreviation" =: - T.unlines [ "#+LINK: wp https://en.wikipedia.org/wiki/%s" + T.unlines [ "#+link: wp https://en.wikipedia.org/wiki/%s" , "[[wp:Org_mode][Wikipedia on Org-mode]]" ] =?> para (link "https://en.wikipedia.org/wiki/Org_mode" "" @@ -177,7 +177,7 @@ tests = , "Link abbreviation, defined after first use" =: T.unlines [ "[[zl:non-sense][Non-sense articles]]" - , "#+LINK: zl http://zeitlens.com/tags/%s.html" + , "#+link: zl http://zeitlens.com/tags/%s.html" ] =?> para (link "http://zeitlens.com/tags/non-sense.html" "" ("Non-sense" <> space <> "articles")) @@ -214,11 +214,11 @@ tests = ] , "Unknown keyword" =: - T.unlines [ "#+UNKNOWN_KEYWORD: Chumbawamba" - , "#+ANOTHER_UNKNOWN: Blur" + T.unlines [ "#+unknown_keyword: Chumbawamba" + , "#+another_unknown: Blur" ] =?> - rawBlock "org" "#+UNKNOWN_KEYWORD: Chumbawamba" <> - rawBlock "org" "#+ANOTHER_UNKNOWN: Blur" + rawBlock "org" "#+unknown_keyword: Chumbawamba" <> + rawBlock "org" "#+another_unknown: Blur" ] , "Properties drawer" =: |