jira-wiki-markup 1.1.1 → 1.1.2
raw patch · 4 files changed
+39/−3 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +9/−0
- jira-wiki-markup.cabal +3/−3
- src/Text/Jira/Printer.hs +9/−0
- test/Text/Jira/PrinterTests.hs +18/−0
CHANGELOG.md view
@@ -3,6 +3,15 @@ `jira-wiki-markup` uses [PVP Versioning][1]. The changelog is available [on GitHub][2]. +1.1.2+=====++Released 2020-03-18++* Don't escape colon/semicolon unless necessary: it is necessary+ to escape colons or semicolons only if they could otherwise+ become part of a smiley.+ 1.1.1 =====
jira-wiki-markup.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.0 name: jira-wiki-markup-version: 1.1.1+version: 1.1.2 synopsis: Handle Jira wiki markup description: Parse jira wiki text into an abstract syntax tree for easy transformation to other formats.@@ -18,8 +18,8 @@ tested-with: GHC == 8.0.2 , GHC == 8.2.2 , GHC == 8.4.4- , GHC == 8.6.4- , GHC == 8.8.1+ , GHC == 8.6.5+ , GHC == 8.8.3 source-repository head type: git
src/Text/Jira/Printer.hs view
@@ -56,6 +56,12 @@ (renderInline s `T.snoc` c) <> prettyInlines rest s@Linebreak : SpecialChar c : rest@(Space {}:_) -> (renderInline s `T.snoc` c) <> prettyInlines rest+ -- Colon and semicolon only need escaping if they could otherwise+ -- become part of a smiley.+ SpecialChar c : rest@(x : _) | c `elem` [':', ';'] && not (isSmileyStr x) ->+ T.singleton c <> prettyInlines rest+ [SpecialChar c] | c `elem` [':', ';'] ->+ T.singleton c (x:xs) -> renderInline x <> prettyInlines xs @@ -63,6 +69,9 @@ startsWithAlphaNum t = case T.uncons t of Just (c, _) -> isAlphaNum c _ -> False+ isSmileyStr = \case+ Str x | x `elem` ["D", ")", "(", "P"] -> True+ _ -> False -- | Internal state used by the printer. data PrinterState = PrinterState
test/Text/Jira/PrinterTests.hs view
@@ -149,6 +149,24 @@ , testCase "markup followed by punctuation" $ prettyInlines [Styled Emphasis [Str "Word"], Str "."] @?= "_Word_."++ , testCase "colon as last character" $+ prettyInlines [Str "end", SpecialChar ':'] @?=+ "end:"++ , testCase "semicolon is escaped before close paren" $+ -- would be treated as "winking smiley" otherwise+ prettyInlines [SpecialChar ';', Str ")"] @?=+ "\\;)"++ , testCase "colon is not escaped before space" $+ prettyInlines [SpecialChar ':', Space, Str "end"] @?=+ ": end"++ , testCase "colon not escaped before opening paren" $+ -- escaping the paren is enough+ prettyInlines [SpecialChar ':', SpecialChar '('] @?=+ ":\\(" ] ]