all repos — site @ bb9e58051a63e6c8557d22b3af52f20a69ee7e92

source for my site, found at icyphox.sh

bin/plaintext.sh (view raw)

 1#!/bin/sh 
 2
 3# from the pure sh bible; see: 
 4# https://github.com/dylanaraps/pure-sh-bible#get-the-base-name-of-a-file-path
 5basename() {
 6    dir=${1%${1##*[!/]}}
 7    dir=${dir##*/}
 8    dir=${dir%"$2"}
 9    base="${dir:-/}"
10}
11
12
13mkdir "build/txt/"
14
15for p in pages/blog/*.md; do
16    basename "$p"
17    no_ext="${base%.*}"
18#    [ "$base" != "_index.md" ] && {
19#        pandoc --quiet -s -f "markdown+gutenberg" \
20#            "$p" -o "pages/txt/$no_ext.txt"
21#    }
22    cp "$p" "build/txt/$no_ext.txt"
23done