Auto-generate README and ChangeLog html user docs
authorColin Clark <colin.clark@cclark.uk>
Sat, 28 Oct 2017 11:07:11 +0000 (12:07 +0100)
committerColin Clark <colin.clark@cclark.uk>
Sat, 28 Oct 2017 11:07:11 +0000 (12:07 +0100)
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

Makefile.am
gen_changelog.sh
gen_readme.sh [new file with mode: 0755]

index 1b97ace..5f21e2f 100644 (file)
@@ -31,3 +31,10 @@ dist-hook: geeqie.spec
        cp $(top_builddir)/geeqie.spec $(distdir)
 
 DISTCLEANFILES = config.report
+
+.PHONY: ChangeLog.html
+ChangeLog.html:
+       ./gen_changelog.sh
+
+README.html: README.md
+       ./gen_readme.sh
index ae42af9..2b37d19 100755 (executable)
@@ -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 @@ rm -f ChangeLog.$$.old
 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
diff --git a/gen_readme.sh b/gen_readme.sh
new file mode 100755 (executable)
index 0000000..a308453
--- /dev/null
@@ -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