change .txt to .scm in source files

allows git forge to recognize source as sexprs
This commit is contained in:
sorrel 2024-01-21 17:56:40 -05:00
parent eccbd26ac0
commit 4982e32350
32 changed files with 53 additions and 29 deletions

View file

@ -1,3 +1,15 @@
2024/01/21
- .txt -> .scm for better source viewing in git forge
START HERE:
- pick a license
- fix footer styling (tagged section is cramped with flex-row
especially on mobile)
- add view source link to every page (git forge of source/resource
not static/resource; we're here for the sexprs)
TODO:
- refactor publish script for atomic, idempotent execution (follow
rollback thunk + compose accumulator pattern in modify script)
2024/01/17
- add html cache directories to build script
TODO:

View file

@ -1,4 +1,16 @@
21/12/2023
2023/01/19
- published about posts linked from index page
- published beginning-latl
- in-progress
- links ?
- to write next
- conlanging-tools
- fca (latl first attempt)
- latl-primitives
- syntax-considered-harmful ? (playful)
- (l)ddd (living)-documentation-driven-development ? (playful)
2023/12/21
- beginning latl effectively finished and ready for post once ci is fixed
- projects to write about
- input-messenger

View file

@ -23,12 +23,12 @@
;; this will not! (for now) update the <resource>/index or tagged/<tag>/index pages !
;; (these pages do not currently show post history)
;; - update the atom.txt feed
;; - update the atom table and rebuild the atom feed
;; example
;; modify -input-file in-progress/beginning-latl.txt --resource-type unsettled
;; modify -input-file in-progress/beginning-latl.scm --resource-type unsettled
;; --headline "Beginning LATL"
;; publish -i in-progress/beginning-latl.txt -r unsettled -l "Beginning LATL"
;; publish -i in-progress/beginning-latl.scm -r unsettled -l "Beginning LATL"
(help (usage "modify is here to update existing posts with new content."))
@ -87,7 +87,7 @@
(if x-test
(build-path "publish-test" "source" r-type l-head)
(build-path "source" r-type l-head)))
#".txt")])
#".scm")])
(values
(open-input-file file-handle)
(open-output-file file-handle #:exists 'update))))
@ -128,14 +128,14 @@
(open-input-file file-handle)
(open-output-file file-handle #:exists 'update))))
;; get make-atom.txt input-port
;; get make-atom.scm input-port
;; (. -> . input-port?)
(define (get-make-atom-input-port)
(let ([file-handle (path-add-extension
(if x-test
(build-path "publish-test" "data" "make-atom")
(build-path "data" "make-atom"))
#".txt")])
#".scm")])
(open-input-file file-handle)))
@ -249,7 +249,7 @@
;; replace resource in source/<type>/id
(define (append-post-footer post-xexpr tag-list history-list)
(let ([post-footer
(read (open-input-file "source/post-footer.txt"))])
(read (open-input-file "source/post-footer.scm"))])
`(body
,post-xexpr
,((eval post-footer ns) tag-list history-list))))

View file

@ -32,7 +32,7 @@
(list content)))
;; bound path builders
;; extension is always #".txt" because source files are not well-formed racket,
;; extension is always #".scm" because source files are not racket,
;; but must be read and evaluated in this namespace
(define (make-path-no-param root-folder extension)
(lambda (t)
@ -62,10 +62,10 @@
extension)))
(define (make-source-path-no-param t)
((make-path-no-param "source" #".txt") t))
((make-path-no-param "source" #".scm") t))
(define (make-source-path-id-param t id)
((make-path-id-param "source" #".txt") t id))
((make-path-id-param "source" #".scm") t id))
(define (make-static-path-no-param api-type t)
(let ([root-folder
@ -156,7 +156,7 @@
(html-response
(if (file-exists? static-path)
(static-file-res static-path)
(xexpr-file->res "source/not-found.txt" (write-static-file static-path))))))
(xexpr-file->res "source/not-found.scm" (write-static-file static-path))))))
(define-values (httpx-app reverse-httpx-uri)
@ -181,9 +181,9 @@
(define (fragment->page resource)
(xexpr->string
`(html ((lang "en"))
,(read (open-input-file "source/head.txt"))
,(read (open-input-file "source/head.scm"))
(body
,(read (open-input-file "source/header.txt"))
,(read (open-input-file "source/header.scm"))
(main ,(read (open-input-file resource)))))))
(define (404-page)
@ -191,7 +191,7 @@
(html-response
(if (file-exists? static-path)
(static-file-res static-path)
(make-page "source/not-found.txt" (write-static-file static-path))))))
(make-page "source/not-found.scm" (write-static-file static-path))))))
(define-values (page-app reverse-page-uri)
(dispatch-rules

View file

@ -20,15 +20,15 @@
;; - update a read-table for resource type
;; - update the atom.txt feed
;; - update the atom feed
;; - move the original input file
;; example
;; publish -input-file in-progress/beginning-latl.txt --resource-type unsettled --tags latl,conlang \
;; publish -input-file in-progress/beginning-latl..scm --resource-type unsettled --tags latl,conlang \
;; --headline "Beginning LATL" --description "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" \
;; publish -i in-progress/beginning-latl.scm -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."))
@ -75,7 +75,7 @@
(define (append-post-footer post-xexpr tag-list history-list)
(let ([post-footer
(read (open-input-file "source/post-footer.txt"))])
(read (open-input-file "source/post-footer.scm"))])
`(body
,post-xexpr
,((eval post-footer ns) tag-list history-list))))
@ -85,12 +85,12 @@
(if (non-empty-string? l)
(path->string (path-add-extension (build-path (if x "publish-test/source" "source")
(string-replace l " " "-"))
".txt"))
".scm"))
(error "'root resource requires headline")))
(define (make-res-file-handle x r id)
(if (< 0 id)
(path->string (path-add-extension (build-path (if x "publish-test/source" "source") r (~a id))
".txt"))
".scm"))
(error "~a resource requires r-id" r)))
(if (equal? r-type "root")
(make-root-file-handle x-test l-headline)
@ -100,12 +100,12 @@
(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"))]
[make-index (read (open-input-file "source/make-index.scm"))]
[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")]
".scm")]
[file (open-output-file handle #:exists 'replace)])
(if (port-try-file-lock? file 'exclusive)
(begin
@ -147,12 +147,12 @@
(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"))]
[make-index (read (open-input-file "source/make-index.scm"))]
[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")]
#".scm")]
[file (open-output-file handle #:exists 'replace)])
(if (port-try-file-lock? file 'exclusive)
(begin
@ -164,12 +164,12 @@
(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"))]
(let* ([make-index (read (open-input-file "source/make-index.scm"))]
[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")]
#".scm")]
[file (open-output-file handle #:exists 'replace)])
(if (port-try-file-lock? file 'exclusive)
(begin
@ -327,8 +327,8 @@
(display
(make-feed ns (open-input-file
(if x
"publish-test/data/make-atom.txt"
"data/make-atom.txt"))
"publish-test/data/make-atom.scm"
"data/make-atom.scm"))
new-atom-table
publish-time)
feed-out)