implement publish script
includes data/**.csv tables for building index pages. publish-test/ included for running publish with -x flag.
This commit is contained in:
parent
3f29452b8f
commit
672fd6d0ee
15 changed files with 206 additions and 224 deletions
11
.dev-log
Normal file
11
.dev-log
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
10/12/2023
|
||||||
|
- added resource/index builder to publish script
|
||||||
|
|
||||||
|
4/12/2023
|
||||||
|
- added function to build index source xexpr file for tagged/'tag
|
||||||
|
- fixed tagged/ index source xexpr printing to file so that it can be read
|
||||||
|
|
||||||
|
30/11/2023
|
||||||
|
- added function to build an index source xexpr file for tagged/
|
||||||
|
- have not tested to see if it builds tagged/ properly yet
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
title,link,summary,published,updated
|
title,link,summary,published,updated
|
||||||
|
Beginning LATL,https://sorrel.dev/unsettled/1,beginning the process of thinking through an environment for conlanging and other language shenanigans,2023-12-04T15:20:53
|
|
|
@ -1 +1,3 @@
|
||||||
tags,->
|
tags,->
|
||||||
|
latl,unsettled/1
|
||||||
|
conlang,unsettled/1
|
|
|
@ -1 +1,2 @@
|
||||||
id,headline,description,history->
|
id,headline,description,history->
|
||||||
|
1,Beginning LATL,beginning the process of thinking through an environment for conlanging and other language shenanigans,2023-12-04T15:20:53
|
|
|
@ -1,190 +0,0 @@
|
||||||
(article
|
|
||||||
(h1 "beginning work on LATL")
|
|
||||||
(p
|
|
||||||
"a little introduction to a project i started thinking about in early 2020,
|
|
||||||
as i was learning how to do web development and wanted to try my hand at
|
|
||||||
combining some hobbies.")
|
|
||||||
(section
|
|
||||||
(hgroup
|
|
||||||
(h2 "what even is this?")
|
|
||||||
(p (em "of linguistics and hubris."))
|
|
||||||
(hr))
|
|
||||||
(p
|
|
||||||
"so, when i was a wee little child, i discovered language. i was one of
|
|
||||||
those kids who picked up reading real quick (like before i could form
|
|
||||||
memories) and just have always been fascinated by what those words and
|
|
||||||
symbols do. like, most wee little children discover language, but some
|
|
||||||
wee little children get given the lord of the rings when they're ten or
|
|
||||||
something and get into the narrative and the characters, sure. but
|
|
||||||
those appendices.... there's .. a language here? called quenya? and
|
|
||||||
this tolkien guy just made this up? "
|
|
||||||
(small "this is not in fact how i talked as a child, just go with me."))
|
|
||||||
(p
|
|
||||||
"so, i did the precocious kid thing and said to myself \"if this dead
|
|
||||||
british weirdo (who's like really into the concept of royalty) can
|
|
||||||
make a whole new language, then surely i can to.\"")
|
|
||||||
(p
|
|
||||||
"i did not, in fact, make a language. i made a relex of the language i
|
|
||||||
already spoke (u.s. english,) but we all gotta start somewhere." )
|
|
||||||
(p
|
|
||||||
"for a long time the internet to me was mostly "
|
|
||||||
(a ((href "https://listserv.brown.edu/archives/conlang.html"))
|
|
||||||
"the brown university conlang listserv.")
|
|
||||||
" here i learned about different phonology, what the heck
|
|
||||||
morphosyntactic alignment is, diachronicity and how different
|
|
||||||
languages can be related. i got exposed to awkwords and sca2 (tools
|
|
||||||
for generating words and modeling changes to those words.) but i
|
|
||||||
never interacted with ppl much. i was a kid and the ppl in there
|
|
||||||
really knew their stuff, and i never much felt comfy with the idea
|
|
||||||
of being just "
|
|
||||||
(em "in public") " on the internet like that.")
|
|
||||||
(p
|
|
||||||
"anyway i got better at making languages and learning about how
|
|
||||||
language works, and it's just been a (at times more consistent, at
|
|
||||||
times less) hobby of mine for most of my life.")
|
|
||||||
(p
|
|
||||||
"flash forward to a few years ago, i'm working on a language that has
|
|
||||||
turned into the passion language that i've spend the majority of my
|
|
||||||
conlanging on and i'm getting frustrated with my tools. i want to do
|
|
||||||
more complex, phonological-feature-aware, sound change rules; i want
|
|
||||||
a tighter feedback loop; i want to see how a derivational pattern at
|
|
||||||
one stage in a parent form of a language branches out or collapses
|
|
||||||
into different derivational patterns in a child language.")
|
|
||||||
(p
|
|
||||||
"all was not well in my conlanging.")
|
|
||||||
(p
|
|
||||||
"i would need to " (strong "do some programming."))
|
|
||||||
(p
|
|
||||||
"the thing is, i had just learned javascript. (it was a tech bootcamp.
|
|
||||||
someday i'll talk about what a horrible decision that was, but not
|
|
||||||
in this post.) i had built a few little toy web apps, and i was not
|
|
||||||
ready to execute on a vision for a multi-purpose conlanging tool that
|
|
||||||
was beginning to take shape in my head.")
|
|
||||||
(p "i tried anyway.")
|
|
||||||
(p "and i made "
|
|
||||||
(a ((href "https://sorrelbri.github.io/feature-change-applier/"))
|
|
||||||
"a bad first draft of a sound change tool."))
|
|
||||||
(p
|
|
||||||
"there's an ebnf grammar in that project somewhere! the hubris i
|
|
||||||
had then, to think i could make a little javascript-backed
|
|
||||||
language tool with all of the bells and whistles i needed! with
|
|
||||||
the knowledge that i had then! (or more accurately, didn't have)")
|
|
||||||
(br)
|
|
||||||
(p "but now..."))
|
|
||||||
(section
|
|
||||||
(hgroup
|
|
||||||
(h2 "reviving this project")
|
|
||||||
(p (em "whatcha gonna do sorrel?"))
|
|
||||||
(hr))
|
|
||||||
(p "i'm still not ready.")
|
|
||||||
(p
|
|
||||||
"but at least, today i'm forgoing bells and whistles for
|
|
||||||
execution models. core abstractions. experience using "
|
|
||||||
(a ((href "https://racket-lang.org"))
|
|
||||||
"a (programming) language-oriented programming language")
|
|
||||||
" maybe. there's a lot to think about.")
|
|
||||||
(p
|
|
||||||
"so, i'm going to try reviving this project. or, more accurately,
|
|
||||||
reimagining this project. from the little sound change tool that
|
|
||||||
was merely an unusably buggy iteration on tools that other
|
|
||||||
conlangers had executed better, to a more robust environment for
|
|
||||||
conlanging. one which gives language nerds the power to solve
|
|
||||||
all of their language nerding problems in one runtime, with an
|
|
||||||
extensible and reflective interface. and which is written in such
|
|
||||||
a way, with the appropriate abstractions, that lanuage nerdy
|
|
||||||
hackers can hack their own tools on top of it.")
|
|
||||||
(p
|
|
||||||
"and i'm going to be doing "
|
|
||||||
(a ((href "https://www.recurse.com/"))
|
|
||||||
"a hecking hacking retreat")
|
|
||||||
" about it. i'll spend some full time programming making a goofy
|
|
||||||
little thing for goofy little language nerds surrounded by
|
|
||||||
goofy programming nerds doing whatever rad things they happen
|
|
||||||
to be getting up to when i happen to be there.")
|
|
||||||
(p
|
|
||||||
"like many of the communities i am a part of, i am a quiet part of
|
|
||||||
the conlanging community. so, we'll see how this goes. maybe it
|
|
||||||
is only ever something of interest to me and the conlangers i
|
|
||||||
interact with in meatspace. maybe it only teaches me some things
|
|
||||||
about designing and building a tool of the type that i'm designing
|
|
||||||
and building. hoooopefully it is helpful in a way to other
|
|
||||||
conlangers such that it evolves beyond what i could do on
|
|
||||||
my own (cause i ain't no whiz kid 10x programmer.)")
|
|
||||||
(p
|
|
||||||
"but that's all me getting ahead of myself (as is often my wont.)
|
|
||||||
first! to pack for the trip!"))
|
|
||||||
(section
|
|
||||||
(hgroup
|
|
||||||
(h2 "packing for the trip")
|
|
||||||
(p (em "a biggg heap of things to expand"))
|
|
||||||
(hr))
|
|
||||||
(p
|
|
||||||
"i'm just gonna fly right through these. there's going to be a lot
|
|
||||||
to read up on, to explore, to think and talk through, before it
|
|
||||||
gets time to prototyping and to building a workable tool. so,
|
|
||||||
here's the very start of the thinking-in-public. each of these
|
|
||||||
little thoughts is going to get at least it's own writeup (if not
|
|
||||||
several) and i'll update with additional sections and links to
|
|
||||||
the writeups as i go.")
|
|
||||||
(section
|
|
||||||
(h3 "notes on the goals")
|
|
||||||
(p
|
|
||||||
"it's good to have goals! to define what it even is yr tring to
|
|
||||||
do. so here's my attempt. my goal is to create a foss+ working
|
|
||||||
runtime that *can* serve as a singular tool for conlangers with
|
|
||||||
some basic programming capacity. it should be linguistically
|
|
||||||
*theory neutral* to the extant that such a thing is possible.
|
|
||||||
it should allow for the definition of all relevant structures
|
|
||||||
of a language *in code* and support the construction of grammars,
|
|
||||||
dictionaries, text documents and (stretch goal) non-programmer
|
|
||||||
friendly tools *from code*. it should support phonological,
|
|
||||||
lexical, syntactic, morphological, semantic, etc transformations
|
|
||||||
across different \"epochs\" be they diachronic or synchronic.
|
|
||||||
these transformations should work on transformations, ie
|
|
||||||
morphological transformations should themselves be transformed
|
|
||||||
by phonological transformations. users of the tool should be
|
|
||||||
able to edit their work and see the consequences of their changes
|
|
||||||
quickly. hopefully, this can all happen on the web, i guess,
|
|
||||||
cause ppl like using their browser as the everything app. ")
|
|
||||||
(section
|
|
||||||
(h3 "notes on existing tools")
|
|
||||||
(p
|
|
||||||
"i'm going to talk a bunch about existing tools made by
|
|
||||||
conlangers or made for professional linguists and used by
|
|
||||||
conlangers or just yr regular old spreedsheets and such. i'm
|
|
||||||
going to be doing some research about how conlangers do their
|
|
||||||
conlanging, lest this truly be a just-for-me type project."))
|
|
||||||
(section
|
|
||||||
(h3 "notes on primitives")
|
|
||||||
(p
|
|
||||||
"i think some interesting things start to bubble out of some of
|
|
||||||
those goals up there. like the idea of supporting a bunch of
|
|
||||||
different kinds of transformations that should themselves be
|
|
||||||
transformable. the primitives we're working with have to work
|
|
||||||
below the level of \"lexeme\" or \"phoneme\" to have something
|
|
||||||
abstract that can apply to both. i'm not going to get into
|
|
||||||
specifics even a little bit at this point-you'll have to stay
|
|
||||||
tuned for more.")))
|
|
||||||
(section
|
|
||||||
(h3 "notes on execution model"))
|
|
||||||
(section
|
|
||||||
(h3 "notes on reflectivity and interaction"))
|
|
||||||
(section
|
|
||||||
(h3 "notes on portability"))
|
|
||||||
(section
|
|
||||||
(h3 "notes on the substratum (racket?)")))
|
|
||||||
(section
|
|
||||||
(hgroup
|
|
||||||
(h2 "about the name")
|
|
||||||
(p (em "it's pronouced ˈlæ.ɾɫ̩"))
|
|
||||||
(hr))
|
|
||||||
(p
|
|
||||||
"i don't know dude, naming things is hard. it's a working name,
|
|
||||||
it works good as an extension. "
|
|
||||||
(code "my-conlang.latl") "anyone?")
|
|
||||||
(p
|
|
||||||
"i also just like syllabic laterals? they sound neat to me. the
|
|
||||||
official initialism is _l_inguistic _a_nalytic _t_ransformation
|
|
||||||
_l_anguage, but it also double entendres to _l_ower _a_nterior
|
|
||||||
_t_emporal _l_obe, so that's just kind of fun.")
|
|
||||||
(p "maybe it'll have a different name some day, idk")))
|
|
|
@ -1,5 +1,21 @@
|
||||||
title,link,summary,published,updated
|
title,link,summary,published,updated
|
||||||
beginning latl,https://sorrel.dev/unsettled/5,beginning the process of thinking through an environment for conlanging and other language shenanigans,2023-11-08T22:49:41
|
Beginning LATL,https://sorrel.dev/unsettled/5,beginning the process of thinking through an environment for conlanging and other language shenanigans,2023-12-10T18:10:33
|
||||||
beginning latl,https://sorrel.dev/unsettled/5,beginning the process of thinking through an environment for conlanging and other language shenanigans,2023-11-08T22:41:52
|
Beginning LATL,https://sorrel.dev/unsettled/4,beginning the process of thinking through an environment for conlanging and other language shenanigans,2023-12-10T18:04:27
|
||||||
beginning latl,https://sorrel.dev/unsettled/5,beginning the process of thinking through an environment for conlanging and other language shenanigans,2023-11-08T22:41:24
|
Beginning LATL,https://sorrel.dev/unsettled/3,beginning the process of thinking through an environment for conlanging and other language shenanigans,2023-12-10T18:03:38
|
||||||
beginning latl,https://sorrel.dev/unsettled/5,beginning the process of thinking through an environment for conlanging and other language shenanigans,2023-11-08T15:51:25
|
Beginning LATL,https://sorrel.dev/unsettled/2,beginning the process of thinking through an environment for conlanging and other language shenanigans,2023-12-10T18:00:09
|
||||||
|
Beginning LATL,https://sorrel.dev/unsettled/1,beginning the process of thinking through an environment for conlanging and other language shenanigans,2023-12-10T17:55:06
|
||||||
|
Beginning LATL,https://sorrel.dev/unsettled/20,beginning the process of thinking through an environment for conlanging and other language shenanigans,2023-12-04T17:02:06
|
||||||
|
Beginning LATL,https://sorrel.dev/unsettled/5,beginning the process of thinking through an environment for conlanging and other language shenanigans,2023-12-04T15:46:40
|
||||||
|
Beginning LATL,https://sorrel.dev/unsettled/5,beginning the process of thinking through an environment for conlanging and other language shenanigans,2023-12-04T15:45:04
|
||||||
|
Beginning LATL,https://sorrel.dev/unsettled/5,beginning the process of thinking through an environment for conlanging and other language shenanigans,2023-12-04T15:43:16
|
||||||
|
Beginning LATL,https://sorrel.dev/unsettled/5,beginning the process of thinking through an environment for conlanging and other language shenanigans,2023-12-04T15:43:05
|
||||||
|
Beginning LATL,https://sorrel.dev/unsettled/5,beginning the process of thinking through an environment for conlanging and other language shenanigans,2023-12-04T15:42:53
|
||||||
|
Beginning LATL,https://sorrel.dev/unsettled/5,beginning the process of thinking through an environment for conlanging and other language shenanigans,2023-12-04T15:42:38
|
||||||
|
Beginning LATL,https://sorrel.dev/unsettled/5,beginning the process of thinking through an environment for conlanging and other language shenanigans,2023-12-04T15:41:35
|
||||||
|
Beginning LATL,https://sorrel.dev/unsettled/5,beginning the process of thinking through an environment for conlanging and other language shenanigans,2023-12-04T15:33:48
|
||||||
|
Beginning LATL,https://sorrel.dev/unsettled/5,beginning the process of thinking through an environment for conlanging and other language shenanigans,2023-12-04T15:33:38
|
||||||
|
Beginning LATL,https://sorrel.dev/unsettled/5,beginning the process of thinking through an environment for conlanging and other language shenanigans,2023-12-04T15:30:23
|
||||||
|
Beginning LATL,https://sorrel.dev/unsettled/5,beginning the process of thinking through an environment for conlanging and other language shenanigans,2023-12-04T15:29:59
|
||||||
|
Beginning LATL,https://sorrel.dev/unsettled/5,beginning the process of thinking through an environment for conlanging and other language shenanigans,2023-12-04T15:29:48
|
||||||
|
Beginning LATL,https://sorrel.dev/unsettled/5,beginning the process of thinking through an environment for conlanging and other language shenanigans,2023-12-04T15:26:45
|
||||||
|
Beginning LATL,https://sorrel.dev/unsettled/5,beginning the process of thinking through an environment for conlanging and other language shenanigans,2023-12-04T15:26:23
|
|
|
@ -1,2 +1 @@
|
||||||
id,headline,description,history->
|
id,headline,description,history->
|
||||||
this,this website's internals,how i built this website and why i built it the way i did
|
|
||||||
|
|
|
|
@ -1,3 +1 @@
|
||||||
id,headline,description,history->
|
id,headline,description,history->
|
||||||
1,fca,the feature change applier i built as a baby developer
|
|
||||||
2,latl proto-prototype,a first pass at proving some ideas for latl
|
|
||||||
|
|
|
|
@ -1,4 +1 @@
|
||||||
tags,->
|
tags,->,
|
||||||
latl,unsettled/5,unsettled/5,unsettled/5,settled/2,unsettled/3,settled/1,unsettled/2,unsettled/1
|
|
||||||
conlang,unsettled/5,unsettled/5,unsettled/5,unsettled/3,unsettled/1
|
|
||||||
brain,unsettled/4
|
|
||||||
|
|
|
|
@ -2,4 +2,4 @@ id,headline,description
|
||||||
1,beginning latl,an introduction to a project focused on linguistics and conlanging
|
1,beginning latl,an introduction to a project focused on linguistics and conlanging
|
||||||
2,evaluation models,working through possible evaluation models for latl
|
2,evaluation models,working through possible evaluation models for latl
|
||||||
3,existing conlanging tools,an overview of some tools that are out there for conlanging (and legit lingustics)
|
3,existing conlanging tools,an overview of some tools that are out there for conlanging (and legit lingustics)
|
||||||
4,a note about brains,so i've got some diagnoses and some experiences and some notes
|
4,a note about brains,so i've got some diagnoses and some experiences and some notes
|
||||||
|
|
|
|
@ -1,5 +1 @@
|
||||||
id,headline,description,history->
|
id,headline,description,history->
|
||||||
1,beginning latl,an introduction to a project focused on linguistics and conlanging
|
|
||||||
2,evaluation models,working through possible evaluation models for latl
|
|
||||||
3,existing conlanging tools,an overview of some tools that are out there for conlanging (and legit lingustics)
|
|
||||||
4,a note about brains,so i've got some diagnoses and some experiences and some notes
|
|
||||||
|
|
|
138
publish.rkt
138
publish.rkt
|
@ -1,6 +1,6 @@
|
||||||
#lang cli
|
#lang cli
|
||||||
|
|
||||||
(require (only-in racket/string non-empty-string? string-replace string-split)
|
(require (only-in racket/string non-empty-string? string-prefix? string-replace string-split)
|
||||||
(only-in racket/date current-date date->string date-display-format)
|
(only-in racket/date current-date date->string date-display-format)
|
||||||
(only-in racket/format ~a)
|
(only-in racket/format ~a)
|
||||||
(only-in racket/list append* first second third fourth fifth rest flatten add-between take)
|
(only-in racket/list append* first second third fourth fifth rest flatten add-between take)
|
||||||
|
@ -29,18 +29,18 @@
|
||||||
;; publish -input-file in-progress/beginning-latl.txt --resource-type unsettled --tags latl,conlang \
|
;; publish -input-file in-progress/beginning-latl.txt --resource-type unsettled --tags latl,conlang \
|
||||||
;; --headline "Beginning LATL" --description "beginning the process of thinking through an environment \
|
;; --headline "Beginning LATL" --description "beginning the process of thinking through an environment \
|
||||||
;; for conlanging and other language shenanigans"
|
;; for conlanging and other language shenanigans"
|
||||||
;; publish -i in-progress/beginning-latl.txt -r unsettled -t latl,conlang -l "Beginning LATL" -d "beginning the process of thinking through an environment for conlanging and other language shenanigans"
|
;; publish -i in-progress/beginning-latl.txt -r unsettled -t latl,conlang -l "Beginning LATL" \
|
||||||
|
;; -d "beginning the process of thinking through an environment for conlanging and other language shenanigans"
|
||||||
(help (usage "Publish is here to put yr posts together."))
|
(help (usage "Publish is here to put yr posts together."))
|
||||||
|
|
||||||
|
|
||||||
(flag (resource-type #:param [resource-type ""] t)
|
(flag (resource-type #:param [resource-type ""] t)
|
||||||
("-r" "--resource-type" "Type of resource [settled|unsettled|root]")
|
("-r" "--resource-type" "Type of resource [settled|unsettled|root]")
|
||||||
(resource-type (begin
|
(resource-type (cond
|
||||||
(cond
|
[(equal? t "settled") "settled"]
|
||||||
[(equal? t "settled") "settled"]
|
[(equal? t "unsettled") "unsettled"]
|
||||||
[(equal? t "unsettled") "unsettled"]
|
[(equal? t "root") "root"]
|
||||||
[(equal? t "root") "root"]
|
[else (error 'failed "couldn't recognize resource. please use one of 'settled' 'unsettled' 'root'")])))
|
||||||
[else (error 'failed "couldn't recognize resource. please use one of 'settled' 'unsettled' 'root'")]))))
|
|
||||||
|
|
||||||
(flag (tags #:param [tags ""] t)
|
(flag (tags #:param [tags ""] t)
|
||||||
("-t" "--tags" "Tags to apply to resource")
|
("-t" "--tags" "Tags to apply to resource")
|
||||||
|
@ -99,9 +99,90 @@
|
||||||
|
|
||||||
(define (archive-file i x)
|
(define (archive-file i x)
|
||||||
(if x
|
(if x
|
||||||
(copy-file i (string-replace i "in-progress" "publish-test/archive"))
|
(copy-file i (string-replace i "in-progress" "publish-test/archive") #t)
|
||||||
(rename-file-or-directory i (string-replace i "in-progress" "archive"))))
|
(rename-file-or-directory i (string-replace i "in-progress" "archive"))))
|
||||||
|
|
||||||
|
(define (write-new-tagged/index tag-table #:test [x #f])
|
||||||
|
(displayln "write-new-tagged/index")
|
||||||
|
(let* ([tags (rest (map (lambda (row) (first row))
|
||||||
|
tag-table))]
|
||||||
|
[make-index (read (open-input-file "source/make-index.txt"))]
|
||||||
|
[new-index ((eval make-index ns) "tagged" tags)]
|
||||||
|
[handle (path-add-extension (if x
|
||||||
|
(build-path "publish-test" "source" "tagged" "index")
|
||||||
|
(build-path "source" "tagged" "index"))
|
||||||
|
".txt")]
|
||||||
|
[file (open-output-file handle #:exists 'replace)])
|
||||||
|
(if (port-try-file-lock? file 'exclusive)
|
||||||
|
(begin
|
||||||
|
(print new-index file)
|
||||||
|
(port-file-unlock file)
|
||||||
|
(close-output-port file))
|
||||||
|
(error "couldn't obtain file lock on ~a" file))))
|
||||||
|
|
||||||
|
(define (write-new-tagged/tag/index tag-table-row post-lookup #:test [x #f])
|
||||||
|
(displayln "write-new-tagged/tag/index")
|
||||||
|
(define (make-resource-lookup resource test)
|
||||||
|
(let ([res-table (csv->list(open-input-file
|
||||||
|
(path-add-extension
|
||||||
|
(if x
|
||||||
|
(build-path "publish-test" "data" resource)
|
||||||
|
(build-path "data" resource))
|
||||||
|
#".csv")))]
|
||||||
|
[res-lookup (make-weak-hash)])
|
||||||
|
(for-each (lambda (post)
|
||||||
|
(hash-set! res-lookup (first post) post))
|
||||||
|
(rest res-table))
|
||||||
|
res-lookup))
|
||||||
|
(define (get-post-data lookup/id r-lookup p-lookup test)
|
||||||
|
(let* ([r/id (string-split lookup/id "/")]
|
||||||
|
[resource (first r/id)]
|
||||||
|
[id (second r/id)])
|
||||||
|
(if (hash-has-key? r-lookup resource)
|
||||||
|
(let ([post-data (hash-ref (hash-ref r-lookup resource) id)])
|
||||||
|
(hash-set! p-lookup r/id post-data)
|
||||||
|
post-data)
|
||||||
|
(let ([res-lookup (make-resource-lookup resource test)])
|
||||||
|
(hash-set! r-lookup resource res-lookup)
|
||||||
|
(hash-set! p-lookup r/id (hash-ref res-lookup id))
|
||||||
|
(hash-ref p-lookup r/id)))))
|
||||||
|
(let* ([tag (first tag-table-row)]
|
||||||
|
[resources (make-weak-hash)]
|
||||||
|
[posts (map (lambda (lookup/id)
|
||||||
|
(if (hash-has-key? post-lookup lookup/id)
|
||||||
|
(hash-ref post-lookup lookup/id)
|
||||||
|
(get-post-data lookup/id resources post-lookup x)))
|
||||||
|
(filter non-empty-string? (rest tag-table-row)))]
|
||||||
|
[make-index (read (open-input-file "source/make-index.txt"))]
|
||||||
|
[new-index ((eval make-index ns) (~a "tagged/" tag) posts)]
|
||||||
|
[handle (path-add-extension (if x
|
||||||
|
(build-path "publish-test" "source" "tagged" (first tag-table-row))
|
||||||
|
(build-path "source" "tagged" tag))
|
||||||
|
#".txt")]
|
||||||
|
[file (open-output-file handle #:exists 'replace)])
|
||||||
|
(if (port-try-file-lock? file 'exclusive)
|
||||||
|
(begin
|
||||||
|
(print new-index file)
|
||||||
|
(port-file-unlock file)
|
||||||
|
(close-output-port file))
|
||||||
|
(error "couldn't obtain file lock on ~a" file))))
|
||||||
|
|
||||||
|
|
||||||
|
(define (write-new-resource/index resource resource-table #:test [x #f])
|
||||||
|
(displayln "write-new-resource/index")
|
||||||
|
(let* ([make-index (read (open-input-file "source/make-index.txt"))]
|
||||||
|
[new-index ((eval make-index ns) resource (rest resource-table))]
|
||||||
|
[handle (path-add-extension (if x
|
||||||
|
(build-path "publish-test" "source" resource "index")
|
||||||
|
(build-path "source" resource "index"))
|
||||||
|
#".txt")]
|
||||||
|
[file (open-output-file handle #:exists 'replace)])
|
||||||
|
(if (port-try-file-lock? file 'exclusive)
|
||||||
|
(begin
|
||||||
|
(print new-index file)
|
||||||
|
(port-file-unlock file)
|
||||||
|
(close-output-port file))
|
||||||
|
(error "couldn't obtain file lock on ~a" file))))
|
||||||
|
|
||||||
;; takes a parsed table as a list of lists and formats for writing as a .csv file
|
;; takes a parsed table as a list of lists and formats for writing as a .csv file
|
||||||
(define (list->csv l)
|
(define (list->csv l)
|
||||||
|
@ -193,7 +274,7 @@
|
||||||
(write-csv-to-file (list->csv new-res-table)
|
(write-csv-to-file (list->csv new-res-table)
|
||||||
(path-add-extension
|
(path-add-extension
|
||||||
(if x
|
(if x
|
||||||
(build-path "publish-test" "data" (~a r "x"))
|
(build-path "publish-test" "data" r)
|
||||||
(build-path "data" r))
|
(build-path "data" r))
|
||||||
#".csv"))
|
#".csv"))
|
||||||
|
|
||||||
|
@ -202,8 +283,30 @@
|
||||||
(define tag-table (csv->list (open-input-file
|
(define tag-table (csv->list (open-input-file
|
||||||
(if x "publish-test/data/tagged.csv" "data/tagged.csv"))))
|
(if x "publish-test/data/tagged.csv" "data/tagged.csv"))))
|
||||||
(define new-tag-table (write-new-tag-table tag-table t r res-id))
|
(define new-tag-table (write-new-tag-table tag-table t r res-id))
|
||||||
|
;; update tagged/index if needed
|
||||||
|
(if (eq? (length new-tag-table) (length tag-table))
|
||||||
|
'continue
|
||||||
|
(if x
|
||||||
|
(write-new-tagged/index new-tag-table #:test #t)
|
||||||
|
(write-new-tagged/index new-tag-table)))
|
||||||
|
; (displayln new-tag-table)
|
||||||
(write-csv-to-file (list->csv new-tag-table)
|
(write-csv-to-file (list->csv new-tag-table)
|
||||||
(if x "publish-test/data/tagged.csv" "data/tagged.csv"))
|
(if x "publish-test/data/tagged.csv" "data/tagged.csv"))
|
||||||
|
|
||||||
|
|
||||||
|
;; update tagged/'tag for each tag
|
||||||
|
(for-each
|
||||||
|
(lambda (tt-row)
|
||||||
|
;; post-lookup is a hash-table of (resource/id . post-info) where post-info is (id headline description history ...)
|
||||||
|
(let ([post-lookup (make-weak-hash)]
|
||||||
|
[tt-tag (first tt-row)])
|
||||||
|
(if (member tt-tag t)
|
||||||
|
;; rewrite tagged/'tag
|
||||||
|
(if x
|
||||||
|
(write-new-tagged/tag/index tt-row post-lookup #:test #t)
|
||||||
|
(write-new-tagged/tag/index tt-row post-lookup))
|
||||||
|
'())))
|
||||||
|
new-tag-table)
|
||||||
|
|
||||||
|
|
||||||
;; write to file
|
;; write to file
|
||||||
|
@ -214,6 +317,9 @@
|
||||||
(close-output-port out))
|
(close-output-port out))
|
||||||
(error "couldn't obtain file lock on ~a" out))
|
(error "couldn't obtain file lock on ~a" out))
|
||||||
|
|
||||||
|
;; update 'resource/index
|
||||||
|
(write-new-resource/index r new-res-table #:test (if x #t #f))
|
||||||
|
|
||||||
|
|
||||||
;; update feed table
|
;; update feed table
|
||||||
(define atom-table (csv->list
|
(define atom-table (csv->list
|
||||||
|
@ -230,7 +336,7 @@
|
||||||
|
|
||||||
|
|
||||||
;; update feed.atom
|
;; update feed.atom
|
||||||
|
;; for now, this does not include the html for the post, only a link
|
||||||
(define feed ((eval (read (open-input-file (if x
|
(define feed ((eval (read (open-input-file (if x
|
||||||
"publish-test/data/make-atom.txt"
|
"publish-test/data/make-atom.txt"
|
||||||
"data/make-atom.txt"))) ns)
|
"data/make-atom.txt"))) ns)
|
||||||
|
@ -241,6 +347,7 @@
|
||||||
(define feed-out
|
(define feed-out
|
||||||
(open-output-file (if x "publish-test/source/feed.atom"
|
(open-output-file (if x "publish-test/source/feed.atom"
|
||||||
"source/feed.atom")
|
"source/feed.atom")
|
||||||
|
;; need to remove this and just replace once testing is done
|
||||||
#:exists (if x 'replace 'error)))
|
#:exists (if x 'replace 'error)))
|
||||||
(if (port-try-file-lock? feed-out 'exclusive)
|
(if (port-try-file-lock? feed-out 'exclusive)
|
||||||
(begin
|
(begin
|
||||||
|
@ -258,4 +365,11 @@
|
||||||
|
|
||||||
(displayln "publish was successful")))
|
(displayln "publish was successful")))
|
||||||
|
|
||||||
(run publish)
|
;;; (run publish)
|
||||||
|
|
||||||
|
(run publish #("-i" "in-progress/beginning-latl.txt"
|
||||||
|
"-r" "unsettled"
|
||||||
|
"-t" "latl,conlang"
|
||||||
|
"-l" "Beginning LATL"
|
||||||
|
"-d" "beginning the process of thinking through an environment for conlanging and other language shenanigans"
|
||||||
|
"-x"))
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
;; if res is tagged, build index of tags
|
;; if res is tagged, build index of tags
|
||||||
[(equal? res "tagged")
|
[(equal? res "tagged")
|
||||||
'(hgroup (h1 "all the tags")
|
'(hgroup (h1 "all the tags")
|
||||||
(p (em "you looking for a flavor of something?")))]
|
(p (em "a categorical mess for your perusal")))]
|
||||||
[(string-prefix? res "tagged/")
|
[(string-prefix? res "tagged/")
|
||||||
(let ([tag (string-replace res "tagged/" "#")])
|
(let ([tag (string-replace res "tagged/" "#")])
|
||||||
`(hgroup (h1 ,(~a "stuff what's tagged like \"~a\"" tag))
|
`(hgroup (h1 ,(~a "stuff what's tagged like \"~a\"" tag))
|
||||||
|
@ -34,16 +34,16 @@
|
||||||
,(~a "go! to " (second post) " page")))))
|
,(~a "go! to " (second post) " page")))))
|
||||||
(define (tag-post post)
|
(define (tag-post post)
|
||||||
`((div ((class "post-preview"))
|
`((div ((class "post-preview"))
|
||||||
(h4 ,(second post))
|
(h4 ,(~a post))
|
||||||
(p ,(third post))
|
(p ,(~a "posts about " post))
|
||||||
(a ((href ,(~a "/tagged/" (first post))))
|
(a ((href ,(~a "/tagged/" post)))
|
||||||
,(~a "go! to " (second post) " page")))))
|
,(~a "go! to " post " page")))))
|
||||||
(define (tagged-post post)
|
(define (tagged-post post)
|
||||||
`((div ((class "post-preview"))
|
`((div ((class "post-preview"))
|
||||||
(h4 ,(second post))
|
(h4 ,(second post))
|
||||||
(p ,(third post))
|
(p ,(third post))
|
||||||
;; tagged posts will insert href instead of id
|
;; tagged posts will insert href instead of id
|
||||||
(a ((href ,first post))
|
(a ((href ,(first post)))
|
||||||
,(~a "go! to " (second post) " page")))))
|
,(~a "go! to " (second post) " page")))))
|
||||||
|
|
||||||
|
|
||||||
|
|
34
source/root/index.txt
Normal file
34
source/root/index.txt
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
(article
|
||||||
|
(noscript
|
||||||
|
(span
|
||||||
|
((class "noscript"))
|
||||||
|
(p "hey! yr not letting yr browser execute javascript served by my page.")
|
||||||
|
(p "that's cool!")
|
||||||
|
(p "browser (by google?) as arbitrary code execution platform is one of the
|
||||||
|
weird, regrettable (at least as it is currently implemented)
|
||||||
|
consequences of our political economy.")
|
||||||
|
(p "anyway, feel free to browse! yr experience won't be much different,
|
||||||
|
you'll just get bigger html blob.")
|
||||||
|
(p "the only js i deliver is "
|
||||||
|
(a ((href "https://htmx.org"))
|
||||||
|
"this little REST tool called htmx")
|
||||||
|
" if you want to see what that's about.")
|
||||||
|
(p "o! and if you want to hear/read "
|
||||||
|
(a ((href "/tagged/javascript"))
|
||||||
|
"what i have to say about javascript")
|
||||||
|
" you could do that maybe")
|
||||||
|
(p "/noscript")))
|
||||||
|
(p "hey! i'm sorrel.")
|
||||||
|
(p "(called like the plant up there)")
|
||||||
|
(p "this is my new-fangled website computer page on the world wide web. i had
|
||||||
|
a nice time building this little thing "
|
||||||
|
(span ((class "hx-target"))
|
||||||
|
(a ((href "/this")
|
||||||
|
(hx-get "/hx/this")
|
||||||
|
(hx-target "closest span")
|
||||||
|
(hx-swap "innerHTML"))
|
||||||
|
"(how i build this little page.)")))
|
||||||
|
(p " i hope you have a nice time looking at things here.")
|
||||||
|
(p ((class "ascii but-normal-size"))
|
||||||
|
"︿︿
|
||||||
|
〰"))
|
3
source/root/not-found.txt
Normal file
3
source/root/not-found.txt
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
(section
|
||||||
|
(h1 "404")
|
||||||
|
(p "hey, i couldn't find that. could ya try something else maybe?"))
|
Loading…
Reference in a new issue