Index menu generation

master
Mike Gerwitz 2013-05-25 11:09:26 -04:00
parent c4e460564b
commit 7011f93b73
3 changed files with 52 additions and 2 deletions

View File

@ -52,7 +52,7 @@ thoughts:
articles: $(articles) articles: $(articles)
www-root: articles thoughts www-root: articles thoughts
mkdir -p www-root/papers mkdir -p www-root/papers
( cd docs/ && find . -name '*.html' -exec cp {} ../www-root/{} \; ) ( cd docs/ && find . -name '*.html' -exec ../tools/doc-cp {} ../www-root/{} \; )
cp -r images/ www-root/ cp -r images/ www-root/
cp style.css www-root/ cp style.css www-root/
ln -sf ../images www-root/papers/images ln -sf ../images www-root/papers/images

View File

@ -14,7 +14,7 @@ header, footer,
text-align: left; text-align: left;
} }
h1, h2, h3 { h1, h2, h3, #menu {
font-family: 'URW Gothic L', 'Avant Garde', sans-serif; font-family: 'URW Gothic L', 'Avant Garde', sans-serif;
font-weight: normal; font-weight: normal;
} }
@ -48,6 +48,24 @@ h2.desc {
margin-bottom: 3em; margin-bottom: 3em;
} }
#menu {
text-align: center;
}
#menu li {
display: inline;
font-size: 1.4em;
letter-spacing: 0.05em;
}
#menu li a {
color: #666f63;
text-decoration: none;
border-left: 1px solid #868f83;
padding: 0.15em 1em;
}
#menu li:first-child a {
border-left: none;
}
p#ref-0 { p#ref-0 {
margin-top: 2em; margin-top: 2em;
} }

View File

@ -2,8 +2,40 @@
# #
# Basic template configuration; command-line options will override # Basic template configuration; command-line options will override
get-menu-docs()
{
paths=$(
find "$path_root/docs" -maxdepth 1 -name '*.htm?' -exec basename {} \; \
| sort
)
for p in $paths; do
# we shall consider the name of the link to be the path with the extension
# and sorting prefix stripped
name="$( basename "${p%%.htm?}" )"
echo "${name#??-}"
done
}
html_external_css=/style.css html_external_css=/style.css
# menu just below the header, above the index
html_pre_index="$(
echo '<ul id="menu">'
# generate menu from the root documents
for name in `get-menu-docs`; do
# each word in the name will be capitalized and the link shall not contain
# the file extension
words=( ${name//[_-]/ } )
printf '<li><a href="/%s">%s</a></li>' "$name" "${words[*]^}"
done
echo '</ul>'
)"
# additional content in the footer before the copyright (the awkward newline # additional content in the footer before the copyright (the awkward newline
# positions are to prevent spaces in the output) # positions are to prevent spaces in the output)
html_footer=$(cat <<EOM html_footer=$(cat <<EOM