alexkarle.com

Source for alexkarle.com
git clone git://git.alexkarle.com/alexkarle.com.git
Log | Files | Refs | README | LICENSE

genpost.sh (1120B) [raw]


      1 #!/bin/sh
      2 # genpost.sh -- reads mdoc(7) from stdin, generates HTML to stdout
      3 REPO=$(dirname "$(dirname "$0")")
      4 
      5 # cd into $REPO so that the includes work!
      6 cd $REPO
      7 
      8 # Find fixlinks in either bin or the out-of-tree obj build
      9 PATH="$REPO/bin:$REPO/obj/bin:$PATH"
     10 
     11 # Command Explained
     12 # -----------------
     13 # man=%N.html;man.openbsd.org -- look for files in CWD for .Xr, then link to openbsd.org
     14 # sed:
     15 #   1. Add a viewport tag for mobile
     16 #   2. Add lang="en" to head for accessibility
     17 #   3. Remove Misc Info column in header (too large on mobile)
     18 #   4. Add a footer with license info
     19 #   5. Correct various off-site links (i.e. .Xr st -> st.suckless.org instead of openbsd.org)
     20 mandoc -Thtml -O 'man=%N.html;https://man.openbsd.org/%N.%S,style=style.css' \
     21     | sed \
     22     -e 's#</head>#<meta name="viewport" content="width=device-width,initial-scale=1">&# ' \
     23     -e 's#^<html#& lang="en"#' \
     24     -e '/<td class="head-vol">Miscellaneous Information Manual<\/td>/d' \
     25     -e 's#</body>#<p class="foot-license">\
     26   © 2019-2021 Alex Karle | <a href="/">Home</a> | <a href="/license.html">License</a>\
     27 </p>\
     28 &#' | fixlinks