#!/bin/rc # NAME # markhpage - convert Markdown file to HTML page # SYNOPSIS # markhpage [-c cssuri] [-t title] [ file ] # DESCRIPTION # The rc script markhpage uses markdown(1) to interpret # text in file (or standard input) and inserts its HTML # representation into the body element of a complete # HTML document on the standard output. Under -c, the # path or URL cssuri is inserted as a stylesheet in # the output . The (possibly quoted) title argument to -t # gives a for the output. rfork en flagfmt='c cssuri,t title' args='[file]' if(! ifs=() eval `{aux/getflags $*} || ! ~ $#* 0 1){ aux/usage exit usage } if(~ $#* 1) srcf=$1 title=TITLE if(~ $#flagt 1) title=$flagt if not if(~ $#srcf 1) title=`{basename $srcf} echo '<!DOCTYPE html>' echo '<html dir="ltr" lang="en-US">' echo ' <head>' echo ' <meta charset="UTF-8" />' echo ' <title>'^$title^'' if(~ $#flagc 1) echo ' ' echo ' ' echo ' ' if(! ~ $#srcf 1) srcf=() markdown $srcf echo ' ' echo ''