changeset 62:83c835137c2e

Generate UX friendly index.html with iframe to tips index.
author Oleksandr Gavenko <gavenkoa@gmail.com>
date Sat, 20 Feb 2016 02:01:35 +0200
parents cba303c0ad38
children 638be4cee0fe
files Makefile
diffstat 1 files changed, 20 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Sat Feb 06 13:06:00 2016 +0200
+++ b/Makefile	Sat Feb 20 02:01:35 2016 +0200
@@ -46,7 +46,7 @@
 HTML_DIR := tips-html
 RST_HTML_FILES := $(patsubst %.rst,$(HTML_DIR)/%.html,$(RST_FILES))
 HTML_FILES := $(RST_HTML_FILES) \
-        $(HTML_DIR)/index.html $(HTML_DIR)/frame.html $(HTML_DIR)/frame-index.html
+        $(HTML_DIR)/index.html $(HTML_DIR)/iframe.html $(HTML_DIR)/frame.html $(HTML_DIR)/frame-index.html
 TXT__FILES := $(addprefix $(HTML_DIR)/,$(TXT_FILES))
 
 CHM_FILES := $(addprefix $(HTML_DIR)/,chm.hhp chm.hhc chm.stp)
@@ -98,8 +98,24 @@
 $(HTML_DIR)/%.html: %.rst HEADER.rst rst.css $(MAKEFILE_LIST) | $(HTML_DIR)
 	$(RST2HTML) $(RST_FLAGS) --stylesheet=rst.css $*.rst $@
 
-HEADER.rst: Makefile
+$(HTML_DIR)/iframe.html: $(RST_FILES) $(MAKEFILE_LIST) | $(HTML_DIR)
 	{ \
+echo '<html><head></head><body>'; \
+echo '<ul style="padding-left: 1em;">'; \
+for f in $(RST_FILES); do \
+  n=$${f%.rst}; \
+  printf '<li><a target="_parent" href="%s.html">%s</a></li>' $$n $$n; \
+done; \
+echo '</ul>'; \
+echo '</body></html>'; \
+} >$@
+
+HEADER.rst: $(MAKEFILE_LIST)
+	{ \
+echo '.. raw:: html'; \
+echo; \
+echo '  <div id="sidebar"><iframe src="iframe.html"></iframe></div>'; \
+echo; \
 echo '.. _`Home`: index.html'; \
 echo '.. _About: README.html'; \
 echo '.. _`About author`: http://resume.defun.work/'; \
@@ -116,8 +132,8 @@
 $(HTML_DIR)/frame-index.html: index.sh $(RST_HTML_FILES) $(MAKEFILE_LIST) | $(HTML_DIR)
 	./index.sh frame >$@
 
-$(HTML_DIR)/index.html: index.sh $(RST_HTML_FILES) $(MAKEFILE_LIST) | $(HTML_DIR)
-	./index.sh html >$@
+$(HTML_DIR)/index.html: $(HTML_DIR)/README.html $(MAKEFILE_LIST) | $(HTML_DIR)
+	cp $< $@
 
 $(HTML_DIR)/%.html: %.html $(MAKEFILE_LIST) | $(HTML_DIR)
 	cp $< $@