Now that we have conditional static templating, get rid of redundant templating variables (allTaggedPage + latestTaggedPage)

This commit is contained in:
Tissevert 2020-05-07 16:35:24 +02:00
parent 049576154a
commit e136b97746
4 changed files with 8 additions and 20 deletions

View file

@ -1,12 +1,10 @@
allLink = See all
allPage = All articles
allTaggedPage = All articles tagged ${tag}
allPage = All articles{? tagged ${tag}?}
commentsLink = Comment on the fediverse
commentsSection = Comments
dateFormat = en-US
latestLink = See only latest
latestPage = Latest articles
latestTaggedPage = Latest articles tagged ${tag}
latestPage = Latest articles{? tagged ${tag}?}
metadata = {?by ${author} ?}on ${date}{? tagged ${tags}?}
rssLink = Subscribe
rssTitle = Follow all articles{? tagged ${tag}?}

View file

@ -66,12 +66,7 @@ function DomRenderer(modules) {
}
function pageTitle(tag, all) {
if(tag != undefined) {
var template = all ? 'allTaggedPage' : 'latestTaggedPage';
return modules.template.render(template, {tag: tag});
} else {
return blog.wording[all ? 'allPage' : 'latestPage'];
}
return modules.template.render(all ? 'allPage' : 'latestPage', {tag: tag});
}
function otherUrl(tag, all) {

View file

@ -34,13 +34,10 @@ otherURL (ArticlesList {full, collection}) = absoluteLink $
description :: Renderer m => ArticlesList -> m Text
description (ArticlesList {full, collection}) =
getDescription (full, tag collection)
template page . environment $ tag collection
where
getDescription (True, Nothing) = template "allPage" []
getDescription (True, Just tag) = template "allTaggedPage" [("tag", pack tag)]
getDescription (False, Nothing) = template "latestPage" []
getDescription (False, Just tag) =
template "latestTaggedPage" [("tag", pack tag)]
page = if full then "allPage" else "latestPage"
environment = maybe [] $ \value -> [("tag", pack value)]
rssLinkTexts :: Renderer m => ArticlesList -> m (Text, Text)
rssLinkTexts (ArticlesList {collection}) = do

View file

@ -25,14 +25,12 @@ newtype Wording = Wording (Map String Text)
variables :: Map String [Text]
variables = Map.fromList [
("allLink", [])
, ("allPage", [])
, ("allTaggedPage", ["tag"])
, ("allPage", ["tag"])
, ("commentsLink", [])
, ("commentsSection", [])
, ("dateFormat", [])
, ("latestLink", [])
, ("latestPage", [])
, ("latestTaggedPage", ["tag"])
, ("latestPage", ["tag"])
, ("metadata", ["author", "date", "tags"])
, ("rssLink", [])
, ("rssTitle", ["tag"])