Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package ghc-shakespeare for openSUSE:Factory
checked in at 2025-06-11 16:26:53
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-shakespeare (Old)
and /work/SRC/openSUSE:Factory/.ghc-shakespeare.new.19631 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-shakespeare"
Wed Jun 11 16:26:53 2025 rev:13 rq:1284553 version:2.1.4
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-shakespeare/ghc-shakespeare.changes
2024-08-16 12:23:52.675600519 +0200
+++
/work/SRC/openSUSE:Factory/.ghc-shakespeare.new.19631/ghc-shakespeare.changes
2025-06-11 16:28:38.605773164 +0200
@@ -1,0 +2,9 @@
+Thu Jun 5 15:56:06 UTC 2025 - Peter Simons <[email protected]>
+
+- Update shakespeare to version 2.1.4.
+ Upstream has edited the change log file since the last release in
+ a non-trivial way, i.e. they did more than just add a new entry
+ at the top. You can review the file at:
+ http://hackage.haskell.org/package/shakespeare-2.1.4/src/ChangeLog.md
+
+-------------------------------------------------------------------
Old:
----
shakespeare-2.1.1.tar.gz
New:
----
shakespeare-2.1.4.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-shakespeare.spec ++++++
--- /var/tmp/diff_new_pack.8UPT5I/_old 2025-06-11 16:28:39.281801364 +0200
+++ /var/tmp/diff_new_pack.8UPT5I/_new 2025-06-11 16:28:39.285801531 +0200
@@ -1,7 +1,7 @@
#
# spec file for package ghc-shakespeare
#
-# Copyright (c) 2024 SUSE LLC
+# Copyright (c) 2025 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: 2.1.1
+Version: 2.1.4
Release: 0
Summary: A toolkit for making compile-time interpolated templates
License: MIT
++++++ shakespeare-2.1.1.tar.gz -> shakespeare-2.1.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/shakespeare-2.1.1/ChangeLog.md
new/shakespeare-2.1.4/ChangeLog.md
--- old/shakespeare-2.1.1/ChangeLog.md 2024-08-05 08:03:42.000000000 +0200
+++ new/shakespeare-2.1.4/ChangeLog.md 2025-06-05 17:55:54.000000000 +0200
@@ -1,8 +1,13 @@
# ChangeLog for shakespeare
-### 2.1.1
+### 2.1.4
-* Add support for `TypeApplications` inside Shakespeare quasiquotes
+* [#292](https://github.com/yesodweb/shakespeare/pull/292)
+ * Add support for multi-line attributes. An example use of this is
[here](https://github.com/yesodweb/shakespeare/issues/291).
+
+### 2.1.2
+
+* Add support for context parsing in mkMessage function and related ones
[#282](https://github.com/yesodweb/shakespeare/issues/282). Added support for
building with LTS versions of 22, 21, 20 and removed older ones.
### 2.1.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/shakespeare-2.1.1/Text/Hamlet/Parse.hs
new/shakespeare-2.1.4/Text/Hamlet/Parse.hs
--- old/shakespeare-2.1.1/Text/Hamlet/Parse.hs 2024-08-05 08:03:30.000000000
+0200
+++ new/shakespeare-2.1.4/Text/Hamlet/Parse.hs 2025-06-05 17:55:31.000000000
+0200
@@ -283,7 +283,7 @@
contentReg InContent = (ContentRaw . return) <$> noneOf "#@^\r\n"
contentReg NotInQuotes = (ContentRaw . return) <$> noneOf "@^#. \t\n\r>"
contentReg NotInQuotesAttr = (ContentRaw . return) <$> noneOf "@^ \t\n\r>"
- contentReg InQuotes = (ContentRaw . return) <$> noneOf "#@^\"\n\r"
+ contentReg InQuotes = (ContentRaw . return) <$> noneOf "#@^\""
tagAttribValue notInQuotes = do
cr <- (char '"' >> return InQuotes) <|> return notInQuotes
fst <$> content cr
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/shakespeare-2.1.1/Text/Shakespeare/Base.hs
new/shakespeare-2.1.4/Text/Shakespeare/Base.hs
--- old/shakespeare-2.1.1/Text/Shakespeare/Base.hs 2024-08-05
08:03:42.000000000 +0200
+++ new/shakespeare-2.1.4/Text/Shakespeare/Base.hs 2025-06-05
17:35:51.000000000 +0200
@@ -29,7 +29,7 @@
import Language.Haskell.TH.Syntax hiding (makeRelativeToProject)
import Language.Haskell.TH (appE)
-import Data.Char (isUpper, isSymbol, isPunctuation, isAscii, isLower, isNumber)
+import Data.Char (isUpper, isSymbol, isPunctuation, isAscii)
import Data.FileEmbed (makeRelativeToProject)
import Text.ParserCombinators.Parsec
import Text.Parsec.Prim (Parsec)
@@ -41,8 +41,6 @@
import qualified System.IO as SIO
import qualified Data.Text.Lazy.IO as TIO
import Control.Monad (when)
-import Data.Maybe (mapMaybe)
-import Data.List.NonEmpty (nonEmpty, NonEmpty ((:|)))
newtype Ident = Ident String
deriving (Show, Eq, Read, Data, Typeable, Ord, Lift)
@@ -57,7 +55,6 @@
| DerefBranch Deref Deref
| DerefList [Deref]
| DerefTuple [Deref]
- | DerefType String
| DerefGetField Deref String
-- ^ Record field access via @OverloadedRecordDot@. 'derefToExp'
only supports this
-- feature on compilers which support @OverloadedRecordDot@.
@@ -96,7 +93,7 @@
-- See:
http://www.haskell.org/onlinereport/haskell2010/haskellch2.html#x7-160002.2
isOperatorChar c
- | isAscii c = c `elem` "!#$%&*+./<=>?\\^|-~:"
+ | isAscii c = c `elem` "!#$%&*+./<=>?@\\^|-~:"
| otherwise = isSymbol c || isPunctuation c
derefPrefix x = do
@@ -106,7 +103,7 @@
derefInfix x = try $ do
_ <- delim
xs <- many $ try $ derefSingle >>= \x' -> delim >> return x'
- op <- (many1 (satisfy isOperatorChar) <* lookAhead (oneOf " \t")) <?>
"operator"
+ op <- many1 (satisfy isOperatorChar) <?> "operator"
-- special handling for $, which we don't deal with
when (op == "$") $ fail "don't handle $"
let op' = DerefIdent $ Ident op
@@ -114,21 +111,9 @@
skipMany $ oneOf " \t"
return $ DerefBranch (DerefBranch op' $ foldl1 DerefBranch $ x : xs)
(foldl1 DerefBranch ys)
derefSingle = do
- x <- derefType <|> derefTuple <|> derefList <|> derefOp <|>
derefParens <|> numeric <|> fmap DerefString strLit <|> ident
+ x <- derefTuple <|> derefList <|> derefOp <|> derefParens <|> numeric
<|> strLit <|> ident
fields <- many recordDot
pure $ foldl DerefGetField x fields
- tyNameOrVar = liftA2 (:) (alphaNum <|> char '\'') (many (alphaNum <|> char
'_' <|> char '\''))
- derefType = try $ do
- _ <- char '@' >> notFollowedBy (oneOf " \t")
- x <-
- try tyNameOrVar
- <|> try (string "()")
- <|> try strLit
- <|> between
- (char '(')
- (char ')')
- (unwords <$> many ((try tyNameOrVar <|> try
strLitQuoted) <* many (oneOf " \t")))
- pure $ DerefType x
recordDot = do
_ <- char '.'
x <- lower <|> char '_'
@@ -154,8 +139,11 @@
Nothing -> DerefIntegral $ read' "Integral" $ n ++ x
Just z -> DerefRational $ toRational
(read' "Rational" $ n ++ x ++ '.' : z :: Double)
- strLitQuoted = liftA2 (:) (char '"') (many quotedChar) <> fmap pure (char
'"')
- strLit = char '"' *> many quotedChar <* char '"'
+ strLit = do
+ _ <- char '"'
+ chars <- many quotedChar
+ _ <- char '"'
+ return $ DerefString chars
quotedChar = (char '\\' >> escapedChar) <|> noneOf "\""
escapedChar =
let cecs = [('n', '\n'), ('r', '\r'), ('b', '\b'), ('t', '\t')
@@ -185,31 +173,8 @@
expType (Ident (c:_)) = if isUpper c || c == ':' then ConE else VarE
expType (Ident "") = error "Bad Ident"
-strType :: String -> Type
-strType t0 = case t0 of
- "" -> ConT ''()
- hd : tl
- | all isNumber t0 -> LitT (NumTyLit (read t0))
- | isLower hd -> VarT (mkName (hd : tl))
- | otherwise -> ConT (mkName (hd : tl))
-
-strTypeWords :: String -> Type
-strTypeWords t = case words t of
- [] -> ConT ''()
- [ty] -> strType ty
- ts@(ty : tys)
- | not (null ty)
- && head ty == '\"'
- && not (null (last ts))
- && last (last ts) == '\"' ->
- LitT (StrTyLit t)
- | otherwise -> foldl AppT (strType ty) (map strType tys)
-
derefToExp :: Scope -> Deref -> Exp
-derefToExp s (DerefBranch x y) = case y of
- DerefBranch (DerefType t) y' -> derefToExp s x `AppTypeE` strTypeWords t
`AppE` derefToExp s y'
- DerefType t -> derefToExp s x `AppTypeE` strTypeWords t
- _ -> derefToExp s x `AppE` derefToExp s y
+derefToExp s (DerefBranch x y) = derefToExp s x `AppE` derefToExp s y
derefToExp _ (DerefModulesIdent mods i@(Ident s)) =
expType i $ Name (mkOccName s) (NameQ $ mkModName $ intercalate "." mods)
derefToExp scope (DerefIdent i@(Ident s)) =
@@ -219,7 +184,6 @@
derefToExp _ (DerefIntegral i) = LitE $ IntegerL i
derefToExp _ (DerefRational r) = LitE $ RationalL r
derefToExp _ (DerefString s) = LitE $ StringL s
-derefToExp _ (DerefType _) = error "exposed type application"
derefToExp s (DerefList ds) = ListE $ map (derefToExp s) ds
derefToExp s (DerefTuple ds) = TupE $
#if MIN_VERSION_template_haskell(2,16,0)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/shakespeare-2.1.1/Text/Shakespeare/I18N.hs
new/shakespeare-2.1.4/Text/Shakespeare/I18N.hs
--- old/shakespeare-2.1.1/Text/Shakespeare/I18N.hs 2024-08-05
08:03:30.000000000 +0200
+++ new/shakespeare-2.1.4/Text/Shakespeare/I18N.hs 2025-06-05
17:35:51.000000000 +0200
@@ -3,6 +3,7 @@
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE ExistentialQuantification #-}
@@ -62,7 +63,6 @@
) where
import Language.Haskell.TH.Syntax hiding (makeRelativeToProject)
-import Control.Applicative ((<$>))
import Control.Monad (filterM, forM)
import Data.Text (Text, pack, unpack)
import System.Directory
@@ -72,12 +72,12 @@
import qualified Data.Map as Map
import qualified Data.ByteString as S
import Data.Text.Encoding (decodeUtf8)
-import Data.Char (isSpace, toLower, toUpper)
+import Data.Char (isSpace, toLower, toUpper, isLower)
import Data.Ord (comparing)
import Text.Shakespeare.Base (Deref (..), Ident (..), parseHash, derefToExp)
-import Text.ParserCombinators.Parsec (parse, many, eof, many1, noneOf, (<|>))
+import Text.ParserCombinators.Parsec (parse, many, eof, many1, noneOf, (<|>),
+ string, spaces, char, option, alphaNum, sepBy1, try)
import Control.Arrow ((***))
-import Data.Monoid (mempty, mappend)
import qualified Data.Text as T
import Data.String (IsString (fromString))
@@ -165,22 +165,79 @@
Nothing -> error $ "Did not find main language file: " ++ unpack
lang
Just def -> toSDefs def
mapM_ (checkDef sdef) $ map snd contents'
- let mname = mkName $ dt ++ postfix
- c1 <- fmap concat $ mapM (toClauses prefix dt) contents'
- c2 <- mapM (sToClause prefix dt) sdef
+ let mname = mkName $ dt2 ++ postfix
+ c1 <- fmap concat $ mapM (toClauses prefix dt2 ) contents'
+ c2 <- mapM (sToClause prefix dt2) sdef
c3 <- defClause
return $
( if genType
- then ((DataD [] mname [] Nothing (map (toCon dt) sdef) []) :)
+ then ((DataD [] mname [] Nothing (map (toCon dt2) sdef) []) :)
else id)
[ instanceD
- []
- (ConT ''RenderMessage `AppT` (ConT $ mkName master) `AppT` ConT
mname)
+ cxt -- Here the parsed context should be added, otherwise []
+ (ConT ''RenderMessage `AppT` (if ' ' `elem` master'
+ then let (ts, us) = break (== ' ') .
+ filter (\x -> x /= '(' && x /= ')') $ master'
+ us1 = filter (/= ' ') us in ParensT (ConT (mkName ts)
+ `AppT` VarT (mkName us1))
+ else ConT $ mkName master') `AppT` ConT mname)
[ FunD (mkName "renderMessage") $ c1 ++ c2 ++ [c3]
]
]
+ where (dt1, cxt0) = case (parse parseName "" dt) of
+ Left err -> error $ show err
+ Right x -> x
+ dt2 = concat . take 1 $ dt1
+ master' | cxt0 == [] = master
+ | otherwise = (\xss -> if length xss > 1
+ then '(':unwords xss ++ ")"
+ else concat . take 1 $ xss)
. fst $
+ (case parse parseName "" master of
+ Left err -> error $ show err
+ Right x -> x)
+ cxt = fmap (\(c:rest) -> foldl' (\acc v -> acc `AppT`
nameToType v)
+ (ConT $ mkName c) rest) cxt0
+
+ nameToType :: String -> Type -- Is taken from the
+--
https://hackage.haskell.org/package/yesod-core-1.6.26.0/docs/src/Yesod.Routes.Parse.html#nameToType
+ nameToType t = if isTvar t
+ then VarT $ mkName t
+ else ConT $ mkName t
+
+ isTvar :: String -> Bool -- Is taken from the
+--
https://hackage.haskell.org/package/yesod-core-1.6.26.0/docs/src/Yesod.Routes.Parse.html#isTvar
+ isTvar (h:_) = isLower h
+ isTvar _ = False
+
+ parseName = do
+ cxt' <- option [] parseContext
+ args <- many parseWord
+ spaces
+ eof
+ return (args, cxt')
+
+ parseWord = do
+ spaces
+ many1 alphaNum
+
+ parseContext = try $ do
+ cxts <- parseParen parseContexts
+ spaces
+ _ <- string "=>"
+ return cxts
+
+ parseParen p = do
+ spaces
+ _ <- try ( char '(' )
+ r <- p
+ spaces
+ _ <- try ( char ')' )
+ return r
+
+ parseContexts =
+ sepBy1 (many1 parseWord) (spaces >> char ',' >> return
())
-toClauses :: String -> String -> (Lang, [Def]) -> Q [Clause]
+toClauses :: String -> String -> (Lang, [Def]) -> Q [Clause]
toClauses prefix dt (lang, defs) =
mapM go defs
where
@@ -358,8 +415,7 @@
loadLangFile file = do
bs <- S.readFile file
let s = unpack $ decodeUtf8 bs
- defs <- fmap catMaybes $ mapM (parseDef . T.unpack . T.strip . T.pack) $
lines s
- return defs
+ fmap catMaybes $ mapM (parseDef . T.unpack . T.strip . T.pack) $ lines s
parseDef :: String -> IO (Maybe Def)
parseDef "" = return Nothing
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/shakespeare-2.1.1/shakespeare.cabal
new/shakespeare-2.1.4/shakespeare.cabal
--- old/shakespeare-2.1.1/shakespeare.cabal 2024-08-05 08:03:42.000000000
+0200
+++ new/shakespeare-2.1.4/shakespeare.cabal 2025-06-05 17:55:56.000000000
+0200
@@ -1,5 +1,5 @@
name: shakespeare
-version: 2.1.1
+version: 2.1.4
license: MIT
license-file: LICENSE
author: Michael Snoyman <[email protected]>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/shakespeare-2.1.1/test/Text/HamletSpec.hs
new/shakespeare-2.1.4/test/Text/HamletSpec.hs
--- old/shakespeare-2.1.1/test/Text/HamletSpec.hs 2024-08-05
08:03:30.000000000 +0200
+++ new/shakespeare-2.1.4/test/Text/HamletSpec.hs 2025-06-05
17:55:31.000000000 +0200
@@ -500,6 +500,25 @@
helper "<li ng-repeat=\"addr in
msgForm.new.split(/\\\\s/)\">{{addr}}</li>\n"
[hamlet|<li ng-repeat="addr in msgForm.new.split(/\\s/)">{{addr}}|]
+ it "Alpine.js multi-line attribute values #291" $
+ helper "<div x-data=\"{\r\n search: '',\r\n\r\n
items: ['foo', 'bar', 'baz'],\r\n\r\n
get filteredItems() {\r\n return
this.items.filter(\r\n i =>
i.startsWith(this.search)\r\n )\r\n
}\r\n }\"></div>"
+ [hamlet|
+ $newline never
+ <div
+ x-data="{
+ search: '',
+
+ items: ['foo', 'bar', 'baz'],
+
+ get filteredItems() {
+ return this.items.filter(
+ i => i.startsWith(this.search)
+ )
+ }
+ }"
+ >
+ |]
+
it "runtime Hamlet with caret interpolation" $ do
let toInclude render = render (5, [("hello", "world")])
let renderer x y = pack $ show (x :: Int, y :: [(Text, Text)])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/shakespeare-2.1.1/test/Text/Shakespeare/BaseSpec.hs
new/shakespeare-2.1.4/test/Text/Shakespeare/BaseSpec.hs
--- old/shakespeare-2.1.1/test/Text/Shakespeare/BaseSpec.hs 2024-08-05
08:03:42.000000000 +0200
+++ new/shakespeare-2.1.4/test/Text/Shakespeare/BaseSpec.hs 2025-06-05
17:35:51.000000000 +0200
@@ -33,31 +33,6 @@
(DerefBranch (DerefIdent (Ident "+")) (DerefIdent (Ident "a")))
(DerefIdent (Ident "b"))))
- it "parseDeref parse single type applications" $ do
- runParser parseDeref () "" "x @y" `shouldBe`
- Right
- (DerefBranch
- (DerefIdent (Ident "x"))
- (DerefType "y"))
- it "parseDeref parse unit type applications" $ do
- runParser parseDeref () "" "x @()" `shouldBe`
- Right
- (DerefBranch
- (DerefIdent (Ident "x"))
- (DerefType "()"))
- it "parseDeref parse compound type applications" $ do
- runParser parseDeref () "" "x @(Maybe String)" `shouldBe`
- Right
- (DerefBranch
- (DerefIdent (Ident "x"))
- (DerefType "Maybe String"))
- it "parseDeref parse single @ as operator" $ do
- runParser parseDeref () "" "x @ y" `shouldBe`
- Right
- (DerefBranch
- (DerefBranch (DerefIdent (Ident "@")) (DerefIdent (Ident "x")))
- (DerefIdent (Ident "y")))
-
it "parseDeref parse expressions with record dot" $ do
runParser parseDeref () "" "x.y" `shouldBe`
Right (DerefGetField (DerefIdent (Ident "x")) "y")
@@ -131,3 +106,4 @@
eShowErrors :: Either ParseError c -> c
eShowErrors = either (error . show) id
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/shakespeare-2.1.1/test/Text/Shakespeare/I18NSpec.hs
new/shakespeare-2.1.4/test/Text/Shakespeare/I18NSpec.hs
--- old/shakespeare-2.1.1/test/Text/Shakespeare/I18NSpec.hs 2024-08-05
08:03:30.000000000 +0200
+++ new/shakespeare-2.1.4/test/Text/Shakespeare/I18NSpec.hs 2025-06-05
17:35:51.000000000 +0200
@@ -1,16 +1,37 @@
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE TypeFamilies #-}
+
module Text.Shakespeare.I18NSpec
( spec
) where
import Data.Text (Text)
import Text.Shakespeare.I18N
+import Language.Haskell.TH.Syntax
+import Test.Hspec
+
+class Lift master => YesodSubApp master where
+ data YesodSubAppData master :: *
+
+newtype SubApp master = SubApp
+ {
+ getOrdering :: Ordering
+ }
+
+data Test = Test
+
+class Testable a where
+ isTestable :: a -> Bool
+
+instance Testable Test where
+ isTestable Test = True
spec :: Monad m => m ()
spec = return ()
-data Test = Test
+mkMessage "(YesodSubApp master) => SubApp master" "other-messages" "en"
mkMessage "Test" "test-messages" "en"
+