aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pandoc.cabal1
-rw-r--r--src/Text/Pandoc/Writers/Jira.hs10
-rw-r--r--test/Tests/Writers/Jira.hs27
-rw-r--r--test/test-pandoc.hs2
4 files changed, 39 insertions, 1 deletions
diff --git a/pandoc.cabal b/pandoc.cabal
index 9ca53b081..76b42de6f 100644
--- a/pandoc.cabal
+++ b/pandoc.cabal
@@ -789,6 +789,7 @@ test-suite test-pandoc
Tests.Writers.Docbook
Tests.Writers.HTML
Tests.Writers.JATS
+ Tests.Writers.Jira
Tests.Writers.Markdown
Tests.Writers.Org
Tests.Writers.Plain
diff --git a/src/Text/Pandoc/Writers/Jira.hs b/src/Text/Pandoc/Writers/Jira.hs
index 57de04cf5..d1a656687 100644
--- a/src/Text/Pandoc/Writers/Jira.hs
+++ b/src/Text/Pandoc/Writers/Jira.hs
@@ -206,7 +206,7 @@ toJiraInlines inlines = do
then Jira.Linebreak
else Jira.Space
Space -> pure . singleton $ Jira.Space
- Span _attr xs -> toJiraInlines xs
+ Span attr xs -> spanToJira attr xs
Str s -> pure $ escapeSpecialChars s
Strikeout xs -> styled Jira.Strikeout xs
Strong xs -> styled Jira.Strong xs
@@ -263,6 +263,14 @@ quotedToJira qtype xs = do
let surroundWithQuotes = (Jira.Str quoteChar :) . (++ [Jira.Str quoteChar])
surroundWithQuotes <$> toJiraInlines xs
+spanToJira :: PandocMonad m
+ => Attr -> [Inline]
+ -> JiraConverter m [Jira.Inline]
+spanToJira (_, classes, _) =
+ if "underline" `elem` classes
+ then styled Jira.Insert
+ else toJiraInlines
+
registerNotes :: PandocMonad m => [Block] -> JiraConverter m [Jira.Inline]
registerNotes contents = do
curNotes <- gets stNotes
diff --git a/test/Tests/Writers/Jira.hs b/test/Tests/Writers/Jira.hs
new file mode 100644
index 000000000..063497fd1
--- /dev/null
+++ b/test/Tests/Writers/Jira.hs
@@ -0,0 +1,27 @@
+{-# LANGUAGE OverloadedStrings #-}
+module Tests.Writers.Jira (tests) where
+
+import Data.Text (unpack)
+import Test.Tasty
+import Tests.Helpers
+import Text.Pandoc
+import Text.Pandoc.Arbitrary ()
+import Text.Pandoc.Builder
+
+jira :: (ToPandoc a) => a -> String
+jira = unpack . purely (writeJira def) . toPandoc
+
+infix 4 =:
+(=:) :: (ToString a, ToPandoc a)
+ => String -> (a, String) -> TestTree
+(=:) = test jira
+
+tests :: [TestTree]
+tests =
+ [ testGroup "inlines"
+ [ "underlined text" =:
+ spanWith ("ignored", ["ignored", "underline"], [("foo", "bar")])
+ "underlined text" =?>
+ "+underlined text+"
+ ]
+ ]
diff --git a/test/test-pandoc.hs b/test/test-pandoc.hs
index 9d64b61b6..6f013a95c 100644
--- a/test/test-pandoc.hs
+++ b/test/test-pandoc.hs
@@ -34,6 +34,7 @@ import qualified Tests.Writers.Docx
import qualified Tests.Writers.FB2
import qualified Tests.Writers.HTML
import qualified Tests.Writers.JATS
+import qualified Tests.Writers.Jira
import qualified Tests.Writers.LaTeX
import qualified Tests.Writers.Markdown
import qualified Tests.Writers.Muse
@@ -57,6 +58,7 @@ tests pandocPath = testGroup "pandoc tests"
, testGroup "LaTeX" Tests.Writers.LaTeX.tests
, testGroup "HTML" Tests.Writers.HTML.tests
, testGroup "JATS" Tests.Writers.JATS.tests
+ , testGroup "Jira" Tests.Writers.Jira.tests
, testGroup "Docbook" Tests.Writers.Docbook.tests
, testGroup "Markdown" Tests.Writers.Markdown.tests
, testGroup "Org" Tests.Writers.Org.tests