From 00d20ccd09a8542fda631ab16c7f569098f2918d Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Wed, 21 Feb 2018 08:53:29 +0100 Subject: 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 --- test/Tests/Readers/Org/Meta.hs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'test/Tests/Readers') 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/]") + ] ] -- cgit v1.2.3