diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2018-02-21 08:53:29 +0100 |
---|---|---|
committer | Albert Krewinkel <albert@zeitkraut.de> | 2018-02-21 22:43:18 +0100 |
commit | 00d20ccd09a8542fda631ab16c7f569098f2918d (patch) | |
tree | 7fb3eff8a5c95349d9f50e9b8cdc73250b63c637 /test/Tests | |
parent | 84db7e492a7a7091ca366f24c21dd5d44163f0da (diff) | |
download | pandoc-00d20ccd09a8542fda631ab16c7f569098f2918d.tar.gz |
Org reader: allow changing emphasis syntax
The characters allowed before and after emphasis can be configured via
`#+pandoc-emphasis-pre` and `#+pandoc-emphasis-post`, respectively. This
allows to change which strings are recognized as emphasized text on a
per-document or even per-paragraph basis. The allowed characters must be
given as (Haskell) string.
#+pandoc-emphasis-pre: "-\t ('\"{"
#+pandoc-emphasis-post: "-\t\n .,:!?;'\")}["
If the argument cannot be read as a string, the default value is
restored.
Closes: #4378
Diffstat (limited to 'test/Tests')
-rw-r--r-- | test/Tests/Readers/Org/Meta.hs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/test/Tests/Readers/Org/Meta.hs b/test/Tests/Readers/Org/Meta.hs index 409cd00ae..6bd1b02e7 100644 --- a/test/Tests/Readers/Org/Meta.hs +++ b/test/Tests/Readers/Org/Meta.hs @@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} module Tests.Readers.Org.Meta (tests) where -import Test.Tasty (TestTree) +import Test.Tasty (TestTree, testGroup) import Tests.Helpers ((=?>)) import Tests.Readers.Org.Shared ((=:), spcSep) import Text.Pandoc @@ -170,4 +170,22 @@ tests = , "[[expl:foo][bar]]" ] =?> para (link "http://example.com/foo" "" "bar") + + , testGroup "emphasis config" + [ "Changing pre and post chars for emphasis" =: + T.unlines [ "#+pandoc-emphasis-pre: \"[)\"" + , "#+pandoc-emphasis-post: \"]\\n\"" + , "([/emph/])*foo*" + ] =?> + para ("([" <> emph "emph" <> "])" <> strong "foo") + + , "setting an invalid value restores the default" =: + T.unlines [ "#+pandoc-emphasis-pre: \"[\"" + , "#+pandoc-emphasis-post: \"]\"" + , "#+pandoc-emphasis-pre:" + , "#+pandoc-emphasis-post:" + , "[/noemph/]" + ] =?> + para ("[/noemph/]") + ] ] |