packages feed

matterhorn 50200.10.2 → 50200.10.3

raw patch · 3 files changed

+29/−2 lines, 3 files

Files

CHANGELOG.md view
@@ -1,4 +1,12 @@ +50200.10.3+==========++Bug fixes:+ * Fixed an issue where hyperlinks whose labels contained more+   hyperlinks would cause Matterhorn to generate rendering bug report+   messages (#674)+ 50200.10.2 ========== 
matterhorn.cabal view
@@ -1,5 +1,5 @@ name:                matterhorn-version:             50200.10.2+version:             50200.10.3 synopsis:            Terminal client for the Mattermost chat system description:         This is a terminal client for the Mattermost chat                      system. Please see the README for a list of
src/Types/RichText.hs view
@@ -205,6 +205,25 @@                   C.ParenFollowing -> Paren     in Numbered dec i +-- | Remove hyperlinks from an inline sequence. This should only be used+-- for sequences that are themselves used as labels for hyperlinks; this+-- prevents them from embedding their own hyperlinks, which is nonsense.+--+-- Any hyperlinks found in the sequence will be replaced with a text+-- represent of their URL (if they have no label) or the label itself+-- otherwise.+removeHyperlinks :: Seq C.Inline -> Seq C.Inline+removeHyperlinks is =+    case Seq.viewl is of+        h :< t ->+            case h of+                C.Link label theUrl _ ->+                    if Seq.null label+                    then C.Str theUrl <| removeHyperlinks t+                    else removeHyperlinks label <> removeHyperlinks t+                _ -> h <| removeHyperlinks t+        Seq.EmptyL -> mempty+ -- | Convert a sequence of Markdown inline values to a sequence of -- Elements. --@@ -291,7 +310,7 @@           C.Link label theUrl _ :< xs ->               let mLabel = if Seq.null label                            then Nothing-                           else Just $ fromMarkdownInlines label+                           else Just $ fromMarkdownInlines $ removeHyperlinks label                   url = URL theUrl               in (Element (Hyperlink url sty) $ EHyperlink url mLabel) <| go sty xs           C.Image altIs theUrl _ :< xs ->