all repos — site @ d71a372ce5091475f3b015ad9458b561b0ae2308

source for my site, found at icyphox.sh

bin/plaintext.sh (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
#!/bin/sh 

# from the pure sh bible; see: 
# https://github.com/dylanaraps/pure-sh-bible#get-the-base-name-of-a-file-path
basename() {
    dir=${1%${1##*[!/]}}
    dir=${dir##*/}
    dir=${dir%"$2"}
    base="${dir:-/}"
}

for p in pages/blog/*.md; do
    basename "$p"
    no_ext="${base%.*}"
    [ "$base" != "_index.md" ] && {
        pandoc --quiet -s -f "markdown+gutenberg" \
            "$p" -o "pages/txt/$no_ext.txt"
    }
done

cp pages/txt/*.txt build/blog/