Jira writer: use Span identifiers as anchors
Closes: tarleb/jira-wiki-markup#3.
This commit is contained in:
parent
3793ed8beb
commit
e1454fe0d0
2 changed files with 11 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
]
|
||||
]
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue