#!/bin/sh
# Creates an ASXII version of the wiki.

echo "making TXT"
rm -rf txt
mkdir txt

for f in *.md; do
  echo $f

  fname=$(echo "$f" | sed "s/\.md//g")
  f2="txt/${fname}.txt"

  pandoc -f markdown -t plain $f | iconv -f utf-8 -t ascii//TRANSLIT >> $f2
done

echo "making single TXT"

echo "LESS RETARDED WIKI" > lrs.txt
echo "by drummyfish, released under CC0 1.0, public domain" >> lrs.txt

for f in txt/*.txt; do
  echo $f

  fname=$(echo "$f" | sed "s/\.txt//g" | sed "s/txt\///g")

  echo "--------------------------------------------------------------------------------" >> lrs.txt
  echo "$fname:" >> lrs.txt

  cat $f >> lrs.txt
done

echo "done"