Improved sav-quotes to avoid empty quotes and messy embedded HTML

This commit is contained in:
Danielle McLean 2016-10-28 09:55:07 +11:00
parent 0dea194992
commit b55250f583
No known key found for this signature in database
GPG key ID: CC91589719027E94
2 changed files with 12 additions and 5 deletions

View file

@ -10,12 +10,13 @@ list_srcs() {
}
save_from_src() {
mkdir -p ${dest:h}
rm $dest
rm -f $dest
for i in {1..5}
do
$src >> $dest
wc -l $dest
(( i < 5 )) && echo % >> $dest
wc -l $dest
done
strfile $dest
}

View file

@ -1,5 +1,11 @@
#!/usr/bin/env bash
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
sum() {
declare -i acc
for i; do acc+=i; done
echo $acc
}
curl http://www.xkcdb.com/\?random1 | hxnormalize -i 0 -l 99999999999 -x | hxremove br | hxselect -cs '\n%\n' 'span.quote' | hxunent
exit ${PIPESTATUS[0]}
curl -s 'http://www.xkcdb.com/?random1' |
hxnormalize -i 0 -l 99999999999 -x | hxselect -cs '<br>\n%<br>\n' 'span.quote' |
html2text -b 0 | hxunent | sed '$d; s/ *$//' | sed '$d'
exit $(sum ${PIPESTATUS[*]})