From 4e5b13cc7b09350d4171fea8c831b0ba65ae645d Mon Sep 17 00:00:00 2001 From: crc Date: Thu, 9 May 2019 13:45:44 +0000 Subject: [PATCH] cleanup publish FossilOrigin-Name: f7a6164f44f6923c9785b92b800c2e13ee9f42cecaa291975ff301bb911d5ae3 --- RELEASE_NOTES.md | 1 + example/publish-examples.forth | 51 +++++++++++++++++++--------------- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index b66d319..b5b8d85 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -35,6 +35,7 @@ July - September window for this release. - add shell.forth - add sqlite3 wrapper - corrected an issue in mail.forth +- cleanup publish-examples.forth ## General diff --git a/example/publish-examples.forth b/example/publish-examples.forth index d414e60..2ce0f86 100755 --- a/example/publish-examples.forth +++ b/example/publish-examples.forth @@ -10,39 +10,44 @@ are stored in `/home/crc/public/examples`. '/home/crc/public/examples/ 'FILE-PATH s:const ~~~ +# Variables + +~~~ +'FID var ~~~ -:unix:count-files (-n) - 'ls_-1_|_wc_-l file:R unix:popen - [ file:read-line s:trim s:to-number ] [ unix:pclose ] bi ; -:unix:for-each-file (q-) - 'ls_-1_-p file:R unix:popen - unix:count-files-in-cwd - [ [ file:read-line s:temp over call ] sip ] times - unix:pclose drop ; +# Support +This word takes a string and provides a flag of `TRUE` if it +ends in `/`, or `FALSE` otherwise. It leaves the string pointer +on the stack. + +~~~ :dir? (s-sf) dup s:length over + n:dec fetch $/ eq? ; ~~~ +# Words To Create The Index + +~~~ +:s:put [ @FID file:write ] s:for-each ; +:css ' + s:put ; +:dtd ' s:put ; +:title 'RETRO_Examples s:put ; +:head ' s:put title css ' s:put ; +:link dup '%s
s:format s:put $. c:put ; +:body ' s:put call ' s:put ; +:make dtd head body ; +~~~ + # Generate index.html ~~~ -FILE-PATH 'index.html s:append file:W file:open 'FID const - -:index:put [ FID file:write ] s:for-each ; - -:css - ' - index:put ; - -:header ' index:put css ; - -:link dup '%s
s:format index:put $. c:put ; - -header -[ dir? &drop &link choose ] unix:for-each-file nl -FID file:close +FILE-PATH 'index.html s:append file:W file:open !FID +[ '

Examples


s:put + [ dir? &drop &link choose ] unix:for-each-file nl ] make +@FID file:close ~~~ # Generate HTML Files