summaryrefslogtreecommitdiff
path: root/format.sh
blob: 609fc3680a640dee0a97c949ba32a81380c73a6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/bash
#find all text files (chapters), but nothing staring with an underscore
for y in `ls *.txt | grep -v _.*`;
do 
    #first kill all the blank lines
    perl -p -e 's/^\n//g' $y > temp;
    #now add a tab so paragraphs are indented
    perl -pi -e 's/^/\n\t/g' temp;
    #finally, respect the section breaks within chapters
    perl -pi -e 's/-----/\n\n\n\n/g' temp; mv temp book/$y;
    #a2x -f chunked -d book book/book.asc --verbose
    #a2x -f pdf --fop -d book book/book.asc --verbose
    #git scribe gen [site|html|pdf|epub|mobi|all]
done