initial commit
This commit is contained in:
commit
5b839e0543
174 changed files with 12261 additions and 0 deletions
64
werc/bin/aux/bpst.rc
Executable file
64
werc/bin/aux/bpst.rc
Executable file
|
@ -0,0 +1,64 @@
|
|||
#!/bin/rc
|
||||
|
||||
path=( $PLAN9/bin $path )
|
||||
base=.
|
||||
|
||||
if(~ $#user 0)
|
||||
user=`{whoami}
|
||||
|
||||
file=(); title=();
|
||||
bloguser=$user
|
||||
while(! ~ $#* 0) {
|
||||
switch($1) {
|
||||
case -u
|
||||
base=/gsoc/www/people/$user/blog/
|
||||
case -b
|
||||
shift
|
||||
base=$1
|
||||
case -f
|
||||
shift
|
||||
file=$1
|
||||
}
|
||||
shift
|
||||
}
|
||||
|
||||
if(~ $"EDITOR '')
|
||||
EDITOR=vi
|
||||
|
||||
if(~ $#file 0 || ! test -f $file) {
|
||||
file=/tmp/blogtmp.$pid
|
||||
rm $file >[2]/dev/null
|
||||
touch $file
|
||||
}
|
||||
|
||||
$EDITOR $file
|
||||
aspell -c $file
|
||||
rm $file.bak >[2]/dev/null
|
||||
|
||||
fn mkbpost {
|
||||
umask 002 # Let group write
|
||||
bptext=$1
|
||||
if(! ~ $#2 0)
|
||||
bpid=`{echo -n '-'^$"bpid | sed 's/'$forbidden_uri_chars'+/_/g; 1q'}
|
||||
d=`{/bin/date +%F|sed 's,-,/,g'}
|
||||
|
||||
ddir=$blagh_root^$d^'/'
|
||||
n=`{ls $ddir >[2]/dev/null |wc -l}
|
||||
|
||||
mkdir -p $ddir/$"n^$"bpid/
|
||||
{
|
||||
# TODO: Enable metadata
|
||||
#echo '* Posted:' `{date}
|
||||
#if(! ~ $#logged_user 0)
|
||||
# echo '* Author: '$logged_user
|
||||
cat $bptext
|
||||
}> $ddir/$"n^$"bpid/index.md
|
||||
}
|
||||
|
||||
forbidden_uri_chars='[^a-zA-Z0-9_+\-\/\.]'
|
||||
blagh_root=$base
|
||||
|
||||
if(test -s $file)
|
||||
mkbpost $file
|
||||
if not
|
||||
echo Empty file!
|
Loading…
Add table
Add a link
Reference in a new issue