ADDED user/crc/corpse/NOTES Index: user/crc/corpse/NOTES =================================================================== --- user/crc/corpse/NOTES +++ user/crc/corpse/NOTES @@ -0,0 +1,23 @@ +Corpse is a weblog written using Retro and the Casket framework. + +So to build it: + + - latest Retro 11 image + - latest Casket from repository + - latest Casket Python VM + - latest standard VM + +Building Things: + + - Copy corpse.rx, casket.rx, retroImage, and standard vm to a directory + - Edit paths in corpse.rx + - ./retro --with corpse.rx + - Copy retroImage somewhere safe + - Edit retro.py (from Casket) to adjust paths + - Copy retro.py to your cgi-bin directory, rename as necessary to match + paths in casket.rx + - Create directory for casket root, articles + - create first article (articles/1) + - cat >current + 1^D^D + ADDED user/crc/corpse/corpse.rx Index: user/crc/corpse/corpse.rx =================================================================== --- user/crc/corpse/corpse.rx +++ user/crc/corpse/corpse.rx @@ -0,0 +1,135 @@ +( corpse, a weblog in forth ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ) + +include casket.rx +with casket' + +( Setup App-specific Paths ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ) +: ARTICLES ( -$ ) casket:root "articles/" ^strings'append ; +: CURRENT ( -$ ) casket:root "current" ^strings'append ; + +( variables and buffers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ) +: article ( -n ) @memory 65535 - ; +3 elements current requested this + +( support code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ) +: getCurrent ( - ) + article CURRENT ^files'slurp drop article toNumber !current ; + +: setRequest ( - ) + casket:options toNumber !requested ; + +: commonHeader ( - ) + Content-type: text/html + "header.html" withTemplate ; + +: commonFooter ( - ) + "footer.html" withTemplate ; + +: navbar ( - ) + @requested 1- dup [ "prior" tputs ] &drop if + @requested 1- dup + [ @current @requested <> [ 1+ " | " tputs ] ifTrue ] ifTrue + @requested dup @current 1- < + [ 1+ "next" tputs ] &drop if + @requested " | permalink" tputs ; + +( paths ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ) +{{ + : articleNavigationBar + setRequest + "" + tputs + "

" tputs @current @requested "Post %d of %d: " tputs + navbar "

" tputs ; + : displayArticle + article ARTICLES @requested toString ^strings'append ^files'slurp drop + article formatted off puts formatted on ; +---reveal--- + : /article + commonHeader + articleNavigationBar + displayArticle + @current "

View comments for this article

" tputs + commonFooter ; + : /comments + commonHeader + articleNavigationBar + displayArticle + "discuss.erx" withTemplate + commonFooter ; +}} + +: /css + Content-type: text/css + "corpse.css" withTemplate ; + +{{ + : findHeader ( h-h$ ) + repeat + dup ^files'readLine + dup 0 4 ^strings'getSubset "

" compare if; drop + again ; + : getHeader ( h-$ ) + findHeader nip 4 over getLength 9 - ^strings'getSubset ; + : displayLink ( $n- ) + "
  • %s
  • " tputs ; +---reveal--- + : /all + commonHeader + "

    Index of All Posts

    " tputs + "" tputs + commonFooter ; +}} + +{{ + : findHeader ( h-h$ ) + repeat + dup ^files'readLine + dup 0 4 ^strings'getSubset "

    " compare if; drop + again ; + : getHeader ( h-$ ) + findHeader nip 4 over getLength 9 - ^strings'getSubset ; + : displayLink ( $n- ) + swap + "%s" tputs + "%u/article/%d" tputs + ( "n/a" ) "" tputs ; +---reveal--- + : /rss + Content-type: application/rss+xml + "rss" withTemplate + @current dup !this + [ ARTICLES swap toString ^strings'append ^files':R ^files'open + [ getHeader @this displayLink ] sip ^files'close drop this -- ] iterd + "" tputs ; +}} + +: /index + commonHeader + "" tputs + 4 [ + @current @requested "

    Post %d of %d:" tputs space + navbar "

    " tputs + article ARTICLES @requested toString ^strings'append ^files'slurp drop + article tputs + requested -- + ] times + commonFooter ; + +( Define Index ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ) +[ @current !requested /index ] is / + +( Casket Configuration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ) +[ ( -$ ) "/path/to/corpse/directory/" ] is casket:root +[ ( -$ ) "http://corpse/url" ] is casket:url +&getCurrent is doBeforeDispatch +&dispatch is boot + +.s save bye