aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile22
-rwxr-xr-xman2html.sh94
-rw-r--r--www/custom.css42
3 files changed, 113 insertions, 45 deletions
diff --git a/Makefile b/Makefile
index c50e761..b26219e 100644
--- a/Makefile
+++ b/Makefile
@@ -2,17 +2,17 @@ DESTDIR ?= "/usr/local"
install:
install -m 0644 -D -t $(DESTDIR)/include mtest.h
- install -m 0644 -D -t $(DESTDIR)/share/man/man7 man/man7/mtest_overview.7
- install -m 0644 -D -t $(DESTDIR)/share/man/man3 man/man3/mt_assert.3
- install -m 0644 -D -t $(DESTDIR)/share/man/man3 man/man3/mt_defs.3
- install -m 0644 -D -t $(DESTDIR)/share/man/man3 man/man3/mt_defs_ext.3
- install -m 0644 -D -t $(DESTDIR)/share/man/man3 man/man3/mt_fail.3
- install -m 0644 -D -t $(DESTDIR)/share/man/man3 man/man3/mt_fok.3
- install -m 0644 -D -t $(DESTDIR)/share/man/man3 man/man3/mt_ferr.3
- install -m 0644 -D -t $(DESTDIR)/share/man/man3 man/man3/mt_assert.3
- install -m 0644 -D -t $(DESTDIR)/share/man/man3 man/man3/mt_return.3
- install -m 0644 -D -t $(DESTDIR)/share/man/man3 man/man3/mt_run.3
- install -m 0644 -D -t $(DESTDIR)/share/man/man3 man/man3/mt_run_named.3
+ install -m 0644 -D -t $(DESTDIR)/share/man/man7 man/mtest_overview.7
+ install -m 0644 -D -t $(DESTDIR)/share/man/man3 man/mt_assert.3
+ install -m 0644 -D -t $(DESTDIR)/share/man/man3 man/mt_defs.3
+ install -m 0644 -D -t $(DESTDIR)/share/man/man3 man/mt_defs_ext.3
+ install -m 0644 -D -t $(DESTDIR)/share/man/man3 man/mt_fail.3
+ install -m 0644 -D -t $(DESTDIR)/share/man/man3 man/mt_fok.3
+ install -m 0644 -D -t $(DESTDIR)/share/man/man3 man/mt_ferr.3
+ install -m 0644 -D -t $(DESTDIR)/share/man/man3 man/mt_assert.3
+ install -m 0644 -D -t $(DESTDIR)/share/man/man3 man/mt_return.3
+ install -m 0644 -D -t $(DESTDIR)/share/man/man3 man/mt_run.3
+ install -m 0644 -D -t $(DESTDIR)/share/man/man3 man/mt_run_named.3
www:
./man2html.sh
diff --git a/man2html.sh b/man2html.sh
index b817b23..955f031 100755
--- a/man2html.sh
+++ b/man2html.sh
@@ -1,54 +1,80 @@
#!/bin/sh
-hostname="http://mtest.kurwinet.pl"
+hostname="http://librb.kurwinet.pl"
out="$(pwd)/www/manuals"
root="$(pwd)"
ftmp="/tmp/mtest-man2html"
-for n in {3,7}
+cd "${root}/man"
+mkdir "${out}"
+
+for m in *.[1-8]
do
- mkdir -p "${out}/man${n}"
- cd "${root}/man/man${n}"
+ n="${m##*.}"
+ echo "opening ${m}"
- for m in *
- do
+ if grep "\.so man${n}" "${m}"
+ then
+ sed -i "s/man${n}/man/" "${m}"
+ man2html -r -H "${hostname}" "${m}" > "${ftmp}"
+ sed -i "s/man\//man${n}\//g" "${m}"
+ else
man2html -r -H "${hostname}" "${m}" > "${ftmp}"
+ fi
+
+ # get only body part of the file
+ body_only="$(sed -n '/<BODY>/,/<\/BODY>/p' "${ftmp}")"
+ echo "$body_only" > "${ftmp}"
+
+ # remove leftover <body> and <h1>man</h1> tags from beginning
+ tail -n+3 "${ftmp}" > tmp; mv tmp "${ftmp}"
+
+ # construct top page heading with page info, remove superflous info
+ name="$(basename ${m})"
+ name="${name%.*}"
+ version_info="$(head -n1 ${ftmp} | cut -f3 -d: | cut -f1 -d\<)"
+ tail -n+2 "${ftmp}" > tmp; mv tmp "${ftmp}"
+ sed -i "1s/^/<p class=\"info left\">${name}(${n})<\/p><p class=\"info center\">kurwinet manual pages<\/p><p class=\"info right\">${name}(${n})<\/p>\n<br><P> /" "${ftmp}"
+
+ # remove uneeded links to non-existing index
+ sed -i 's/<A HREF="\.\.\/index.html">Return to Main Contents<\/A><HR>//' "${ftmp}"
+ sed -i 's/<A HREF="#index">Index<\/A>//g' "${ftmp}"
+
+ # extract table of content and put it in the beginning of file
+ ## cache first two lines (page info) and remove them from file
+ tmp="$(head -n2 ${ftmp})"
+ tail -n+3 "${ftmp}" > tmp; mv tmp "${ftmp}"
- # get only body part of the file
- body_only="$(sed -n '/<BODY>/,/<\/BODY>/p' "${ftmp}")"
- echo "$body_only" > "${ftmp}"
+ ## get table of content from file
+ toc="$(sed -n '/<DL>/,/<\/DL>/p' "${ftmp}")"
- # remove leftover <body> and <h1>man</h1> tags from beginning
- tail -n+3 "${ftmp}" > tmp; mv tmp "${ftmp}"
+ toc="$(echo "${toc}" | sed 's/<DL>/<UL class="man-toc">/')"
+ toc="$(echo "${toc}" | sed 's/<\/DL>/<\/UL>/')"
+ toc="$(echo "${toc}" | sed 's/<DT>/<LI>/')"
+ toc="$(echo "${toc}" | sed 's/<DD>/<\/LI>/')"
- # construct own h1 tag
- name="$(basename ${m})"
- name="${name%.*}"
- sed -i "1s/^/<H1>${name}(${n})<\/H1>\n<P> /" "${ftmp}"
+ ## put table of content and first two lines into file and append hr
+ { echo -e "${tmp}\n${toc}\n<HR>"; cat "${ftmp}"; } > tmp; mv tmp "${ftmp}"
- # remove uneeded links to non-existing index
- sed -i 's/<A HREF="\.\.\/index.html">Return to Main Contents<\/A><HR>//' "${ftmp}"
- sed -i 's/<A HREF="#index">Index<\/A>//g' "${ftmp}"
+ ## remove table of content and some uneeded info from bottom of file
+ sed -i '/^<A NAME="index">&nbsp;<\/A><H2>Index<\/H2>$/,$d' "${ftmp}"
+ head -n-3 "${ftmp}" > tmp; mv tmp "${ftmp}"
- # extract table of content and put it in the beginning of file
- ## cache first two lines (h1 and info) and remove them from file
- tmp="$(head -n2 ${ftmp})"
- tail -n+3 "${ftmp}" > tmp; mv tmp "${ftmp}"
+ # change deprecated name in <a> into id
+ sed -i 's/A NAME="/A ID="/g' "${ftmp}"
- ## get table of content from file
- toc="$(sed -n '/<DL>/,/<\/DL>/p' "${ftmp}")"
+ # generate page info at bottom of page
+ echo "<p class=\"info left\"><a href=\"http://en.bofc.pl\">bofc.pl</a></p><p class=\"info center\">${version_info}</p><p class=\"info right\">${name}(${n})</p>" >> "${ftmp}"
- ## put table of content and first two lines into file and append hr
- { echo -e "${tmp}\n${toc}\n<HR>"; cat "${ftmp}"; } > tmp; mv tmp "${ftmp}"
+ # convert all h2 into h1 headings
+ sed -i 's/H2>/H1>/g' "${ftmp}"
- ## remove table of content and some uneeded info from bottom of file
- sed -i '/^<A NAME="index">&nbsp;<\/A><H2>Index<\/H2>$/,$d' "${ftmp}"
- head -n-3 "${ftmp}" > tmp; mv tmp "${ftmp}"
+ # remove obsolete COMPACT from dl
+ sed -i 's/DL COMPACT/DL/g' "${ftmp}"
- # change deprecated name in <a> into id
- sed -i 's/A NAME="/A ID="/g' "${ftmp}"
+ # change ../man# to ./ as we have all mans in single directory
+ sed -i 's/\.\.\/man.\//.\//g' "${ftmp}"
- # move generated file into output directory for further processing
- cp "${ftmp}" "${out}/man${n}/${m}.html"
- done
+ # move generated file into output directory for further processing
+ cp "${ftmp}" "${out}/${m}.html"
done
diff --git a/www/custom.css b/www/custom.css
index d0ff087..d7f8075 100644
--- a/www/custom.css
+++ b/www/custom.css
@@ -15,3 +15,45 @@ div#footer a:hover, div#header a:hover
color: red;
text-decoration: none;
}
+
+div.codehilite:before
+{
+ content: "// code";
+}
+
+img[alt=test-result-svg]
+{
+ float: right;
+}
+
+p.info
+{
+ margin-top: 2ch;
+ margin-bottom: 2ch;
+ margin-left: 0ch;
+ margin-right: 0ch;
+ float: left;
+}
+
+p.left
+{
+ text-align: left;
+ width: 33%
+}
+
+p.center
+{
+ text-align: center;
+ width: 33%
+}
+
+p.right
+{
+ text-align: right;
+ width: 34%
+}
+
+ul.man-toc
+{
+ clear: both;
+}