Copyright © 2008 Dave Bayer. Subject to a BSD-style license.
This module is part of the Annote project.
{-# OPTIONS_GHC -fth #-}
module Strings (header,date,footer,sheet,version) where
Strings provides the strings header, date, footer,
sheet, and version, defined as here documents.
HereDocs
provides a
here document
facility in Haskell using
Template Haskell,
which is invoked by the GHC option -fth.
import HereDocs (hereDocs)
hereDocs inserts Haskell code binding the variables
header, date, footer, style, and version
to the strings given by the corresponding here documents.
let [e] = [] in e is an idiom, generating a pattern-matching
exception containing the name
of the current file. One could instead simply write "Strings.hs".
$(hereDocs $ let [e] = [] in e)
The string version is generated by an external shell script, so we read
it explicitly from a separate file.
$(hereDocs $ "version.txt")
The following comments contains here documents.
Note the use of {-- and --} as comment delimiters, to insure that
these comments aren't interpreted by annote as documentation.
In source code not intended to be processed by annote, one could
simply use {- and -}.
headerheader begins an HTML document.
Annote will later replace {TITLE} with appropriate text.
{--
header = <<EOF
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>{TITLE}</title>
<link rel="StyleSheet" href="annote.css" type="text/css" />
</head>
<body>
EOF
--}
datedate gives a modification date for the file.
Annote will later replace {DATE} with appropriate text.
{--
date = <<EOF
<hr />
<p class="footer">
Last modified {DATE}
<br />
Produced by
<a href="http://www.math.columbia.edu/~bayer/Haskell/Annote">Annote</a>
<br />
<a href="http://validator.w3.org/check?uri=referer">Valid</a>
XHTML 1.0 Transitional
</p>
EOF
--}
footerfooter ends an HTML document.
{--
footer = <<EOF
</body>
</html>
EOF
--}
sheetsheet provides a CSS style sheet.
{--
sheet = <<EOF
body
{
background: #ffd;
color: black;
}
body, table
{
font-family: "Lucida Grande", Verdana, Arial, sans-serif;
font-style: normal;
font-weight: normal;
}
strong, code, samp, pre
{
font-size: 100%;
font-family: "Lucida Sans Typewriter", Courier, monospace;
font-style: normal;
font-weight: normal;
}
pre
{
padding-top: 0.6em;
padding-left: 0.8em;
padding-bottom: 0.8em;
line-height: 133%
}
p.footer
{
font-size: 80%;
font-style: italic;
}
pre.code
{
background: #dff;
border: 1px solid gray;
}
pre.code1
{
background: #eef;
border: 1px solid gray;
}
samp, code
{
color: #03f;
}
h1 code, h2 code, h3 code, h4 code, h5 code, h6 code
{
color: black;
font-weight: bold;
}
EOF
--}