6
My Writing Process, Part 1
So I started off with a simple bash script: bin/new-article
#! /bin/bash # Give it a title, and it'll give you an article template. title=$@ article=$(echo "$title" | iconv -c -t ascii//TRANSLIT | sed -E 's/[~^]+//g' | sed -E 's/[^a-zA-Z0-9]+/-/g' | sed -E 's/^-+|-+$//g' | tr A-Z a-z).html # Add to page tree echo $article >>articles.ptree entrynum=$(wc -l <articles.ptree) let "entrynum=entrynum-2" # Make article file cat >$article.pm <<EOF #lang pollen ◊(define-meta entry-number "$entrynum" title "$title" entry-date "$(date -I)") EOF # Open it for editing vim $article.pm
Then I started writing an article about philisophical skepticism, and when I realized it would take much longer than a day to complete, There’s a reason you don’t see it here yet :D I found out the problem with this setup—it assumes you publish things in the order you write them.
As a result, I’ve now make a wip/
directory for everything to stay in.
May it never become a graveyard.
And now, I have two scripts.
bin/new-article
is now for making a new article in the wip/
directory:
#! /bin/bash # Give it a title, and it'll give you an article template. title=$@ article=$(echo "$title" | iconv -c -t ascii//TRANSLIT | sed -E 's/[~^]+//g' | sed -E 's/[^a-zA-Z0-9]+/-/g' | sed -E 's/^-+|-+$//g' | tr A-Z a-z).html # Make article file cat >wip/$article.pm <<EOF #lang pollen ◊(define-meta entry-number "" title "$title" entry-date "") EOF # Open it for editing vim wip/$article.pm
And the new bin/publish
takes it out of wip/ and adds it to the ptree and adds the date and entry number:
#! /bin/bash # Give it an article in wip/, and it'll "publish" it. fname=$(basename $@) article=$(echo "$fname" | sed 's/\.html.*$//g') # Move article mv wip/$article.* . # Add to page tree echo $article.html >>articles.ptree entrynum=$(wc -l <articles.ptree) let "entrynum=entrynum-2" # Update page number sed -i "s/entry-number \".*\"/entry-number \"$entrynum\"/g" $article.html.pm sed -i "s/entry-date \".*\"/entry-date \"$(date -I)\"/g" $article.html.pm
Much more flexible.
(As for the part 1 in the title, I just want to leave myself room for potential sequels. What if later I decide to write about writing? I’d have to come up with a new title!)