Add terget to convert RST to HTML.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Mon, 24 Oct 2011 02:56:48 +0300
changeset 752 079c2e27357a
parent 751 f8f9771725f5
child 753 732e4cefb33b
Add terget to convert RST to HTML.
Makefile
rst.css
--- a/Makefile	Mon Oct 24 02:56:25 2011 +0300
+++ b/Makefile	Mon Oct 24 02:56:48 2011 +0300
@@ -28,9 +28,15 @@
 
 host_os = unix
 ifneq '' '$(COMSPEC)'
-  host_os = windows
+  ifneq '' '$(WINDIR)'
+    # Probably under Windows.
+    host_os = windows
+  endif
 endif
 
+################################################################
+# Build tool definition/switches.
+
 EMACS = emacs
 # I prefer native Windows Emacs, so use it if available.
 ifeq 'windows' '$(host_os)'
@@ -39,11 +45,22 @@
   endif
 endif
 
+RST2HTML = rst2html
+ifeq '$(host_os)' 'windows'
+  RST2HTML = rst2html.py
+endif
+
+################################################################
+# Proj dirs/files.
+
+FILES_MODE_EL := $(wildcard *-mode.el)
+
+RST_FILES := $(wildcard *.rst)
+HTML_FILES := $(RST_FILES:.rst=.html)
+
 ################################################################
 # Targets.
 
-FILES_MODE_EL := $(wildcard *-mode.el)
-
 .PHONY: all
 all: install
 
@@ -80,6 +97,15 @@
 	tar cf dot-emacs.tar .emacs .emacs-my
 
 ################################################################
+# Documentation targets.
+
+.PHONY: html
+html: $(HTML_FILES)
+
+$(HTML_FILES): %.html: %.rst
+	$(RST2HTML) --stylesheet=rst.css $*.rst $@
+
+################################################################
 # Clean targets.
 
 .PHONY: distclean
@@ -87,4 +113,4 @@
 
 .PHONY: clean
 clean:
-	rm -f dot-emacs.tar
+	rm -f dot-emacs.tar $(HTML_FILES)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rst.css	Mon Oct 24 02:56:48 2011 +0300
@@ -0,0 +1,19 @@
+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: bisque; border-radius: 10px; padding: 1px; }
+p { text-indent: 2em; }
+p:first-letter { font-weight: bold; }
+.literal-block {
+    margin: 0 0 0 4em;
+    padding: 5px;
+    border: 1px;
+    border-style: solid;
+    border-color: brown;
+    background-color: LightYellow;
+    overflow: auto;
+}
+table { border-collapse:collapse; margin-left:auto; margin-right:auto; }
+table, tr, td { padding: 3px; border: 1px dotted maroon; background-color: cornsilk; }