Build html version of tips.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Wed, 20 Jul 2011 12:37:29 +0300
changeset 902 034aeeb2a16d
parent 901 e8d1390c77b3
child 903 9ead7d97be34
Build html version of tips.
.hgignore
Makefile
index-frame.html
index.sh
rst.css
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Wed Jul 20 12:37:29 2011 +0300
@@ -0,0 +1,2 @@
+syntax: glob
+tips-html/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile	Wed Jul 20 12:37:29 2011 +0300
@@ -0,0 +1,62 @@
+
+SHELL = /bin/sh
+
+# Disable built in pattern rules.
+MAKEFLAGS += -r
+# Disable built in variables.
+MAKEFLAGS += -R
+# Disable built in suffix rules.
+.SUFFIXES:
+# Default target.
+.DEFAULT_GOAL = all
+
+################################################################
+# Proj dirs/files.
+
+RST_FILES := $(wildcard *.rst)
+TXT_FILES := $(wildcard *.txt)
+
+HTML_DIR := tips-html
+HTML_FILES := $(patsubst %.rst,$(HTML_DIR)/%.html,$(RST_FILES)) $(HTML_DIR)/index.html $(HTML_DIR)/index-frame.html
+TXT__FILES := $(addprefix $(HTML_DIR)/,$(TXT_FILES))
+
+DIRS := $(HTML_DIR)
+
+################################################################
+# Build targets.
+
+.PHONY: all
+all:
+
+.PHONY: html
+html: $(HTML_FILES) $(TXT__FILES)
+
+$(HTML_DIR)/%.html: %.rst | $(HTML_DIR)
+	rst2html.py --stylesheet=rst.css $*.rst $@
+
+$(HTML_DIR)/index.html: index.sh | $(HTML_DIR)
+	./index.sh >$@
+
+$(HTML_DIR)/%.html: %.html | $(HTML_DIR)
+	cp $< $@
+
+$(HTML_DIR)/%.txt: %.txt | $(HTML_DIR)
+	cp $< $@
+
+################################################################
+# Init targets.
+
+$(DIRS):
+	mkdir -p $@
+
+################################################################
+# Clean targets.
+
+.PHONY: distclean
+distclean: clean
+
+.PHONY: clean
+clean:
+	rm -r -f $(DIRS)
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/index-frame.html	Wed Jul 20 12:37:29 2011 +0300
@@ -0,0 +1,10 @@
+<html>
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+    <title>tips index</title>
+</head>
+<frameset cols="220,*">
+    <frame src="index.html" name="toc">
+    <frame src="index.html" name="article">
+</frameset>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/index.sh	Wed Jul 20 12:37:29 2011 +0300
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+echo '<html>'
+echo '<head>'
+echo '  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">'
+echo '  <title>Tips</title>'
+echo '  <style type="text/css">'
+echo '    body { background-color: linen; }'
+echo '    a { text-decoration:none; }'
+echo '    a:link { color: brown; }'
+echo '    a:visited { color: IndianRed; }'
+echo '    a:hover { background: beige; border-radius: 10px; padding: 1px; }'
+echo '  </style>'
+echo '</head>'
+echo '<body>'
+echo '<h1>Tips</h1>'
+echo '<ul>'
+
+for file in *.rst *.txt; do
+  ext=${file##*.}
+  name=${file%.${ext}}
+  case $ext in
+    txt)
+      printf '  <li><a href="%s.txt" target="article">%s</a>\n' $name $name
+      ;;
+    rst)
+      printf '  <li><a href="%s.html" target="article">%s</a>\n' $name $name
+      ;;
+  esac
+done
+
+echo '<p>'
+echo '<address>'
+echo '    <a href="mailto:gavenkoa@gmail.com">Oleksandr Gavenko</a>'
+echo '</address>'
+echo '</body>'
+echo '</html>'
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rst.css	Wed Jul 20 12:37:29 2011 +0300
@@ -0,0 +1,9 @@
+body frameset { background-color: ivory; }
+body { padding: 0 10% 0 10%; }
+a { text-decoration:none; }
+a:link { color: brown; }
+a:visited { color: IndianRed; }
+a:hover { background: beige; border-radius: 10px; padding: 1px; }
+p { text-indent: 2em; }
+p:first-letter { font-weight: bold; }
+.literal-block {padding-left: 4em;}