bookmobile/bookmobile.fish

28 lines
828 B
Fish
Raw Normal View History

2021-07-20 21:11:49 +00:00
#!/usr/bin/env fish
set theme themes/sakura.css
set temp ./.temp.html
# pulldown html page
wget --output-document $temp $argv
# Let's grab the page title
#
# solution from https://stackoverflow.com/questions/9312154/wget-page-title
set title (wget --quiet -O - $argv | paste -s -d " " | sed -n -e 's!.*<head[^>]*>\(.*\)</head>.*!\1!p' | sed -n -e 's!.*<title>\(.*\)</title>.*!\1!p')
echo "title: " $title
cp $temp originals/$title.html
# make rabid reader version
pandoc --self-contained -s $temp -c $theme --lua-filter=lib/remove-images.lua -o reader/$title.html
# presto changeo converto from html to markdown
pandoc -f html -t markdown_github-raw_html --lua-filter=lib/remove-images.lua -o markdown/$title.md $temp
pandoc -f html -t epub -o epubs/$title.epub --lua-filter=lib/remove-images.lua $temp
rm -f $temp