! Copyright (C) 2026 CapitalEx. ! See https://factorcode.org/license.txt for BSD license. USING: assocs calendar calendar.format concurrency.combinators io.encodings.utf8 io.files kernel make math.parser sequences splitting unicode ; IN: email-archives : post-date ( json -- ymdhms ) "postDate" of dup [ dec> unix-time>timestamp timestamp>ymdhms ] [ drop "[DATE MISSING]" ] if ; : build-subject ( json -- json ) dup "
" %
"messageBody" of %
"\n" % ;
: build-message-seq ( json -- )
[ build-message ] each ;
: build-page ( json -- )
build-subject
build-message-seq ;
: only-alphaspace ( str -- str )
[ [ alpha? ] [ blank? ] bi or ] filter ;
: spaces>dashes ( str -- str )
" " "-" replace ;
: add-location ( str -- str )
"/home/exarch/Documents/zz-concatenative-archives/" prepend
".html" append ;
: title>filename ( json -- title )
first [ post-date ] [ "subject" of >lower ] bi "-" glue
only-alphaspace
spaces>dashes
add-location ;
: make-page ( json -- html name )
dup [ build-page ] "" make swap title>filename ;
: write-page ( json -- )
make-page utf8 set-file-contents ;
: write-page-seq ( seq -- )
[ write-page ] parallel-each ;
: make-listing ( pair -- )
first2 "