meso-web

Sources of the |Méso|Star> website
git clone git://git.meso-star.com/meso-web.git
Log | Files | Refs | README | LICENSE

convert_man.sh (2416B)


      1 #!/bin/sh
      2 
      3 # Copyright (C) 2017-2026 |Méso|Star> (contact@meso-star.com)
      4 #
      5 # This file is part of Méso-Web.
      6 #
      7 # Méso-Web is free software: you can redistribute it and/or modify
      8 # it under the terms of the GNU General Public License as published by
      9 # the Free Software Foundation, either version 3 of the License, or
     10 # (at your option) any later version.
     11 #
     12 # Méso-Web is distributed in the hope that it will be useful,
     13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     15 # GNU General Public License for more details.
     16 #
     17 # You should have received a copy of the GNU General Public License
     18 # along with Méso-Web. If not, see <http://www.gnu.org/licenses/>.
     19 
     20 set -e
     21 
     22 # The following line can be translated as follows:
     23 # - Convert the nroff file submitted on stdin to HTML
     24 # - Remove the page header
     25 # - Remove the footer
     26 # - Remove invalid links (they are used as section tags)
     27 # - Replace multiple non-breaking spaces with a single one
     28 # - Remove the opening HTML tag tt, which is no longer supported
     29 # - Remove the closing HTML tag tt, which is no longer supported
     30 # - Remove the compact attribute from the HTML tag dl, which is no
     31 #   longer supported
     32 # - Remove links on csplit, feh, gnuplot, sed, mmap, and mpirun
     33 # - Correct the link to the GPLv3+ license
     34 # - Remove the unexpected link on sqrt(2)
     35 # - Fix man2html issues that translate the ' character to cq
     36 # - Use tidy to further clean up the HTML code
     37   man2html -r \
     38 | tail -n +10 \
     39 | sed '/^<HR>$/,$d' \
     40 | sed 's/\(\&nbsp;\)\{1,\}/\&nbsp;/g' \
     41 | sed 's/^<A NAME="[[:alpha:]]\{0,\}">\&nbsp;<\/A>//g' \
     42 | sed 's/<TT>//g' \
     43 | sed 's/<\/TT>//g' \
     44 | sed 's/<DL COMPACT>/<DL>/g' \
     45 | sed -e 's/<B><A HREF="\.\.\/man1\/csplit\.1\.html">csplit<\/A><\/B>/csplit/g' \
     46       -e 's/<B><A HREF="\.\.\/man1\/feh\.1\.html">feh<\/A><\/B>/feh/g' \
     47       -e 's/<B><A HREF="\.\.\/man1\/gnuplot\.1\.html">gnuplot<\/A><\/B>/gnuplot/g' \
     48       -e 's/<B><A HREF="\.\.\/man1\/sed\.1\.html">sed<\/A><\/B>/sed/g' \
     49       -e 's/<B><A HREF="\.\.\/man1\/mpirun\.1\.html">mpirun<\/A><\/B>/mpirun/g' \
     50       -e 's/<B><A HREF="\.\.\/man2\/mmap\.2\.html">mmap<\/A><\/B>/mmap/g' \
     51       -e 's/gpl\.html\.">\(.*\).<\/A>/gpl.html">\1<\/A>./g' \
     52       -e 's/<A HREF="\.\.\/man2\/sqrt\.2\.html">sqrt<\/A>/sqrt/g' \
     53       -e "s/cq\([a-z]\)\>/'\1/g" \
     54 | tidy --show-info no -m --show-body-only yes 2>/dev/null || true