git.iko.soy/typeable/pandoc
on master help sign in
Jira writer: use `{color}` when span has a color attribute

Closes: tarleb/jira-wiki-markup#10

commit58fbf56548bf985b40e4338befaf5b11a0665cbe authorAlbert Krewinkel <albert@zeitkraut.de> dateMon 24 May 2021, 09:56 (5 years ago) parentc5f9446
2 files changed+11−3
src/Text/Pandoc/Writers/Jira.hs+7−3 test/Tests/Writers/Jira.hs+4
src/Text/Pandoc/Writers/Jira.hs+7−3
@@ -309,9 +309,13 @@ quotedToJira qtype xs = do
309309spanToJira :: PandocMonad m
310310 => Attr -> [Inline]
311311 -> JiraConverter m [Jira.Inline]
312−spanToJira (ident, _classes, _attribs) inls = case ident of
313− "" -> toJiraInlines inls
314− _ -> (Jira.Anchor ident :) <$> toJiraInlines inls
312+spanToJira (ident, _classes, attribs) inls =
313+ let wrap = case lookup "color" attribs of
314+ Nothing -> id
315+ Just color -> singleton . Jira.ColorInline (Jira.ColorName color)
316+ in wrap <$> case ident of
317+ "" -> toJiraInlines inls
318+ _ -> (Jira.Anchor ident :) <$> toJiraInlines inls
315319
316320registerNotes :: PandocMonad m => [Block] -> JiraConverter m [Jira.Inline]
317321registerNotes contents = do
test/Tests/Writers/Jira.hs+4
@@ -67,6 +67,10 @@ tests =
6767 [ "id is used as anchor" =:
6868 spanWith ("unicorn", [], []) (str "Unicorn") =?>
6969 "{anchor:unicorn}Unicorn"
70+
71+ , "use `color` attribute" =:
72+ spanWith ("",[],[("color","red")]) "ruby" =?>
73+ "{color:red}ruby{color}"
7074 ]
7175
7276 , testGroup "code"