Use separate variables for meta-date, meta-author.

This makes footnotes work in author and date fields.
Closes #301.
This commit is contained in:
John MacFarlane 2011-11-29 13:31:12 -08:00
parent 05a26aef3a
commit 6eb6a99013
2 changed files with 9 additions and 8 deletions

View file

@ -160,16 +160,16 @@ inTemplate :: TemplateTarget a
-> [(String,String)] -> [(String,String)]
-> a -> a
inTemplate opts tit auths date toc body' newvars = inTemplate opts tit auths date toc body' newvars =
let renderedTit = showHtmlFragment tit let title' = dropWhile (=='\n') $ showHtmlFragment tit
topTitle' = stripTags renderedTit authors = map showHtmlFragment auths
authors = map (stripTags . showHtmlFragment) auths date' = showHtmlFragment date
date' = stripTags $ showHtmlFragment date
variables = writerVariables opts ++ newvars variables = writerVariables opts ++ newvars
context = variables ++ context = variables ++
[ ("body", dropWhile (=='\n') $ showHtmlFragment body') [ ("body", dropWhile (=='\n') $ showHtmlFragment body')
, ("pagetitle", topTitle') , ("pagetitle", stripTags title')
, ("title", dropWhile (=='\n') $ showHtmlFragment tit) , ("title", title')
, ("date", date') , ("date", date')
, ("date-meta", stripTags date')
, ("idprefix", writerIdentifierPrefix opts) , ("idprefix", writerIdentifierPrefix opts)
, ("slidy-url", "http://www.w3.org/Talks/Tools/Slidy2") , ("slidy-url", "http://www.w3.org/Talks/Tools/Slidy2")
, ("s5-url", "s5/default") ] ++ , ("s5-url", "s5/default") ] ++
@ -177,7 +177,8 @@ inTemplate opts tit auths date toc body' newvars =
(case toc of (case toc of
Just t -> [ ("toc", showHtmlFragment t)] Just t -> [ ("toc", showHtmlFragment t)]
Nothing -> []) ++ Nothing -> []) ++
[ ("author", a) | a <- authors ] [ ("author", a) | a <- authors ] ++
[ ("author-meta", stripTags a) | a <- authors ]
in renderTemplate context $ writerTemplate opts in renderTemplate context $ writerTemplate opts
-- | Like Text.XHtml's identifier, but adds the writerIdentifierPrefix -- | Like Text.XHtml's identifier, but adds the writerIdentifierPrefix

@ -1 +1 @@
Subproject commit 6c48030dcd70359e5f9c2eeef8cb01873ac033a6 Subproject commit 5facbc552da097dd150112457866a7785cfb21d4