change .txt to .scm in source files
allows git forge to recognize source as sexprs
This commit is contained in:
parent
eccbd26ac0
commit
4982e32350
32 changed files with 53 additions and 29 deletions
12
.dev-log
12
.dev-log
|
@ -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
|
2024/01/17
|
||||||
- add html cache directories to build script
|
- add html cache directories to build script
|
||||||
TODO:
|
TODO:
|
||||||
|
|
14
.idea-log
14
.idea-log
|
@ -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
|
- beginning latl effectively finished and ready for post once ci is fixed
|
||||||
- projects to write about
|
- projects to write about
|
||||||
- input-messenger
|
- input-messenger
|
||||||
|
|
14
modify.rkt
14
modify.rkt
|
@ -23,12 +23,12 @@
|
||||||
;; this will not! (for now) update the <resource>/index or tagged/<tag>/index pages !
|
;; this will not! (for now) update the <resource>/index or tagged/<tag>/index pages !
|
||||||
;; (these pages do not currently show post history)
|
;; (these pages do not currently show post history)
|
||||||
|
|
||||||
;; - update the atom.txt feed
|
;; - update the atom table and rebuild the atom feed
|
||||||
|
|
||||||
;; example
|
;; 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"
|
;; --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."))
|
(help (usage "modify is here to update existing posts with new content."))
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@
|
||||||
(if x-test
|
(if x-test
|
||||||
(build-path "publish-test" "source" r-type l-head)
|
(build-path "publish-test" "source" r-type l-head)
|
||||||
(build-path "source" r-type l-head)))
|
(build-path "source" r-type l-head)))
|
||||||
#".txt")])
|
#".scm")])
|
||||||
(values
|
(values
|
||||||
(open-input-file file-handle)
|
(open-input-file file-handle)
|
||||||
(open-output-file file-handle #:exists 'update))))
|
(open-output-file file-handle #:exists 'update))))
|
||||||
|
@ -128,14 +128,14 @@
|
||||||
(open-input-file file-handle)
|
(open-input-file file-handle)
|
||||||
(open-output-file file-handle #:exists 'update))))
|
(open-output-file file-handle #:exists 'update))))
|
||||||
|
|
||||||
;; get make-atom.txt input-port
|
;; get make-atom.scm input-port
|
||||||
;; (. -> . input-port?)
|
;; (. -> . input-port?)
|
||||||
(define (get-make-atom-input-port)
|
(define (get-make-atom-input-port)
|
||||||
(let ([file-handle (path-add-extension
|
(let ([file-handle (path-add-extension
|
||||||
(if x-test
|
(if x-test
|
||||||
(build-path "publish-test" "data" "make-atom")
|
(build-path "publish-test" "data" "make-atom")
|
||||||
(build-path "data" "make-atom"))
|
(build-path "data" "make-atom"))
|
||||||
#".txt")])
|
#".scm")])
|
||||||
(open-input-file file-handle)))
|
(open-input-file file-handle)))
|
||||||
|
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@
|
||||||
;; replace resource in source/<type>/id
|
;; replace resource in source/<type>/id
|
||||||
(define (append-post-footer post-xexpr tag-list history-list)
|
(define (append-post-footer post-xexpr tag-list history-list)
|
||||||
(let ([post-footer
|
(let ([post-footer
|
||||||
(read (open-input-file "source/post-footer.txt"))])
|
(read (open-input-file "source/post-footer.scm"))])
|
||||||
`(body
|
`(body
|
||||||
,post-xexpr
|
,post-xexpr
|
||||||
,((eval post-footer ns) tag-list history-list))))
|
,((eval post-footer ns) tag-list history-list))))
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
(list content)))
|
(list content)))
|
||||||
|
|
||||||
;; bound path builders
|
;; 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
|
;; but must be read and evaluated in this namespace
|
||||||
(define (make-path-no-param root-folder extension)
|
(define (make-path-no-param root-folder extension)
|
||||||
(lambda (t)
|
(lambda (t)
|
||||||
|
@ -62,10 +62,10 @@
|
||||||
extension)))
|
extension)))
|
||||||
|
|
||||||
(define (make-source-path-no-param t)
|
(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)
|
(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)
|
(define (make-static-path-no-param api-type t)
|
||||||
(let ([root-folder
|
(let ([root-folder
|
||||||
|
@ -156,7 +156,7 @@
|
||||||
(html-response
|
(html-response
|
||||||
(if (file-exists? static-path)
|
(if (file-exists? static-path)
|
||||||
(static-file-res 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)
|
(define-values (httpx-app reverse-httpx-uri)
|
||||||
|
@ -181,9 +181,9 @@
|
||||||
(define (fragment->page resource)
|
(define (fragment->page resource)
|
||||||
(xexpr->string
|
(xexpr->string
|
||||||
`(html ((lang "en"))
|
`(html ((lang "en"))
|
||||||
,(read (open-input-file "source/head.txt"))
|
,(read (open-input-file "source/head.scm"))
|
||||||
(body
|
(body
|
||||||
,(read (open-input-file "source/header.txt"))
|
,(read (open-input-file "source/header.scm"))
|
||||||
(main ,(read (open-input-file resource)))))))
|
(main ,(read (open-input-file resource)))))))
|
||||||
|
|
||||||
(define (404-page)
|
(define (404-page)
|
||||||
|
@ -191,7 +191,7 @@
|
||||||
(html-response
|
(html-response
|
||||||
(if (file-exists? static-path)
|
(if (file-exists? static-path)
|
||||||
(static-file-res 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)
|
(define-values (page-app reverse-page-uri)
|
||||||
(dispatch-rules
|
(dispatch-rules
|
||||||
|
|
28
publish.rkt
28
publish.rkt
|
@ -20,15 +20,15 @@
|
||||||
|
|
||||||
;; - update a read-table for resource type
|
;; - update a read-table for resource type
|
||||||
|
|
||||||
;; - update the atom.txt feed
|
;; - update the atom feed
|
||||||
|
|
||||||
;; - move the original input file
|
;; - move the original input file
|
||||||
|
|
||||||
;; example
|
;; 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 \
|
;; --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" \
|
;; 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"
|
;; -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."))
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@
|
||||||
|
|
||||||
(define (append-post-footer post-xexpr tag-list history-list)
|
(define (append-post-footer post-xexpr tag-list history-list)
|
||||||
(let ([post-footer
|
(let ([post-footer
|
||||||
(read (open-input-file "source/post-footer.txt"))])
|
(read (open-input-file "source/post-footer.scm"))])
|
||||||
`(body
|
`(body
|
||||||
,post-xexpr
|
,post-xexpr
|
||||||
,((eval post-footer ns) tag-list history-list))))
|
,((eval post-footer ns) tag-list history-list))))
|
||||||
|
@ -85,12 +85,12 @@
|
||||||
(if (non-empty-string? l)
|
(if (non-empty-string? l)
|
||||||
(path->string (path-add-extension (build-path (if x "publish-test/source" "source")
|
(path->string (path-add-extension (build-path (if x "publish-test/source" "source")
|
||||||
(string-replace l " " "-"))
|
(string-replace l " " "-"))
|
||||||
".txt"))
|
".scm"))
|
||||||
(error "'root resource requires headline")))
|
(error "'root resource requires headline")))
|
||||||
(define (make-res-file-handle x r id)
|
(define (make-res-file-handle x r id)
|
||||||
(if (< 0 id)
|
(if (< 0 id)
|
||||||
(path->string (path-add-extension (build-path (if x "publish-test/source" "source") r (~a 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)))
|
(error "~a resource requires r-id" r)))
|
||||||
(if (equal? r-type "root")
|
(if (equal? r-type "root")
|
||||||
(make-root-file-handle x-test l-headline)
|
(make-root-file-handle x-test l-headline)
|
||||||
|
@ -100,12 +100,12 @@
|
||||||
(displayln "write-new-tagged/index")
|
(displayln "write-new-tagged/index")
|
||||||
(let* ([tags (rest (map (lambda (row) (first row))
|
(let* ([tags (rest (map (lambda (row) (first row))
|
||||||
tag-table))]
|
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)]
|
[new-index ((eval make-index ns) "tagged" tags)]
|
||||||
[handle (path-add-extension (if x
|
[handle (path-add-extension (if x
|
||||||
(build-path "publish-test" "source" "tagged" "index")
|
(build-path "publish-test" "source" "tagged" "index")
|
||||||
(build-path "source" "tagged" "index"))
|
(build-path "source" "tagged" "index"))
|
||||||
".txt")]
|
".scm")]
|
||||||
[file (open-output-file handle #:exists 'replace)])
|
[file (open-output-file handle #:exists 'replace)])
|
||||||
(if (port-try-file-lock? file 'exclusive)
|
(if (port-try-file-lock? file 'exclusive)
|
||||||
(begin
|
(begin
|
||||||
|
@ -147,12 +147,12 @@
|
||||||
(hash-ref post-lookup lookup/id)
|
(hash-ref post-lookup lookup/id)
|
||||||
(get-post-data lookup/id resources post-lookup x)))
|
(get-post-data lookup/id resources post-lookup x)))
|
||||||
(filter non-empty-string? (rest tag-table-row)))]
|
(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)]
|
[new-index ((eval make-index ns) (~a "tagged/" tag) posts)]
|
||||||
[handle (path-add-extension (if x
|
[handle (path-add-extension (if x
|
||||||
(build-path "publish-test" "source" "tagged" (first tag-table-row))
|
(build-path "publish-test" "source" "tagged" (first tag-table-row))
|
||||||
(build-path "source" "tagged" tag))
|
(build-path "source" "tagged" tag))
|
||||||
#".txt")]
|
#".scm")]
|
||||||
[file (open-output-file handle #:exists 'replace)])
|
[file (open-output-file handle #:exists 'replace)])
|
||||||
(if (port-try-file-lock? file 'exclusive)
|
(if (port-try-file-lock? file 'exclusive)
|
||||||
(begin
|
(begin
|
||||||
|
@ -164,12 +164,12 @@
|
||||||
|
|
||||||
(define (write-new-resource/index resource resource-table #:test [x #f])
|
(define (write-new-resource/index resource resource-table #:test [x #f])
|
||||||
(displayln "write-new-resource/index")
|
(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))]
|
[new-index ((eval make-index ns) resource (rest resource-table))]
|
||||||
[handle (path-add-extension (if x
|
[handle (path-add-extension (if x
|
||||||
(build-path "publish-test" "source" resource "index")
|
(build-path "publish-test" "source" resource "index")
|
||||||
(build-path "source" resource "index"))
|
(build-path "source" resource "index"))
|
||||||
#".txt")]
|
#".scm")]
|
||||||
[file (open-output-file handle #:exists 'replace)])
|
[file (open-output-file handle #:exists 'replace)])
|
||||||
(if (port-try-file-lock? file 'exclusive)
|
(if (port-try-file-lock? file 'exclusive)
|
||||||
(begin
|
(begin
|
||||||
|
@ -327,8 +327,8 @@
|
||||||
(display
|
(display
|
||||||
(make-feed ns (open-input-file
|
(make-feed ns (open-input-file
|
||||||
(if x
|
(if x
|
||||||
"publish-test/data/make-atom.txt"
|
"publish-test/data/make-atom.scm"
|
||||||
"data/make-atom.txt"))
|
"data/make-atom.scm"))
|
||||||
new-atom-table
|
new-atom-table
|
||||||
publish-time)
|
publish-time)
|
||||||
feed-out)
|
feed-out)
|
||||||
|
|
Loading…
Reference in a new issue