Those entries should now be good now with fixed links, etc. Ahh, sweet productivity.
Fri, 07 Apr 2006All known-broken entries now fixed
Thanks to my handy
vim-pybloxsom hack, I took time today to go back through all entries I had
marked broken during the move from my old site to here.
Those entries should now be good now with fixed links, etc. Ahh, sweet productivity.
Comments: 0 (view comments)
Vim hack for Pyblosxom entry backdating
Hurray! I finally got around to hacking a little script for vim that will
automatically track posting dates for pyblosxom entries. It does the following:
My "vim scripting"-fu is not strong, so there's probably a cleaner/fancier way to do this. Anyhoo, you'll need the following in your .vimrc:
" PyBlosxom stuff
augroup pyblosxom
autocmd BufReadPost /home/jls/public_html/entries/*/*.txt call Pyblosxom_checkdate()
autocmd BufNewFile /home/jls/public_html/entries/*/*.txt call Pyblosxom_putdate()
autocmd BufWritePost /home/jls/public_html/entries/*/*.txt call Pyblosxom_fudgedate()
augroup end
function Pyblosxom_checkdate()
" Look in the file for '#mdate foo' metadata
normal 1G
let dateline = search("^#mdate")
" If not found, append the mdate of the file to line 2
if dateline < 1
let dateline = 1
let date = system("stat -f '#mdate %Sm' " . expand("%"))
" Add the date to the file on line 1
1put=date
endif
endfunction
function Pyblosxom_putdate()
let date=strftime("#mdate %b %e %H:%M:%S %Y")
1put=date
goto 1
endfunction
function Pyblosxom_fudgedate()
let l=search("^#mdate")
let l=strpart(getline(l), 7)
let cmd="date -j -f '%b %e %H:%M:%S %Y' '" . l . "' +%y%m%d%H%M"
let touchtime=system(cmd)
let touchcmd="touch -t '" . strpart(touchtime,0,strlen(touchtime)-1) . "' '" . expand("%") . "'"
call system(touchcmd)
e
endfunction
Comments: 0 (view comments)
|
Search this siteNavigationMetadataHome About Resume My Code (SVN)ArticlesARP Security Dynamic DNS with DHCP OpenLDAP+Kerberos+SASL PPP over SSH SSH Security: /bin/false Week of Unix Tools Work EfficiencyProjectsfex firefox tabsearch firefox urledit grok keynav liboverride newpsm (FreeBSD) nis2ldap pam_captcha poor man's backup Solaris audio utility xboxproxy xdotool xmlpresenter xpathtool misc scriptsPresentationsYahoo! Hack Day '06 Unix Essentials Vi/Vim EssentialsTag CloudCalendar
FriendsBarCamp Kent Brewster Tantek Çelik John Resig Wesley Shields Tyler ShieldsTechnorati |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||