changeset 2646:37235424378e

Auto-generate README and ChangeLog html user docs Change Makefile.am to: Run markdown to create README.html from README.md Run git to create new ChangeLog file and ChangeLog.html from that Revise format of ChangeLog.html If markdown or git executables are not present, do nothing
author Colin Clark <colin.clark@cclark.uk>
date Sat, 28 Oct 2017 12:07:11 +0100
parents b1d2dd750915
children 9f1adad6c2cf
files Makefile.am gen_changelog.sh gen_readme.sh
diffstat 3 files changed, 24 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.am	Sat Oct 28 11:23:18 2017 +0100
+++ b/Makefile.am	Sat Oct 28 12:07:11 2017 +0100
@@ -31,3 +31,10 @@
 	cp $(top_builddir)/geeqie.spec $(distdir)
 
 DISTCLEANFILES = config.report
+
+.PHONY: ChangeLog.html
+ChangeLog.html:
+	./gen_changelog.sh
+
+README.html: README.md
+	./gen_readme.sh
--- a/gen_changelog.sh	Sat Oct 28 11:23:18 2017 +0100
+++ b/gen_changelog.sh	Sat Oct 28 12:07:11 2017 +0100
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 # Script to update ChangeLog file,
-# it keeps "pre-svn" history and insert svn log at top,
+# it keeps "pre-svn" history and inserts git log at top,
 # it uses C locale for date format.
 # It has to be run where ChangeLog is.
 # Old ChangeLog is saved as ChangeLog.bak
@@ -9,6 +9,7 @@
 # ChangeLog.html is also created
 
 [ ! -e "ChangeLog" ] && exit 1
+[ ! -x "$(command -v git)" ] && exit 1
 
 tail -6614 ChangeLog > ChangeLog.$$.old && \
 LC_ALL=C git log --no-merges --no-notes --encoding=UTF-8 --no-follow 1b58572cf58e9d2d4a0305108395dab5c66d3a09..HEAD > ChangeLog.$$.new && \
@@ -22,9 +23,9 @@
 echo "<textarea rows='6615' cols='100'" >ChangeLog.$$.old.html && \
 tail -6618 ChangeLog >> ChangeLog.$$.old.html && \
 echo "</textarea" >>ChangeLog.$$.old.html && \
-LC_ALL=C git log --no-merges --no-notes --encoding=UTF-8 --date=format:'%Y-%m-%d' --no-follow  --pretty=format:"<li>%ad  <a href=\"http://github.com/BestImageViewer/Geeqie/commit/%H\">view commit </a> %s </li> "  1b58572cf58e9d2d4a0305108395dab5c66d3a09..HEAD > ChangeLog.$$.new.html && \
-cat ChangeLog.$$.old.html >> ChangeLog.$$.new.html && \
-mv -f ChangeLog.html ChangeLog.html.bak  && \
+LC_ALL=C git log --no-merges --no-notes --encoding=UTF-8 --date=format:'%Y-%m-%d' --no-follow  --pretty=format:"<li><a href=\"http://github.com/BestImageViewer/Geeqie/commit/%H\">view commit </a></li> <para>Author: %an<br>Date: %ad<br><textarea rows=4 cols=100>%s %n%n%b</textarea><br><br></para>" > ChangeLog.$$.new.html && \
+cat ChangeLog.$$.old.html >> ChangeLog.$$.new.html
+[ -e ChangeLog.html ] && mv -f ChangeLog.html ChangeLog.html.bak
 mv -f ChangeLog.$$.new.html ChangeLog.html
 
 rm -f ChangeLog.$$.old.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gen_readme.sh	Sat Oct 28 12:07:11 2017 +0100
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+# Script to create README.html file,
+
+[ ! -e "README.md" ] && exit 1
+[ ! -x "$(command -v markdown)" ] && exit 1
+
+[ -e README.html ] && mv -f README.html README.html.bak
+
+markdown README.md > README.html
+
+exit 0