diff --git a/Makefile b/Makefile
index b27b287..0572da0 100644
--- a/Makefile
+++ b/Makefile
@@ -16,18 +16,11 @@ MAKEPAGES := $(TMPDIR)/make-pages
YAMLS != find -L $(DATADIR) -name $(INFONAME)
-TSCRIPTS != find script -name '*.ts'
-STYLES != find style -name '*.css'
-STYLESVGS != find style -name '*.svg'
-STYLEPNGS != find style -name '*.png'
+TSCRIPTS != find script -name '*.ts'
+STYLES != find style -type f
+FONTS != find fonts -type f
-
-FONTS != find fonts \
- -iname '*.eot' -or -iname '*.svg' -or \
- -iname '*.ttf' -or -iname '*.woff' -or \
- -iname '*.woff2' -or -iname '*.css'
-
-STATIC = $(STYLES) $(STYLEPNGS) $(STYLESVGS) $(FONTS)
+STATIC = $(STYLES) $(FONTS)
BSTATIC = $(patsubst %,$(BUILDDIR)/%,$(STATIC))
BSCRIPTS = $(patsubst %.ts,$(BUILDDIR)/%.js,$(TSCRIPTS))
diff --git a/make-pages/BuilderQQ.hs b/make-pages/BuilderQQ.hs
index c7cee73..de08612 100644
--- a/make-pages/BuilderQQ.hs
+++ b/make-pages/BuilderQQ.hs
@@ -18,9 +18,15 @@ import Data.List.NonEmpty (NonEmpty, toList)
data Chunk = Lit String | Var String
+
+-- |
+-- * use @$var@ to insert a variable (instance of 'CanBuild')
+-- * use @$&@ to insert nothing like @\&@ in a string (e.g. to add whitespace
+-- at the start or end, or to have a variable followed by a letter
+-- * use @$$@ for a literal @$@
parseB :: String -> ExpQ
parseB = toExpQ . reverse . go "" [] . trim where
- trim = dropWhileEnd isSpace . dropWhile (== '\n')
+ trim = dropWhileEnd isSpace . dropWhile isSpace
go acc cs [] = addLit acc cs
go acc cs ('$':'&':rest) = go acc cs rest -- $&: expands to nothing
go acc cs ('$':'$':rest) = go ('$' : acc) cs rest -- $$: expands to one $
@@ -58,7 +64,8 @@ escId = foldMap esc1 . Strict.unpack where
escAttr :: Strict.Text -> Builder
escAttr = foldMap esc1 . Strict.unpack where
esc1 c = fromMaybe (singleton c) $ lookup c
- [('<', "<"), ('>', ">"), ('"', """), ('\'', "'")]
+ [('<', "<"), ('>', ">"), ('"', """), ('\'', "'"),
+ ('&', "&")]
class CanBuild a where build :: a -> Builder
diff --git a/make-pages/GalleryPage.hs b/make-pages/GalleryPage.hs
index ae2a1bd..99c69ca 100644
--- a/make-pages/GalleryPage.hs
+++ b/make-pages/GalleryPage.hs
@@ -80,9 +80,7 @@ make' root (GalleryInfo {title, desc, prefix, filters, hidden}) infos = [b|
-
- $items
-
+ $items
|]
@@ -129,16 +127,17 @@ makeFilter prefix initial tag count = [b|
where
id' = [b|$prefix$&_$tag'|]
tag' = escId tag
- checked = if HashSet.member tag initial then [b| checked|] else ""
- hidden = if count <= 1 then [b| hidden|] else ""
+ checked = if HashSet.member tag initial then [b|$& checked|] else ""
+ hidden = if count <= 1 then [b|$& hidden|] else ""
makeYearItems :: Bool -- ^ nsfw
-> Int -- ^ year
-> [(FilePath, Info)]
-> Builder
makeYearItems nsfw year infos = [b|
-
- $year'
+
+ $year'
+
$items
|]
where
@@ -147,24 +146,25 @@ makeYearItems nsfw year infos = [b|
makeItem :: Bool -> FilePath -> Info -> Builder
makeItem nsfw file info@(Info {bg}) = [b|
-
+ alt="$title" title="$tooltip">
+
|]
where
- title = fromMaybe info.title $ info.galleryTitle
+ title = escAttr $ fromMaybe info.title info.galleryTitle
dir = takeDirectory file
thumbnail = getThumb dir info
- nsfw' = if nsfw && anyNsfw info then [b| nsfw|] else ""
+ nsfw' = if nsfw && anyNsfw info then [b|$& nsfw|] else ""
tags' = fold $ intersperse ";" $ map fromText $ tagsFor nsfw info
date = latestDateFor nsfw info
date' = formatTooltip date
year' = date.year
updated' = if hasUpdatesFor nsfw info then [b|true|] else [b|false|]
- bgStyle = case bg of Other col -> [b| style="background: $col"|]; _ -> ""
+ bgStyle = case bg of Other col -> [b|$& style="background: $col"|]; _ -> ""
tooltip = [b|$title ($upd$date')|]
where upd = if hasUpdatesFor nsfw info then "updated " else "" :: Builder
diff --git a/make-pages/IndexPage.hs b/make-pages/IndexPage.hs
index 3efce99..1b1600d 100644
--- a/make-pages/IndexPage.hs
+++ b/make-pages/IndexPage.hs
@@ -74,13 +74,13 @@ makeItem :: GalleryInfo -> Builder
makeItem (GalleryInfo {title, desc, prefix, filters}) = [b|