aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał Łyszczek <michal.lyszczek@bofc.pl>2018-01-22 20:24:52 +0100
committerMichał Łyszczek <michal.lyszczek@bofc.pl>2018-01-22 20:24:52 +0100
commit6bff421fb983fc7e20b8f58e3296934c7b150133 (patch)
tree0a84eca7f2f292034283e52461aef3c53495394a
parente7c12c33c40ab26812b524d729e64b3dba42e113 (diff)
downloadlibrb-6bff421fb983fc7e20b8f58e3296934c7b150133.tar.gz
librb-6bff421fb983fc7e20b8f58e3296934c7b150133.tar.bz2
librb-6bff421fb983fc7e20b8f58e3296934c7b150133.zip
add: manual page info at beginning and end of page
-rwxr-xr-xman2html.sh20
-rw-r--r--www/custom.css32
2 files changed, 48 insertions, 4 deletions
diff --git a/man2html.sh b/man2html.sh
index d5566ca..97806e9 100755
--- a/man2html.sh
+++ b/man2html.sh
@@ -21,24 +21,27 @@ do
# remove leftover <body> and <h1>man</h1> tags from beginning
tail -n+3 "${ftmp}" > tmp; mv tmp "${ftmp}"
- # construct own h1 tag
+ # construct top page heading with page info, remove superflous info
name="$(basename ${m})"
name="${name%.*}"
- sed -i "1s/^/<H1>${name}(${n})<\/H1>\n<P> /" "${ftmp}"
+ 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 (h1 and info) and remove them from 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 table of content from file
toc="$(sed -n '/<DL>/,/<\/DL>/p' "${ftmp}")"
- toc="$(echo "${toc}" | sed 's/DL>/UL>/')"
+ 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>/')"
@@ -52,6 +55,15 @@ do
# change deprecated name in <a> into id
sed -i 's/A NAME="/A ID="/g' "${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}"
+
+ # convert all h2 into h1 headings
+ sed -i 's/H2>/H1>/g' "${ftmp}"
+
+ # remove obsolete COMPACT from dl
+ sed -i 's/DL COMPACT/DL/g' "${ftmp}"
+
# move generated file into output directory for further processing
cp "${ftmp}" "${out}/man${n}/${m}.html"
done
diff --git a/www/custom.css b/www/custom.css
index 166d407..d7f8075 100644
--- a/www/custom.css
+++ b/www/custom.css
@@ -25,3 +25,35 @@ 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;
+}