git.iko.soy/typeable/pandoc
on master help sign in
Jira: add support for "smart" links

Support has been added for the new `[alias|https://example.com|smart-card]` syntax.

commitd46ea7d7da3f842d265f09730c90cfc3691576ef authorAlbert Krewinkel <albert@zeitkraut.de> dateTue 25 May 2021, 16:54 (5 years ago) parent8511f6f
6 files changed+22−2
pandoc.cabal+1−1 src/Text/Pandoc/Readers/Jira.hs+2 src/Text/Pandoc/Writers/Jira.hs+2 stack.yaml+1−1 test/Tests/Readers/Jira.hs+8 test/Tests/Writers/Jira.hs+8
pandoc.cabal+1−1
@@ -470,7 +470,7 @@ library
470470 http-client-tls >= 0.2.4 && < 0.4,
471471 http-types >= 0.8 && < 0.13,
472472 ipynb >= 0.1 && < 0.2,
473− jira-wiki-markup >= 1.3.5 && < 1.4,
473+ jira-wiki-markup >= 1.4 && < 1.5,
474474 mtl >= 2.2 && < 2.3,
475475 network >= 2.6,
476476 network-uri >= 2.6 && < 2.8,
src/Text/Pandoc/Readers/Jira.hs+2
@@ -172,6 +172,8 @@ jiraLinkToPandoc linkType alias url =
172172 Jira.Email -> link ("mailto:" <> url') "" alias'
173173 Jira.Attachment -> linkWith ("", ["attachment"], []) url' "" alias'
174174 Jira.User -> linkWith ("", ["user-account"], []) url' "" alias'
175+ Jira.SmartCard -> linkWith ("", ["smart-card"], []) url' "" alias'
176+ Jira.SmartLink -> linkWith ("", ["smart-link"], []) url' "" alias'
175177
176178-- | Get unicode representation of a Jira icon.
177179iconUnicode :: Jira.Icon -> Text
src/Text/Pandoc/Writers/Jira.hs+2
@@ -280,6 +280,8 @@ toJiraLink (_, classes, _) (url, _) alias = do
280280 | Just email <- T.stripPrefix "mailto:" url' = (Jira.Email, email)
281281 | "user-account" `elem` classes = (Jira.User, dropTilde url)
282282 | "attachment" `elem` classes = (Jira.Attachment, url)
283+ | "smart-card" `elem` classes = (Jira.SmartCard, url)
284+ | "smart-link" `elem` classes = (Jira.SmartLink, url)
283285 | otherwise = (Jira.External, url)
284286 dropTilde txt = case T.uncons txt of
285287 Just ('~', username) -> username
stack.yaml+1−1
@@ -9,7 +9,7 @@ packages:
99extra-deps:
1010- hslua-1.3.0
1111- hslua-module-path-0.1.0
12−- jira-wiki-markup-1.3.5
12+- jira-wiki-markup-1.4.0
1313- random-1.2.0
1414- unicode-collation-0.1.3
1515- citeproc-0.4
test/Tests/Readers/Jira.hs+8
@@ -167,6 +167,14 @@ tests =
167167 , "user with description" =:
168168 "[John Doe|~johndoe]" =?>
169169 para (linkWith ("", ["user-account"], []) "~johndoe" "" "John Doe")
170+
171+ , "'smart' link" =:
172+ "[x|http://example.com|smart-link]" =?>
173+ para (linkWith ("", ["smart-link"], []) "http://example.com" "" "x")
174+
175+ , "'smart' card" =:
176+ "[x|http://example.com|smart-card]" =?>
177+ para (linkWith ("", ["smart-card"], []) "http://example.com" "" "x")
170178 ]
171179
172180 , "image" =:
test/Tests/Writers/Jira.hs+8
@@ -61,6 +61,14 @@ tests =
6161 , "user link with user as description" =:
6262 linkWith ("", ["user-account"], []) "~johndoe" "" "~johndoe" =?>
6363 "[~johndoe]"
64+
65+ , "'smart' link" =:
66+ para (linkWith ("", ["smart-link"], []) "http://example.com" "" "x") =?>
67+ "[x|http://example.com|smart-link]"
68+
69+ , "'smart' card" =:
70+ para (linkWith ("", ["smart-card"], []) "http://example.org" "" "x") =?>
71+ "[x|http://example.org|smart-card]"
6472 ]
6573
6674 , testGroup "spans"