summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authorThorsten Wißmann <re06huxa@stud.informatik.uni-erlangen.de>2012-02-18 03:25:41 +0100
committerThorsten Wißmann <re06huxa@stud.informatik.uni-erlangen.de>2012-02-18 03:26:30 +0100
commitbde33fbfe888f8bd8c280dc29e3ea61b04413f9d (patch)
tree8090cef310d45d3cf740b743ee748cd1627dce68 /www
parentd640ade208c6b1337e75a22fa07fc67ef4edadbd (diff)
www: generate header/footer manually
So it isn't generated by asciidoc anymore.
Diffstat (limited to 'www')
-rw-r--r--www/Makefile18
-rwxr-xr-xwww/compose.sh85
-rw-r--r--www/faq.txt4
-rw-r--r--www/index.txt3
-rw-r--r--www/news.txt2
5 files changed, 96 insertions, 16 deletions
diff --git a/www/Makefile b/www/Makefile
index a7536d6b..7e5d933c 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -6,26 +6,30 @@ include ../colors.mk
.PHONY: all clean install
TARGET = cip:wwwcip/herbstluftwm/
-ASCIIDOCFLAGS = -a linkcss -a stylesdir=./ --theme main
+ASCIIDOCFLAGS = -s
+TXT = $(wildcard *.txt)
-all: index.html faq.html news.html herbstluftwm.html herbstclient.html
+all: $(TXT:.txt=.html) herbstluftwm.html herbstclient.html
-%.html: %.txt header.txt footer.txt
+%-content.html: %.txt
$(call colorecho,DOC,$@)
- @$(ASCIIDOC) $(ASCIIDOCFLAGS) -o $@ $<
+ $(ASCIIDOC) $(ASCIIDOCFLAGS) -o $@ $<
+
+%.html: %-content.html compose.sh
+ ./compose.sh $< > $@
-herbstluftwm.html: ../doc/herbstluftwm.txt
+herbstluftwm-content.html: ../doc/herbstluftwm.txt
$(call colorecho,DOC,$@)
@$(ASCIIDOC) $(ASCIIDOCFLAGS) -o $@ $<
-herbstclient.html: ../doc/herbstclient.txt
+herbstclient-content.html: ../doc/herbstclient.txt
$(call colorecho,DOC,$@)
@$(ASCIIDOC) $(ASCIIDOCFLAGS) -o $@ $<
news.html: ../NEWS
clean:
- rm -f *.html
+ rm -f *.html *-content.html
install:
@echo scp index.html main.css $(TARGET)
diff --git a/www/compose.sh b/www/compose.sh
new file mode 100755
index 00000000..263fd5d8
--- /dev/null
+++ b/www/compose.sh
@@ -0,0 +1,85 @@
+#!/bin/bash
+
+# usage: $0 A
+# composes a content file A by adding a header and a footer
+
+file="$1"
+id="${file%-content.html}"
+
+prefix="herbstluftwm - "
+
+# titles that are shown in <title> and in <h1>
+declare -A id2title
+id2title=(
+ ["index"]="herbstluftwm"
+ ["news"]="${prefix}NEWS"
+ ["faq"]="${prefix}FAQ"
+ ["herbstluftwm"]="herbstluftwm(1)"
+ ["herbstclient"]="herbstclient(1)"
+)
+
+# how names are shown in the navigation bar
+declare -A id2name
+id2name=(
+ ["index"]="Main"
+ ["news"]="NEWS"
+ ["faq"]="FAQ"
+ ["herbstluftwm"]="herbstluftwm(1)"
+ ["herbstclient"]="herbstclient(1)"
+)
+
+navigationbar=( index news herbstluftwm herbstclient faq )
+
+title=${id2title[$id]}
+
+#====~===~=========~==
+# Header
+#====~===~=========~==
+cat <<EOF
+<html>
+ <head>
+ <link rel="stylesheet" href="main.css" type="text/css" />
+ <title>$title</title>
+ </head>
+ <body>
+ <div id="header">
+ <h1>$title</h1>
+ </div>
+ <div id="content">
+EOF
+
+#====~===~=========~==
+# Navigation bar
+#====~===~=========~==
+
+cat <<EOF
+ <div id="#navigationbar">
+EOF
+for i in "${navigationbar[@]}" ; do
+ name="${id2name[$i]:-$i}"
+ [ "$id" = "$i" ] && current='class="current" ' || current=''
+ cat <<EOF
+ <a ${current}href="$i.html">$name</a>
+EOF
+done
+cat <<EOF
+ </div>
+EOF
+
+#====~===~=========~==
+# Content
+#====~===~=========~==
+cat "$file"
+
+#====~===~=========~==
+# Footer
+#====~===~=========~==
+cat <<EOF
+ <div class="footer">
+ Generated on $(date +'%Y-%m-%d at %H:%M:%S %Z').
+ </div>
+ </div>
+ </body>
+</html>
+EOF
+
diff --git a/www/faq.txt b/www/faq.txt
index d08db9b8..f690da5a 100644
--- a/www/faq.txt
+++ b/www/faq.txt
@@ -1,5 +1,3 @@
-include::header.txt[]
-
Hints and FAQ
-------------
@@ -183,5 +181,3 @@ Q: I set default_frame_layout to my favorite layout but it doesn't work with the
workaround is to put +hc split vertical 0.5; hc remove+ at the end in your
autostartfile. You can also 'cycle_layout' in existing tags.
-
-include::footer.txt[]
diff --git a/www/index.txt b/www/index.txt
index 7008ac0d..5de6c6f3 100644
--- a/www/index.txt
+++ b/www/index.txt
@@ -1,5 +1,3 @@
-include::header.txt[]
-
What is it?
-----------
@@ -68,4 +66,3 @@ image:../screenshots/hlwm-panelicons-1-thumb.png["scr",link="../screenshots/hlwm
image:../screenshots/hlwm-pseudotile-1-thumb.png["scr",link="../screenshots/hlwm-pseudotile-1.png"]
// vim: nowrap
-include::footer.txt[]
diff --git a/www/news.txt b/www/news.txt
index 1fbf004e..850dbfd4 100644
--- a/www/news.txt
+++ b/www/news.txt
@@ -1,3 +1 @@
-include::header.txt[]
include::../NEWS[]
-include::footer.txt[]