packages feed

jira-wiki-markup 1.3.1 → 1.3.2

raw patch · 5 files changed

+38/−10 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -4,6 +4,14 @@ `jira-wiki-markup` uses [PVP Versioning][1]. The changelog is available [on GitHub][2]. +1.3.2+-----++Released 2020-06-22.++* Braces are now always escaped when printing; Jira treats braces+  specially, regardless of context.+ 1.3.1 ----- 
README.md view
@@ -1,16 +1,21 @@ # jira-wiki-markup  [![Hackage](https://img.shields.io/hackage/v/jira-wiki-markup.svg)](https://hackage.haskell.org/package/jira-wiki-markup)-[![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)-[![Stackage Lts](http://stackage.org/package/jira-wiki-markup/badge/lts)](http://stackage.org/lts/package/jira-wiki-markup)-[![Stackage Nightly](http://stackage.org/package/jira-wiki-markup/badge/nightly)](http://stackage.org/nightly/package/jira-wiki-markup)-[![Build status](https://travis-ci.com/tarleb/jira-wiki-markup.svg?branch=master)](https://travis-ci.com/tarleb/jira-wiki-markup)-[![Windows build status](https://ci.appveyor.com/api/projects/status/github/tarleb/jira-wiki-markup?branch=master&svg=true)](https://ci.appveyor.com/project/tarleb/jira-wiki-markup)+[![MIT license][License badge]](LICENSE)+[![Stackage Lts][Stackage Lts badge]](http://stackage.org/lts/package/jira-wiki-markup)+[![Stackage Nightly][Stackage Nightly badge]](http://stackage.org/nightly/package/jira-wiki-markup)+[![Build status][Travis badge]](https://travis-ci.com/tarleb/jira-wiki-markup)+[![Windows build status][AppVeyor badge]](https://ci.appveyor.com/project/tarleb/jira-wiki-markup)  This package provides a parser and printer for [Jira wiki markup]. It converts the raw text into an abstract syntax tree. The tree is easy to handle and to translate into different output formats. +[License badge]: https://img.shields.io/badge/license-MIT-blue.svg+[Stackage Lts badge]: http://stackage.org/package/jira-wiki-markup/badge/lts+[Stackage Nightly badge]: http://stackage.org/package/jira-wiki-markup/badge/nightly+[Travis badge]: https://travis-ci.com/tarleb/jira-wiki-markup.svg?branch=master+[AppVeyor badge]: https://ci.appveyor.com/api/projects/status/github/tarleb/jira-wiki-markup?branch=master&svg=true [Jira wiki markup]: https://jira.atlassian.com/secure/WikiRendererHelpAction.jspa?section=all  # License
jira-wiki-markup.cabal view
@@ -1,6 +1,6 @@ cabal-version:       2.0 name:                jira-wiki-markup-version:             1.3.1+version:             1.3.2 synopsis:            Handle Jira wiki markup description:         Parse jira wiki text into an abstract syntax tree for easy                      transformation to other formats.
src/Text/Jira/Printer.hs view
@@ -50,11 +50,13 @@     renderInline s <> renderStyledSafely style inlns <> prettyInlines rest   Styled style inlns : s@(Str t) : rest | startsWithAlphaNum t ->     renderStyledSafely style inlns <> renderInline s <> prettyInlines rest-  s@Str{} : SpecialChar c : rest@(Str {}:_) ->+  -- Most special chars don't need escaping when surrounded by spaces or within+  -- a word. Braces are the exception, they should always be escaped.+  s@Str{} : SpecialChar c : rest@(Str {}:_) | not (isBrace c) ->     (renderInline s `T.snoc` c) <> prettyInlines rest-  s@Space : SpecialChar c : rest@(Space {}:_) ->+  s@Space : SpecialChar c : rest@(Space {}:_) | not (isBrace c) ->     (renderInline s `T.snoc` c) <> prettyInlines rest-  s@Linebreak : SpecialChar c : rest@(Space {}:_) ->+  s@Linebreak : SpecialChar c : rest@(Space {}:_) | not (isBrace c) ->     (renderInline s `T.snoc` c) <> prettyInlines rest   -- Colon and semicolon only need escaping if they could otherwise   -- become part of a smiley.@@ -69,6 +71,11 @@     renderInline x <> prettyInlines xs    where+    isBrace = \case+      '{' -> True+      '}' -> True+      _   -> False+     startsWithAlphaNum t = case T.uncons t of       Just (c, _) -> isAlphaNum c       _           -> False
test/Text/Jira/PrinterTests.hs view
@@ -171,7 +171,11 @@     ]    , testGroup "combined inlines"-    [ testCase "special char between words" $+    [ testCase "opening brace between words" $+      prettyInlines [Str "a", SpecialChar '{', Str "b"] @?=+      "a\\{b"++    , testCase "other special char between words" $       prettyInlines [Str "easy", SpecialChar '-', Str "peasy"] @?=       "easy-peasy" @@ -199,6 +203,10 @@     , testCase "colon is not escaped before space" $       prettyInlines [SpecialChar ':', Space, Str "end"] @?=       ": end"++    , testCase "closing brace between spaces" $+      prettyInlines [Space, SpecialChar '}', Space] @?=+      " \\} "      , testCase "colon not escaped before opening paren" $       -- escaping the paren is enough