separated styles from header template
This commit is contained in:
parent
3029f0e430
commit
90bd9921be
7
bin/web
7
bin/web
|
@ -24,6 +24,7 @@ entry_index () {
|
|||
entry_html="${html_dir}${loghtml}.html"
|
||||
mkdir -p "${html_dir}${logdir}"
|
||||
cat "$web_header_html" > "${entry_html}"
|
||||
cat "$web_styles_html" >> "${entry_html}"
|
||||
{
|
||||
printf " <title>%s</title>\\n" "$title"
|
||||
printf " <link rel=\"canonical\" href=\"https://cosmic.voyage%s.html\">\\n" "$loghtml"
|
||||
|
@ -43,6 +44,7 @@ if [ "$run_user" -eq 0 ]; then
|
|||
root_index_html="/var/www/html/index.html"
|
||||
log_html="/var/www/html/log/index.html"
|
||||
web_header_html="/etc/templates/webheader.tmpl"
|
||||
web_styles_html="/etc/templates/webstyles.tmpl"
|
||||
ships_html="/var/www/html/ships/index.html"
|
||||
error_html="/var/www/html/error.html"
|
||||
html_dir="/var/www/html"
|
||||
|
@ -61,6 +63,7 @@ if [ "$run_user" -eq 0 ]; then
|
|||
|
||||
# Add standard header
|
||||
cat "$web_header_html" > "${root_index_html}"
|
||||
cat "$web_styles_html" >> "${root_index_html}"
|
||||
|
||||
# Custom header elements and body start
|
||||
{
|
||||
|
@ -88,6 +91,7 @@ if [ "$run_user" -eq 0 ]; then
|
|||
local_log_html="/var/www/html/log/index-${i}.html"
|
||||
fi
|
||||
cat "$web_header_html" > "${local_log_html}"
|
||||
cat "$web_styles_html" >> "${local_log_html}"
|
||||
# Custom header elements and body start
|
||||
{
|
||||
printf "<title>Cosmic Voyage - Transmission Log</title>"
|
||||
|
@ -150,6 +154,7 @@ if [ "$run_user" -eq 0 ]; then
|
|||
mkdir -p "${html_dir}/ships"
|
||||
# Add header info to html output
|
||||
cat "$web_header_html" > "${ships_html}"
|
||||
cat "$web_styles_html" >> "${ships_html}"
|
||||
# Custom header elements and body start
|
||||
{
|
||||
printf "<title>Cosmic Voyage - Ships</title>"
|
||||
|
@ -176,6 +181,7 @@ if [ "$run_user" -eq 0 ]; then
|
|||
mkdir -p "${html_dir}/ships/${ship}"
|
||||
# Add header info to html output
|
||||
cat "$web_header_html" > "${ship_html}"
|
||||
cat "$web_styles_html" >> "${ship_html}"
|
||||
# Custom header elements and body start
|
||||
{
|
||||
printf "<title>Cosmic Voyage - %s</title>" "$ship"
|
||||
|
@ -206,6 +212,7 @@ if [ "$run_user" -eq 0 ]; then
|
|||
|
||||
# Print error page
|
||||
cat "$web_header_html" > "${error_html}"
|
||||
cat "$web_styles_html" >> "${error_html}"
|
||||
{
|
||||
printf "</head><body><div class=\"page-wrapper\"><pre class=\"inner-wrapper\"><a href=\"/\"><< BACK TO RELAY ONE</a>"
|
||||
printf "\\n\\n\\nERROR. TRANSMISSION NOT FOUND.</pre></div></body></html>"
|
||||
|
|
|
@ -6,47 +6,3 @@
|
|||
<meta name=viewport content="shrink-to-fit=no,width=device-width,height=device-height,initial-scale=1,user-scalable=1">
|
||||
<meta name=msapplication-TileColor content=#ffffff>
|
||||
<meta name=theme-color content=#ffffff>
|
||||
<link href="https://fonts.googleapis.com/css?family=Inconsolata" rel="stylesheet">
|
||||
<style>
|
||||
body, html {
|
||||
color: rgb(50, 200, 100);
|
||||
background-color: #010;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
a, a:visited, a:hover, a:active {
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
color: rgb(62, 231, 123);
|
||||
}
|
||||
|
||||
.page-wrapper {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.inner-wrapper {
|
||||
display: inline-block;
|
||||
text-align: left;
|
||||
white-space: pre;
|
||||
font-family: 'Inconsolata', monospace;
|
||||
margin: 0 auto;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
ol {
|
||||
padding: 0;
|
||||
line-height: 0.5em;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 700px) {
|
||||
body, html {
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
@media screen and (min-width: 900px) {
|
||||
body, html {
|
||||
font-size: 24px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
56
web/Makefile
56
web/Makefile
|
@ -2,6 +2,7 @@
|
|||
SRC_DIR ?= /var/gopher
|
||||
DST_DIR ?= /var/www/html2
|
||||
WEB_HEAD ?= /etc/templates/webheader.tmpl
|
||||
WEB_STYLE ?= /etc/templates/webstyles.tmpl
|
||||
|
||||
ifeq ($(VERBOSE),1)
|
||||
MUTE :=
|
||||
|
@ -23,6 +24,7 @@ DST_HTML_FILES := $(SRC_TXT_FILES:$(SRC_DIR)/%.txt=$(DST_DIR)/%.html)
|
|||
copy = cp $< $@
|
||||
mkdir = $(MUTE)mkdir -p $(dir $@)
|
||||
addhead = $(MUTE)cat $(WEB_HEAD) > $@
|
||||
addstyle= $(MUTE)cat $(WEB_STYLE) >> $@
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
|
@ -34,6 +36,7 @@ clean:
|
|||
$(DST_DIR)/error.html:
|
||||
$(mkdir)
|
||||
$(addhead)
|
||||
$(addstyle)
|
||||
$(MUTE){ \
|
||||
printf "</head><body><div class=\"page-wrapper\"><pre class=\"inner-wrapper\"><a href=\"/\"><< BACK TO RELAY ONE</a>"; \
|
||||
printf "\\n\\n\\nERROR. TRANSMISSION NOT FOUND.</pre></div></body></html>"; \
|
||||
|
@ -47,7 +50,12 @@ $(DST_DIR)/%.html: $(SRC_DIR)/%.txt
|
|||
log_title=$$(grep "$$short_path" "$(LISTING_FILE)" | head -1 | sed 's|^0||' | awk -F "\t" '{print $$1}'); \
|
||||
printf "<title>%s</title>\\n" "$$log_title"; \
|
||||
printf "<link rel=\"canonical\" href=\"https://cosmic.voyage%s.html\">\\n" "$$short_path"; \
|
||||
printf "</head>\\n<body>\\n<div class=\"page-wrapper\"><pre class=\"inner-wrapper\">\\n"; \
|
||||
} >> $@
|
||||
$(addstyle)
|
||||
$(MUTE){\
|
||||
printf "</head>\\n"; \
|
||||
printf "<body>\\n"; \
|
||||
printf "<div class=\"page-wrapper\"><pre class=\"inner-wrapper\">\\n"; \
|
||||
printf "<a href=\"/log\"><< BACK TO RELAY ONE LOG</a>\\n\\n\\n"; \
|
||||
sed 's/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g; s/'"'"'/\'/g' "$<"; \
|
||||
printf "</pre></div></body></html>"; \
|
||||
|
@ -57,45 +65,43 @@ $(DST_DIR)/log/index.html: $(LISTING_FILE)
|
|||
$(mkdir)
|
||||
$(addhead)
|
||||
$(MUTE){\
|
||||
printf "<title>Cosmic Voyage - Transmission Log</title>"; \
|
||||
printf "<link rel=\"canonical\" href=\"https://cosmic.voyage/log\">"; \
|
||||
printf "</head>"; \
|
||||
printf "<body>"; \
|
||||
printf "<div class=\"page-wrapper\">"; \
|
||||
printf "<pre class=\"inner-wrapper\">"; \
|
||||
printf "<a href=\"/\"><< BACK TO RELAY ONE</a>\\n\\n"; \
|
||||
cat "$(SRC_DIR)/log/intro.gophermap"; \
|
||||
printf "<title>Cosmic Voyage - Transmission Log</title>\\n"; \
|
||||
printf "<link rel=\"canonical\" href=\"https://cosmic.voyage/log\">\\n"; \
|
||||
} >> $@
|
||||
$(MUTE)printf "$(LISTING_LIST)" >> $@
|
||||
$(addstyle)
|
||||
$(MUTE){\
|
||||
printf "</pre>\\n"; \
|
||||
printf "</div>\\n"; \
|
||||
printf "</body>\\n"; \
|
||||
printf "</html>"; \
|
||||
printf "</head>\\n"; \
|
||||
printf "<body>\\n"; \
|
||||
printf "<div class=\"page-wrapper\">\\n"; \
|
||||
printf "<pre class=\"inner-wrapper\">\\n"; \
|
||||
printf "<a href=\"/\"><< BACK TO RELAY ONE</a>\\n\\n"; \
|
||||
} >> $@
|
||||
$(MUTE)cat "$(SRC_DIR)/log/intro.gophermap" >> $@
|
||||
$(MUTE)printf "$(LISTING_LIST)" >> $@
|
||||
$(MUTE)printf "</pre></div></body></html>" >> $@
|
||||
|
||||
$(DST_DIR)/index.html: $(LISTING_FILE)
|
||||
$(mkdir)
|
||||
$(addhead)
|
||||
$(MUTE){\
|
||||
printf "<title>Cosmic Voyage</title>"; \
|
||||
printf "<link rel=\"canonical\" href=\"https://cosmic.voyage\">"; \
|
||||
printf "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"Cosmic Voyage\" href=\"/rss.xml\">"; \
|
||||
printf "<meta name=\"description\" content=\"Cosmic Voyage is a public-access unix system and 'tilde' community based around a collaborative science-fiction universe. Users write stories as the people aboard ships, colonies, and outposts, using the only remaining free, interconnected network that unites the dispersed peoples of the stars.\">"; \
|
||||
printf "<title>Cosmic Voyage</title>\\n"; \
|
||||
printf "<link rel=\"canonical\" href=\"https://cosmic.voyage\">\\n"; \
|
||||
printf "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"Cosmic Voyage\" href=\"/rss.xml\">\\n"; \
|
||||
printf "<meta name=\"description\" content=\"Cosmic Voyage is a public-access unix system and 'tilde' community based around a collaborative science-fiction universe. Users write stories as the people aboard ships, colonies, and outposts, using the only remaining free, interconnected network that unites the dispersed peoples of the stars.\">\\n"; \
|
||||
} >> $@
|
||||
$(addstyle)
|
||||
$(MUTE){\
|
||||
printf "</head>"; \
|
||||
printf "<body>"; \
|
||||
printf "<div class=\"page-wrapper\">"; \
|
||||
printf "<pre class=\"inner-wrapper\">"; \
|
||||
cat "$(SRC_DIR)/intro.gophermap"; \
|
||||
} >> $@
|
||||
$(MUTE)cat "$(SRC_DIR)/intro.gophermap" >> $@
|
||||
$(MUTE){\
|
||||
printf "\\n<a href=\"/log\">>> Complete Transmission Log</a>\\n"; \
|
||||
printf "<a href=\"/ships\">>> Ships, Colonies, Outposts</a>\\n"; \
|
||||
printf "<a href=\"/rss.xml\">>> RSS Feed</a>\\n\\n"; \
|
||||
printf "Most recent log entries:\\n"; \
|
||||
} >> $@
|
||||
$(MUTE)printf "$(LISTING_LIST)" | head -n 20 >> $@
|
||||
$(MUTE){\
|
||||
printf "</pre>\\n"; \
|
||||
printf "</div>\\n"; \
|
||||
printf "</body>\\n"; \
|
||||
printf "</html>"; \
|
||||
} >> $@
|
||||
$(MUTE)printf "</pre></div></body></html>" >> $@
|
||||
|
|
Loading…
Reference in New Issue