Revision 30e2f0291454156c4c138696866bc8e50d3c1c3e authored by Peter Teuben on 13 October 2022, 15:53:54 UTC, committed by Peter Teuben on 13 October 2022, 15:53:54 UTC
2 parent s 88a426a + 3d204ae
Raw File
make_html
#! /bin/csh -f
#
#  calling this script will create html-ized man pages 
#  I've not gotten man2html to work quite, there appear
#  to be at least 2 different versions available,
#  one from http://www.oac.uci.edu/indiv/ehood/man2html.html
#  the other one comes with the linux man package (author unknown)
#
#  Other places to check:
#      http://man2web.sourceforge.net/
#
#  I personally prefer gman (a Gnome utility), though tkman and xman
#  are also not bad
#
#  Another option is mandoc:
#      mandoc -Thtml -Ostyle=mandoc.css,man=%N.%S.html < man1/tsf.1 > tsf.1.html
#  but this does (not yet) add the URLs we patch it with
#
#  pandoc is another route, see e.g.  https://www.howtogeek.com/682871/how-to-create-a-man-page-on-linux/
#
#  @todo   find a way to link to 

if ($#argv == 0) then
  set copy=0
else
  set copy=1
  if (X$1 == X-h || X$1 == X--h || X$1 == X-help || X$1 == X--help) then
    echo "Usage $0 [public man_html directory for WWW  site]"
    echo "Examples: (both scp and cp are supported)"
    echo "  $0 chara:/chara/teuben/nemo-www/man_html/"
    exit 0
  endif
  set html_dir=$1
endif

set manlevels=(1 3 5 6 8 l)
set log=/tmp/make_html.$$.log

cd $NEMO/man
if (! -e html) mkdir html


echo "Running rman on all levels ($manlevels)"
foreach d ($manlevels)
 set dir=man$d
 foreach file ($dir/*.$d)
   set base=$file:t
    # -r|--reference|--manref printf-string
    # -r      'http:/usr/share/man/html/%s.%s.html' 
    # -r '%s.%s.html'
    # PolyglotMan v3.0.8+X.Org                          - works
    # PolyglotMan v3.2 of $Date$  - broken, it adds NEMO to the url....
    #(rman -f HTML -r '%s.%s.html' $file  >  html/$base.html ) >>& $log
    (rman -f HTML -r '%s.%s.html' $file |sed 's/\.1NEMO/\.1/g'|sed 's/\.3NEMO/\.3/g'|sed 's/\.5NEMO/\.5/g'|sed 's/\.6NEMO/\.6/g'|sed 's/\.8NEMO/\.8/g'|sed 's/\.lNEMO/\.l/g' | awk -f bibcode2.awk > html/$base.html ) >>& $log
 end
 (./make_man.csh $d > html/index$d.html) >>& $log
 if ($status) echo Some error during make_man, inspect your $log
end

echo "Running make_whatis"
(./make_whatis.csh > html/whatis.html) >>& $log
if ($status) echo Some error during make_whatis, inspect your $log

echo "Running make_bibcode"
(./make_bibcode.csh > html/bibcode.html) >>& $log
if ($status) echo Some error during make_bibcode, inspect your $log

set o=html/index.html

set date=(`date`)
set host=(`hostname`)

cat > $o <<EOF_HTML
<HTML> 
<HEAD> 
<TITLE>NEMO Manual Pages </TITLE>  
</HEAD>
<BODY> 
<!-- do not edit this file; created by $0 --> 
<H1>Nemo Reference Manual</H1>
<UL>
<LI> <A HREF=index1.html>man1</A> (programs)
<LI> <A HREF=index3.html>man3</A> (functions)
<LI> <A HREF=index5.html>man5</A> (file formats)
<LI> <A HREF=index6.html>man6</A> (hardware)
<LI> <A HREF=index8.html>man8</A> (administrativia)
<LI> <A HREF=indexl.html>manl</A> (non-NEMO local programs in NEMO)
<LI> <A HREF=whatis.html>whatis</A> pages.
<LI> <A HREF=bibcode.html>bibcode</A> pages.
</UL>
<hr>
Automatically created by make_html on $host $date <P>
</BODY></HTML>
EOF_HTML

if ($copy) then
  echo $html_dir | grep -qs :
  if ($status) then
    if (-e $html_dir) then
        echo Using cp to copy html files to $html_dir
        cp html/* $html_dir >>& $log
	if ($status) echo Some error during copy, inspect your $log
    else
        echo Directory $html_dir does not exist
    endif
  else
    echo Using scp to copy html files to $html_dir
    scp html/* $html_dir >>& $log
    if ($status) echo Some error during copy, inspect your $log
  endif
else
  echo No copy made of html directory
endif
back to top