Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 49 lines (34 sloc) 1.3 KB
# Convert source file of jpylyzer documentation (markdown) to delivery formats:
# 1. userManual.html - add this to root of jpylyzer website (includes Jekyll headers)
# 2. Self-contained HTML file for offline use (replaces PDF)
# Requires Pandoc and xmllint
# Base name
# Source file
# Style sheet
# Delivery formats
# Website
# Self-contained HTML
# Create file that replaces userManual page on website
# Step 1: convert to HTML
pandoc -s --columns 1000 --toc --toc-depth=2 --ascii -N -c $styleSheet -w html5 -o tmp.html $mdSource
# Step 2: generate file with Jekyll headers
echo "---" > $outWeb
echo "layout: page" >> $outWeb
echo "title: User Manual" >> $outWeb
echo "---" >> $outWeb
echo "{% include JB/setup %}" >> $outWeb
# Step 3: extract everything inside body element of HTML and add to output file
# This results in a flood of xmllint error messages, but they can be ignored.
xmllint --html --htmlout --xpath "//body/node()" tmp.html >> $outWeb
# Create self-contained HTML file (mainly useful for offline use; replaces PDF)
pandoc -s --columns 1000 --toc --toc-depth=2 --ascii -N -c $styleSheet -w html5 --self-contained -o $outHtmlSC $mdSource
# Clean-up
rm tmp.html