Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package ghc-commonmark-extensions for
openSUSE:Factory checked in at 2024-03-20 21:13:58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-commonmark-extensions (Old)
and /work/SRC/openSUSE:Factory/.ghc-commonmark-extensions.new.1905 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-commonmark-extensions"
Wed Mar 20 21:13:58 2024 rev:15 rq:1157239 version:0.2.5.4
Changes:
--------
---
/work/SRC/openSUSE:Factory/ghc-commonmark-extensions/ghc-commonmark-extensions.changes
2023-12-21 23:38:24.202078068 +0100
+++
/work/SRC/openSUSE:Factory/.ghc-commonmark-extensions.new.1905/ghc-commonmark-extensions.changes
2024-03-20 21:15:52.513370154 +0100
@@ -1,0 +2,37 @@
+Mon Mar 11 18:04:35 UTC 2024 - Peter Simons <[email protected]>
+
+- Update commonmark-extensions to version 0.2.5.4.
+ ## 0.2.5.4
+
+ * Fix autolink parsing regression (#151). This affects autolinks with
+ doubled internal line-ending punctuation characters.
+
+-------------------------------------------------------------------
+Wed Feb 28 05:53:52 UTC 2024 - Peter Simons <[email protected]>
+
+- Update commonmark-extensions to version 0.2.5.3.
+ ## 0.2.5.3
+
+ * Fix rebase_relative_paths extension so it works with URLs with
+ non-ASCII characters (#148). Previously these would not be properly
+ detected as absolute URIs.
+
+-------------------------------------------------------------------
+Thu Feb 15 04:42:30 UTC 2024 - Peter Simons <[email protected]>
+
+- Update commonmark-extensions to version 0.2.5.2.
+ ## 0.2.5.2
+
+ * Improve autolinks extension (#147).
+ The autolinks extension was interacting badly with explicit links,
+ To fix this we had to make autolink parsing a bit stricter than
+ the GFM spec does. They allow unbalanced `)` except at the end
+ of a URL (which is defined as: followed by optional final punctuation
+ then whitespace or eof). With this change, we don't allow unbalanced
+ `)` at all in raw URLs. This should not be a big problem in practice.
+
+ * Protect against quadratic generated table size explosion (Michael
Howell).
+ This commit adds a limit to the number of auto-completed cells
+ around 200,000. The result is, in these original samples:
+
+-------------------------------------------------------------------
Old:
----
commonmark-extensions-0.2.5.1.tar.gz
New:
----
commonmark-extensions-0.2.5.4.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-commonmark-extensions.spec ++++++
--- /var/tmp/diff_new_pack.39ng7K/_old 2024-03-20 21:15:53.117392790 +0100
+++ /var/tmp/diff_new_pack.39ng7K/_new 2024-03-20 21:15:53.117392790 +0100
@@ -1,7 +1,7 @@
#
# spec file for package ghc-commonmark-extensions
#
-# Copyright (c) 2023 SUSE LLC
+# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -20,7 +20,7 @@
%global pkgver %{pkg_name}-%{version}
%bcond_with tests
Name: ghc-%{pkg_name}
-Version: 0.2.5.1
+Version: 0.2.5.4
Release: 0
Summary: Pure Haskell commonmark parser
License: BSD-3-Clause
++++++ commonmark-extensions-0.2.5.1.tar.gz ->
commonmark-extensions-0.2.5.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/commonmark-extensions-0.2.5.1/changelog.md
new/commonmark-extensions-0.2.5.4/changelog.md
--- old/commonmark-extensions-0.2.5.1/changelog.md 2001-09-09
03:46:40.000000000 +0200
+++ new/commonmark-extensions-0.2.5.4/changelog.md 2001-09-09
03:46:40.000000000 +0200
@@ -1,5 +1,30 @@
# Changelog for commonmark-extensions
+## 0.2.5.4
+
+ * Fix autolink parsing regression (#151). This affects autolinks with
+ doubled internal line-ending punctuation characters.
+
+## 0.2.5.3
+
+ * Fix rebase_relative_paths extension so it works with URLs with
+ non-ASCII characters (#148). Previously these would not be properly
+ detected as absolute URIs.
+
+## 0.2.5.2
+
+ * Improve autolinks extension (#147).
+ The autolinks extension was interacting badly with explicit links,
+ To fix this we had to make autolink parsing a bit stricter than
+ the GFM spec does. They allow unbalanced `)` except at the end
+ of a URL (which is defined as: followed by optional final punctuation
+ then whitespace or eof). With this change, we don't allow unbalanced
+ `)` at all in raw URLs. This should not be a big problem in practice.
+
+ * Protect against quadratic generated table size explosion (Michael Howell).
+ This commit adds a limit to the number of auto-completed cells
+ around 200,000. The result is, in these original samples:
+
## 0.2.5.1
* Add `test/alerts.md` to extra-source-files in cabal file.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/commonmark-extensions-0.2.5.1/commonmark-extensions.cabal
new/commonmark-extensions-0.2.5.4/commonmark-extensions.cabal
--- old/commonmark-extensions-0.2.5.1/commonmark-extensions.cabal
2001-09-09 03:46:40.000000000 +0200
+++ new/commonmark-extensions-0.2.5.4/commonmark-extensions.cabal
2001-09-09 03:46:40.000000000 +0200
@@ -1,5 +1,5 @@
name: commonmark-extensions
-version: 0.2.5.1
+version: 0.2.5.4
synopsis: Pure Haskell commonmark parser.
description:
This library provides some useful extensions to core commonmark
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/commonmark-extensions-0.2.5.1/src/Commonmark/Extensions/Autolink.hs
new/commonmark-extensions-0.2.5.4/src/Commonmark/Extensions/Autolink.hs
--- old/commonmark-extensions-0.2.5.1/src/Commonmark/Extensions/Autolink.hs
2001-09-09 03:46:40.000000000 +0200
+++ new/commonmark-extensions-0.2.5.4/src/Commonmark/Extensions/Autolink.hs
2001-09-09 03:46:40.000000000 +0200
@@ -32,7 +32,7 @@
wwwAutolink = try $ do
lookAhead $ satisfyWord (== "www")
validDomain
- linkSuffix
+ linkPath 0
return "http://"
validDomain :: Monad m => InlineParser m ()
@@ -47,29 +47,40 @@
domainPart
skipMany1 $ try (symbol '.' >> domainPart)
-linkSuffix :: Monad m => InlineParser m ()
-linkSuffix = try $ do
- toks <- getInput
- let possibleSuffixTok (Tok (Symbol c) _ _) =
- c `notElem` ['<','>','{','}','|','\\','^','[',']','`']
- possibleSuffixTok (Tok WordChars _ _) = True
- possibleSuffixTok _ = False
- let isDroppable (Tok (Symbol c) _ _) =
- c `elem` ['?','!','.',',',':','*','_','~']
- isDroppable _ = False
- let numToks = case dropWhile isDroppable $
- reverse (takeWhile possibleSuffixTok toks) of
- (Tok (Symbol ')') _ _ : xs)
- | length [t | t@(Tok (Symbol '(') _ _) <- xs] <=
- length [t | t@(Tok (Symbol ')') _ _) <- xs]
- -> length xs
- (Tok (Symbol ';') _ _
- : Tok WordChars _ _
- : Tok (Symbol '&') _ _
- : xs) -> length xs
- xs -> length xs
- count numToks anyTok
- return ()
+linkPath :: Monad m => Int -> InlineParser m ()
+linkPath openParens = optional $ do
+ Tok tt _ _ <- lookAhead anyTok
+ case tt of
+ Symbol '&' -> optional $
+ try (symbol '&' *>
+ notFollowedBy
+ (try (satisfyWord (const True) *> symbol ';' *> linkEnd)) *>
+ linkPath openParens)
+ Symbol '(' -> symbol '(' *> linkPath (openParens + 1)
+ Symbol ')' -> optional $ guard (openParens > 0) *> symbol ')' *> linkPath
(openParens - 1)
+ Symbol '<' -> pure ()
+ Symbol c | isTrailingPunctuation c -> optional $
+ try (do skipMany1 trailingPunctuation
+ pos <- getPosition
+ linkPath openParens
+ pos' <- getPosition
+ guard (pos' > pos)) *> linkPath openParens
+ LineEnd -> pure ()
+ Spaces -> pure ()
+ _ -> anyTok *> linkPath openParens
+
+linkEnd :: Monad m => InlineParser m ()
+linkEnd = try $ skipMany trailingPunctuation *> (void whitespace <|> eof)
+
+trailingPunctuation :: Monad m => InlineParser m Tok
+trailingPunctuation =
+ satisfyTok (\t -> case tokType t of
+ Symbol c -> isTrailingPunctuation c
+ _ -> False)
+
+isTrailingPunctuation :: Char -> Bool
+isTrailingPunctuation =
+ (`elem` ['!', '"', '\'', ')', '*', ',', '.', ':', ';', '?', '_', '~', '<'])
urlAutolink :: Monad m => InlineParser m Text
urlAutolink = try $ do
@@ -78,7 +89,7 @@
symbol '/'
symbol '/'
validDomain
- linkSuffix
+ linkPath 0
return ""
emailAutolink :: Monad m => InlineParser m Text
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/commonmark-extensions-0.2.5.1/src/Commonmark/Extensions/PipeTable.hs
new/commonmark-extensions-0.2.5.4/src/Commonmark/Extensions/PipeTable.hs
--- old/commonmark-extensions-0.2.5.1/src/Commonmark/Extensions/PipeTable.hs
2001-09-09 03:46:40.000000000 +0200
+++ new/commonmark-extensions-0.2.5.4/src/Commonmark/Extensions/PipeTable.hs
2001-09-09 03:46:40.000000000 +0200
@@ -34,6 +34,9 @@
data PipeTableData = PipeTableData
{ pipeTableAlignments :: [ColAlignment]
+ , pipeTableColCount :: !Int
+ , pipeTableRowCount :: !Int
+ , pipeTableCellCount :: !Int
, pipeTableHeaders :: [[Tok]]
, pipeTableRows :: [[[Tok]]] -- in reverse order
} deriving (Show, Eq, Data, Typeable)
@@ -136,6 +139,14 @@
{ syntaxBlockSpecs = [pipeTableBlockSpec]
}
+getAutoCompletedCellCount :: PipeTableData -> Int
+getAutoCompletedCellCount tabledata =
+ (numrows * numcols) - numcells
+ where
+ numrows = pipeTableRowCount tabledata
+ numcols = pipeTableColCount tabledata
+ numcells = pipeTableCellCount tabledata
+
-- This parser is structured as a system that parses the *second* line first,
-- then parses the first line. That is, if it detects a delimiter row as the
-- second line of a paragraph, it converts the paragraph into a table. This
seems
@@ -173,6 +184,9 @@
updateState $ \st' -> st'{ nodeStack = rest }
let tabledata = PipeTableData
{ pipeTableAlignments = aligns
+ , pipeTableColCount = length cells
+ , pipeTableRowCount = 0
+ , pipeTableCellCount = 0
, pipeTableHeaders = cells
, pipeTableRows = []
}
@@ -194,23 +208,45 @@
let tabledata = fromDyn
(blockData ndata)
PipeTableData{ pipeTableAlignments = []
+ , pipeTableColCount = 0
+ , pipeTableRowCount = 0
+ , pipeTableCellCount = 0
, pipeTableHeaders = []
, pipeTableRows = [] }
pos <- getPosition
cells <- pCells
- let tabledata' = tabledata{ pipeTableRows =
- cells : pipeTableRows tabledata }
+ let cells' = take (pipeTableColCount tabledata) cells
+ let tabledata' =
+ tabledata{ pipeTableRows = cells' : pipeTableRows tabledata
+ , pipeTableRowCount = 1 + pipeTableRowCount tabledata
+ , pipeTableCellCount = length cells' +
pipeTableCellCount tabledata
+ }
+ -- Protect against quadratic output size explosion.
+ --
+ -- Because the table extension fills in missing table cells,
+ -- you can, theoretically, force the output to grows as the
+ -- square of the input by adding one column and one row.
+ -- This is a side-effect of the extension as specified in GFM,
+ -- and follows from the geometric definition of "squaring."
+ --
+ -- To prevent this, we track the number of Real Cells,
+ -- and if the number of autocompleted cells exceeds 200,000,
+ -- stop parsing.
+ guard $ getAutoCompletedCellCount tabledata <= 200000
return $! (pos, Node ndata{ blockData =
toDyn tabledata' } children)
, blockConstructor = \(Node ndata _) -> do
let tabledata = fromDyn
(blockData ndata)
PipeTableData{ pipeTableAlignments = []
+ , pipeTableColCount = 0
+ , pipeTableRowCount = 0
+ , pipeTableCellCount = 0
, pipeTableHeaders = []
, pipeTableRows = [] }
let aligns = pipeTableAlignments tabledata
headers <- mapM runInlineParser (pipeTableHeaders tabledata)
- let numcols = length headers
+ let numcols = pipeTableColCount tabledata
rows <- mapM (mapM runInlineParser . take numcols . (++ (repeat [])))
(reverse $ pipeTableRows tabledata)
return $! (pipeTable aligns headers rows)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/commonmark-extensions-0.2.5.1/src/Commonmark/Extensions/RebaseRelativePaths.hs
new/commonmark-extensions-0.2.5.4/src/Commonmark/Extensions/RebaseRelativePaths.hs
---
old/commonmark-extensions-0.2.5.1/src/Commonmark/Extensions/RebaseRelativePaths.hs
2001-09-09 03:46:40.000000000 +0200
+++
new/commonmark-extensions-0.2.5.4/src/Commonmark/Extensions/RebaseRelativePaths.hs
2001-09-09 03:46:40.000000000 +0200
@@ -7,6 +7,7 @@
import Commonmark.Types
import Commonmark.Syntax
import Commonmark.Inlines
+import Data.Char (isAscii)
import Data.Text (Text)
import qualified Data.Text as T
import Data.Maybe (fromMaybe)
@@ -14,7 +15,7 @@
import System.FilePath
import qualified System.FilePath.Windows as Windows
import qualified System.FilePath.Posix as Posix
-import Network.URI (URI (uriScheme), parseURI)
+import Network.URI (URI (uriScheme), parseURI, escapeURIString)
import qualified Data.Set as Set
rebaseRelativePathsSpec
@@ -128,7 +129,7 @@
-- | Check if the string is a valid URL with a IANA or frequently used but
-- unofficial scheme (see @schemes@).
isURI :: T.Text -> Bool
-isURI = maybe False hasKnownScheme . parseURI . T.unpack
+isURI = maybe False hasKnownScheme . parseURI . escapeURIString isAscii .
T.unpack
where
hasKnownScheme = (`Set.member` schemes) . T.toLower .
T.filter (/= ':') . T.pack . uriScheme
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/commonmark-extensions-0.2.5.1/test/autolinks.md
new/commonmark-extensions-0.2.5.4/test/autolinks.md
--- old/commonmark-extensions-0.2.5.1/test/autolinks.md 2001-09-09
03:46:40.000000000 +0200
+++ new/commonmark-extensions-0.2.5.4/test/autolinks.md 2001-09-09
03:46:40.000000000 +0200
@@ -49,10 +49,37 @@
<p>Visit <a
href="http://www.commonmark.org/~jm/foo/bar.pdf">www.commonmark.org/~jm/foo/bar.pdf</a>.</p>
````````````````````````````````
-When an autolink ends in `)`, we scan the entire autolink for the total number
-of parentheses. If there is a greater number of closing parentheses than
-opening ones, we don't consider the last character part of the autolink, in
-order to facilitate including an autolink inside a parenthesis:
+((commonmark-hs: We depart from the GFM spec here. Alternative spec and tests
+can be found after these commented-out ones. For motivation for this departure
from
+the GFM spec, see #147.))
+
+> When an autolink ends in `)`, we scan the entire autolink for the total
number
+> of parentheses. If there is a greater number of closing parentheses than
+> opening ones, we don't consider the last character part of the autolink, in
+> order to facilitate including an autolink inside a parenthesis:
+>
+> ```````````````````````````````` example
+> www.google.com/search?q=Markup+(business)
+>
+> (www.google.com/search?q=Markup+(business))
+> .
+> <p><a
href="http://www.google.com/search?q=Markup+(business)">www.google.com/search?q=Markup+(business)</a></p>
+> <p>(<a
href="http://www.google.com/search?q=Markup+(business)">www.google.com/search?q=Markup+(business)</a>)</p>
+> ````````````````````````````````
+>
+> This check is only done when the link ends in a closing parentheses `)`, so
if
+> the only parentheses are in the interior of the autolink, no special rules
are
+> applied:
+>
+> ```````````````````````````````` example
+> www.google.com/search?q=(business))+ok
+> .
+> <p><a
href="http://www.google.com/search?q=(business))+ok">www.google.com/search?q=(business))+ok</a></p>
+> ````````````````````````````````
+
+Autolinks can contain balanced pairs of parentheses, or unbalanced `)`.
+We don't allow unbalanced `)`, in order to facilitate including
+an autolink inside a parenthesis:
```````````````````````````````` example
www.google.com/search?q=Markup+(business)
@@ -63,16 +90,15 @@
<p>(<a
href="http://www.google.com/search?q=Markup+(business)">www.google.com/search?q=Markup+(business)</a>)</p>
````````````````````````````````
-This check is only done when the link ends in a closing parentheses `)`, so if
-the only parentheses are in the interior of the autolink, no special rules are
-applied:
-
+Issue #147:
```````````````````````````````` example
-www.google.com/search?q=(business))+ok
+[link](https://baidu.com)aaa<span></span>bbb
.
-<p><a
href="http://www.google.com/search?q=(business))+ok">www.google.com/search?q=(business))+ok</a></p>
+<p><a href="https://baidu.com">link</a>aaa<span></span>bbb</p>
````````````````````````````````
+((End of diverging section.))
+
If an autolink ends in a semicolon (`;`), we check to see if it appears to
resemble an [entity reference][entity references]; if the preceding text is `&`
followed by one or more alphanumeric characters. If so, it is excluded from
@@ -168,3 +194,17 @@
.
<p><a href="http://www.google.com/">a link</a>stuff?</p>
````````````````````````````````
+
+Autolinks with punctuation (#151):
+
+```````````````````````````````` example
+https://en.wikipedia.org/wiki/St._Petersburg_paradox
+
+https://en.wikipedia.org/wiki/Liaison_(French)
+
+https://en.wikipedia.org/wiki/Frederick_III,_German_Emperor
+.
+<p><a
href="https://en.wikipedia.org/wiki/St._Petersburg_paradox">https://en.wikipedia.org/wiki/St._Petersburg_paradox</a></p>
+<p><a
href="https://en.wikipedia.org/wiki/Liaison_(French)">https://en.wikipedia.org/wiki/Liaison_(French)</a></p>
+<p><a
href="https://en.wikipedia.org/wiki/Frederick_III,_German_Emperor">https://en.wikipedia.org/wiki/Frederick_III,_German_Emperor</a></p>
+````````````````````````````````