diff options
-rw-r--r-- | src/Text/Pandoc/Writers/Jira.hs | 4 | ||||
-rw-r--r-- | test/Tests/Writers/Jira.hs | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/Jira.hs b/src/Text/Pandoc/Writers/Jira.hs index c21085a4f..131896201 100644 --- a/src/Text/Pandoc/Writers/Jira.hs +++ b/src/Text/Pandoc/Writers/Jira.hs @@ -292,7 +292,9 @@ quotedToJira qtype xs = do spanToJira :: PandocMonad m => Attr -> [Inline] -> JiraConverter m [Jira.Inline] -spanToJira (_, _classes, _) = toJiraInlines +spanToJira (ident, _classes, _attribs) inls = case ident of + "" -> toJiraInlines inls + _ -> (Jira.Anchor ident :) <$> toJiraInlines inls registerNotes :: PandocMonad m => [Block] -> JiraConverter m [Jira.Inline] registerNotes contents = do diff --git a/test/Tests/Writers/Jira.hs b/test/Tests/Writers/Jira.hs index 93d830c94..aff8348d4 100644 --- a/test/Tests/Writers/Jira.hs +++ b/test/Tests/Writers/Jira.hs @@ -3,6 +3,7 @@ module Tests.Writers.Jira (tests) where import Data.Text (unpack) import Test.Tasty +import Test.Tasty.HUnit (HasCallStack) import Tests.Helpers import Text.Pandoc import Text.Pandoc.Arbitrary () @@ -12,7 +13,7 @@ jira :: (ToPandoc a) => a -> String jira = unpack . purely (writeJira def) . toPandoc infix 4 =: -(=:) :: (ToString a, ToPandoc a) +(=:) :: (ToString a, ToPandoc a, HasCallStack) => String -> (a, String) -> TestTree (=:) = test jira @@ -61,5 +62,11 @@ tests = linkWith ("", ["user-account"], []) "~johndoe" "" "~johndoe" =?> "[~johndoe]" ] + + , testGroup "spans" + [ "id is used as anchor" =: + spanWith ("unicorn", [], []) (str "Unicorn") =?> + "{anchor:unicorn}Unicorn" + ] ] ] |