Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package ghc-doctemplates for
openSUSE:Factory checked in at 2021-08-25 20:56:48
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-doctemplates (Old)
and /work/SRC/openSUSE:Factory/.ghc-doctemplates.new.1899 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-doctemplates"
Wed Aug 25 20:56:48 2021 rev:12 rq:912595 version:0.10
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-doctemplates/ghc-doctemplates.changes
2020-12-22 11:50:36.902059367 +0100
+++
/work/SRC/openSUSE:Factory/.ghc-doctemplates.new.1899/ghc-doctemplates.changes
2021-08-25 20:57:36.621208285 +0200
@@ -1,0 +2,17 @@
+Mon Jul 19 07:05:18 UTC 2021 - [email protected]
+
+- Update doctemplates to version 0.10.
+ ## 0.10
+
+ * Change rendering and conditional behavior with booleans.
+ Previously, `$if(foo)$` evaluated to false iff `foo`
+ would render as the empty string. This forced us to render
+ a boolean False value as an empty string, rather than `false`.
+ And this has caused various problems with templates
+ (#16, jgm/pandoc#7402). Now, boolean False values render as
+ `false` -- just as True values render as `true`. And conditionals
+ are now sensitive to booleans, so `$if(foo)$` evaluates to false
+ when `foo` is a boolean False value, even though it would render
+ as the nonempty string `false`.
+
+-------------------------------------------------------------------
Old:
----
doctemplates-0.9.tar.gz
New:
----
doctemplates-0.10.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-doctemplates.spec ++++++
--- /var/tmp/diff_new_pack.icYhpi/_old 2021-08-25 20:57:37.089207671 +0200
+++ /var/tmp/diff_new_pack.icYhpi/_new 2021-08-25 20:57:37.093207666 +0200
@@ -1,7 +1,7 @@
#
# spec file for package ghc-doctemplates
#
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
%global pkg_name doctemplates
%bcond_with tests
Name: ghc-%{pkg_name}
-Version: 0.9
+Version: 0.10
Release: 0
Summary: Pandoc-style document templates
License: BSD-3-Clause
++++++ doctemplates-0.9.tar.gz -> doctemplates-0.10.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/doctemplates-0.9/README.md
new/doctemplates-0.10/README.md
--- old/doctemplates-0.9/README.md 2020-12-16 08:22:53.000000000 +0100
+++ new/doctemplates-0.10/README.md 2021-06-23 08:23:30.000000000 +0200
@@ -126,9 +126,16 @@
matched delimiters) and ends with `endif` (enclosed in matched
delimiters). It may optionally contain an `else` (enclosed in
matched delimiters). The `if` section is used if
-`variable` has a non-empty value, otherwise the `else`
-section is used (if present). (Note that even the
-string `false` counts as a true value.) Examples:
+`variable` has a true value, otherwise the `else`
+section is used (if present). The following values
+count as true:
+
+- any map
+- any array containing at least one true value
+- any nonempty string (even `false`)
+- boolean True
+
+Examples:
```
$if(foo)$bar$endif$
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/doctemplates-0.9/changelog.md
new/doctemplates-0.10/changelog.md
--- old/doctemplates-0.9/changelog.md 2020-12-17 08:43:12.000000000 +0100
+++ new/doctemplates-0.10/changelog.md 2021-07-18 19:33:21.000000000 +0200
@@ -1,5 +1,18 @@
# doctemplates
+## 0.10
+
+ * Change rendering and conditional behavior with booleans.
+ Previously, `$if(foo)$` evaluated to false iff `foo`
+ would render as the empty string. This forced us to render
+ a boolean False value as an empty string, rather than `false`.
+ And this has caused various problems with templates
+ (#16, jgm/pandoc#7402). Now, boolean False values render as
+ `false` -- just as True values render as `true`. And conditionals
+ are now sensitive to booleans, so `$if(foo)$` evaluates to false
+ when `foo` is a boolean False value, even though it would render
+ as the nonempty string `false`.
+
## 0.9
* Add BoolVal constructor to Val. This gives a smoother
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/doctemplates-0.9/doctemplates.cabal
new/doctemplates-0.10/doctemplates.cabal
--- old/doctemplates-0.9/doctemplates.cabal 2020-12-16 08:26:27.000000000
+0100
+++ new/doctemplates-0.10/doctemplates.cabal 2021-07-18 19:33:26.000000000
+0200
@@ -1,5 +1,5 @@
name: doctemplates
-version: 0.9
+version: 0.10
synopsis: Pandoc-style document templates
description: This is the text templating system used by pandoc.
It supports variable interpolation, iteration,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/doctemplates-0.9/src/Text/DocTemplates/Internal.hs
new/doctemplates-0.10/src/Text/DocTemplates/Internal.hs
--- old/doctemplates-0.9/src/Text/DocTemplates/Internal.hs 2020-12-16
16:49:38.000000000 +0100
+++ new/doctemplates-0.10/src/Text/DocTemplates/Internal.hs 2021-06-23
08:17:37.000000000 +0200
@@ -396,20 +396,34 @@
Just v' -> multiLookup vs v'
multiLookup _ _ = NullVal
-resolveVariable :: TemplateTarget a => Variable -> Context a -> [Doc a]
+-- The Bool indicates whether it's a true or false value.
+data Resolved a = Resolved Bool [Doc a]
+ deriving (Show, Read, Data, Typeable, Generic, Eq, Ord,
+ Foldable, Traversable, Functor)
+
+instance Semigroup (Resolved a) where
+ Resolved b1 x1 <> Resolved b2 x2 = Resolved (b1 || b2) (x1 <> x2)
+
+instance Monoid (Resolved a) where
+ mappend = (<>)
+ mempty = Resolved False []
+
+resolveVariable :: TemplateTarget a
+ => Variable -> Context a -> Resolved a
resolveVariable v ctx = resolveVariable' v (MapVal ctx)
-resolveVariable' :: TemplateTarget a => Variable -> Val a -> [Doc a]
+resolveVariable' :: TemplateTarget a
+ => Variable -> Val a -> Resolved a
resolveVariable' v val =
case applyPipes (varPipes v) $ multiLookup (varParts v) val of
- ListVal xs -> concatMap (resolveVariable' mempty) xs
+ ListVal xs -> mconcat $ map (resolveVariable' mempty) xs
SimpleVal d
- | DL.isEmpty d -> []
- | otherwise -> [removeFinalNl d]
- MapVal _ -> ["true"]
- BoolVal True -> ["true"]
- BoolVal False -> []
- NullVal -> []
+ | DL.isEmpty d -> Resolved False []
+ | otherwise -> Resolved True [removeFinalNl d]
+ MapVal _ -> Resolved True ["true"]
+ BoolVal True -> Resolved True ["true"]
+ BoolVal False -> Resolved False ["false"]
+ NullVal -> Resolved False []
removeFinalNl :: Doc a -> Doc a
removeFinalNl DL.NewLine = mempty
@@ -455,11 +469,12 @@
=> Template a -> Context a -> RenderState (Doc a)
renderTemp (Literal t) _ = updateColumn t
renderTemp (Interpolate v) ctx =
- updateColumn $ mconcat $ resolveVariable v ctx
+ case resolveVariable v ctx of
+ Resolved _ xs -> updateColumn (mconcat xs)
renderTemp (Conditional v ift elset) ctx =
case resolveVariable v ctx of
- [] -> renderTemp elset ctx
- _ -> renderTemp ift ctx
+ Resolved False _ -> renderTemp elset ctx
+ Resolved True _ -> renderTemp ift ctx
renderTemp (Iterate v t sep) ctx = do
xs <- withVariable v ctx (renderTemp t)
sep' <- renderTemp sep ctx
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/doctemplates-0.9/src/Text/DocTemplates.hs
new/doctemplates-0.10/src/Text/DocTemplates.hs
--- old/doctemplates-0.9/src/Text/DocTemplates.hs 2020-11-19
20:59:05.000000000 +0100
+++ new/doctemplates-0.10/src/Text/DocTemplates.hs 2021-06-23
08:28:51.000000000 +0200
@@ -104,6 +104,8 @@
verbatim. (Note that no escaping is done; the assumption is that the
calling program will escape the strings appropriately for the output
format.)
+- If the value of the variable is a boolean value, it will be rendered
+ as @true@ if true, or as empty if false.
- If the value is a list, the values will be concatenated.
- If the value is a map, the string @true@ will be rendered.
- Every other value will be rendered as the empty string.
@@ -113,17 +115,21 @@
- If the value is a number, it will be rendered as an integer if
possible, otherwise as a floating-point number.
-- If the value is a JSON boolean, it will be rendered as @true@ if
- true, and as the empty string if false.
== Conditionals
A conditional begins with @if(variable)@ (enclosed in matched
delimiters) and ends with @endif@ (enclosed in matched delimiters). It
may optionally contain an @else@ (enclosed in matched delimiters). The
-@if@ section is used if @variable@ has a non-empty value, otherwise the
-@else@ section is used (if present). (Note that even the string @false@
-counts as a true value.) Examples:
+@if@ section is used if @variable@ has a true value, otherwise the
+@else@ section is used (if present). The following values count as true:
+
+- any map
+- any array containing at least one true value
+- any nonempty string (even @false@)
+- boolean True
+
+Examples:
> $if(foo)$bar$endif$
>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/doctemplates-0.9/test/boolean.test
new/doctemplates-0.10/test/boolean.test
--- old/doctemplates-0.9/test/boolean.test 2020-12-16 08:25:29.000000000
+0100
+++ new/doctemplates-0.10/test/boolean.test 2021-06-23 08:19:23.000000000
+0200
@@ -8,6 +8,6 @@
$if(bar)$XXX$else$YYY$endif$
.
true
-
+false
XXX
YYY