diff --git a/.dev-log b/.dev-log index 5657900..eb100f2 100644 --- a/.dev-log +++ b/.dev-log @@ -1,5 +1,6 @@ 2024/01/14 - +- fix stylesheets +- 2024/01/13 - update atom-table-writing diff --git a/.woodpecker/build-and-deploy.yml b/.woodpecker/build-and-deploy.yml index 1fddf73..1d0f333 100644 --- a/.woodpecker/build-and-deploy.yml +++ b/.woodpecker/build-and-deploy.yml @@ -10,8 +10,8 @@ steps: - apt update - apt -yq install racket ca-certificates - yes Y | raco pkg install --no-docs csv-reading - - raco exe sorrel.dev.rkt - - raco distribute dist sorrel.dev + - raco exe oxaliq.net.rkt + - raco distribute dist oxaliq.net deploy: image: alpine:latest diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 171c33e..0000000 --- a/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM debian:bookworm-slim -COPY . . -RUN rm -rf data/ -RUN rm -rf in-progress -RUN apt update -RUN apt -yq install racket ca-certificates -RUN yes Y | raco pkg install --no-docs csv-reading -RUN raco exe sorrel.dev.rkt -RUN raco distribute dist sorrel.dev diff --git a/README b/README index 7e566e2..3aebe57 100644 --- a/README +++ b/README @@ -1,6 +1,6 @@ -------------- - | λ sorrel.dev |\ + | λ oxaliq.net |\ \--------------\ \ \______________\| @@ -105,5 +105,25 @@ there's a couple things this'll do. so that's simple enough. + ______________________ +|----------------------| +| HOW TO MODIFY A POST | +|----------------------| + ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ +so, some things aren't done til yr dead. some of those things might be posts. `publish` +is always going to move yr text into archive/ and you'll be able to move that file back +to in-progress/ when yr ready to start working on it again. - +then you can use the "modify" tool. here's how it works +``` +$ modify -i in-progress/ex.txt \ # -i is for the input + -r unsettled \ # -r is for the resource type + -l "An Example Text" \ # -l is for the head_l_ine (title) +``` +you can't currently change the description or the tags on existing posts. +what this does: +- update the csv files for the resource type +- rebuilds the source with footer and metadata and tags +- update the atom feed, but this time with a "updated" tag in the entry + +if at any point the script encounters a problem, any changes will be rolled back diff --git a/build.sh b/build.sh deleted file mode 100755 index 30c49e5..0000000 --- a/build.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -e - -# clean up old build -rm -rf sorrel || true - -# compile binary -raco cross --target x86_64-linux exe sorrel.dev.rkt - -# distribute -raco cross --target x86_64-linux dist sorrel sorrel.dev - -# remove duplicated binary -rm sorrel.dev diff --git a/data/atom.csv b/data/atom.csv index abc0479..5e2b0fe 100644 --- a/data/atom.csv +++ b/data/atom.csv @@ -1,2 +1 @@ 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 \ No newline at end of file diff --git a/data/make-atom.txt b/data/make-atom.txt index 2956826..ad0fc68 100644 --- a/data/make-atom.txt +++ b/data/make-atom.txt @@ -2,7 +2,7 @@ (let ([feed `(feed ((xmlns "http://www.w3.org/2005/Atom")) - (title "λ.sorrel.dev") + (title "λ.oxaliq.net") (link ((rel "self") (href ,feed-ref))) (updated ,update-time) diff --git a/deploy.sh b/deploy.sh deleted file mode 100755 index 2b3cfd5..0000000 --- a/deploy.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -e - -# make a clean slate locally -rm -rf ./deploy-dir || true -mkdir ./deploy-dir - -# copy all the files into a deploy local directory -cp -a ./sorrel/. ./deploy-dir/. -cp -a ./static ./deploy-dir/. -cp -a ./source ./deploy-dir/. -cp -a ./data ./deploy-dir/. - -# make a clean slate remotely -ssh deploy@turtle.hup.is 'rm -rf ./sorrel.dev' - -# copy all the files onto remote -rsync -avz ./deploy-dir/. deploy@turtle.hup.is:~/sorrel.dev diff --git a/in-progress/this.txt b/in-progress/this.txt index 2ea4d82..35ced67 100644 --- a/in-progress/this.txt +++ b/in-progress/this.txt @@ -4,7 +4,7 @@ (p "some kind of colophon")) (p "all of the code for the website is hosted and deployed from tree, " - (a ((href "https://git.bunk.computer/oxaliq/sorrel.dev")) + (a ((href "https://git.bunk.computer/oxaliq/oxaliq.net")) "bunk computer club's git forge") "i do almost everything in the main branch, cause it's just me and that way i can add links below to the in-progress stuff real easy") @@ -28,9 +28,9 @@ "there's some racket scripts i use for tooling that were made with " (a ((href "https://docs.racket-lang.org/cli/")) "#lang cli")) - (p (a ((href "https://git.bunk.computer/oxaliq/sorrel.dev/src/branch/main/.dev-log")) + (p (a ((href "https://git.bunk.computer/oxaliq/oxaliq.net/src/branch/main/.dev-log")) "you can read about development here")) - (p (a ((href "https://git.bunk.computer/oxaliq/sorrel.dev/src/branch/main/.idea-log")) + (p (a ((href "https://git.bunk.computer/oxaliq/oxaliq.net/src/branch/main/.idea-log")) "you can read about my vague plans here")) - (p (a ((href "https://git.bunk.computer/oxaliq/sorrel.dev/src/branch/main/in-progress")) + (p (a ((href "https://git.bunk.computer/oxaliq/oxaliq.net/src/branch/main/in-progress")) "or read works in progress here"))) \ No newline at end of file diff --git a/modify.rkt b/modify.rkt index 9cfcb36..d80a655 100644 --- a/modify.rkt +++ b/modify.rkt @@ -8,13 +8,12 @@ (only-in racket/function thunk identity) (only-in csv-reading csv->list) (only-in xml read-xml) - (only-in "./tool/utils.rkt" list->csv resource-link atom-table-entry add-atom-entry make-feed)) + (only-in "./tool/utils.rkt" list->csv resource-link atom-table-entry add-atom-entry + make-feed archive-file)) (define-namespace-anchor anc) (define ns (namespace-anchor->namespace anc)) -(define homepage "https://sorrel.dev") - ;; modify needs to @@ -346,7 +345,7 @@ (let* ([old-feed (read-xml af-input-port)]) (lambda (accumulator) (let* ([atom-table (hash-ref accumulator 'atom-table)] - [new-feed (make-feed ns make-af-input-port atom-table update-time #:homepage homepage)]) + [new-feed (make-feed ns make-af-input-port atom-table update-time)]) (write-to-file af-output-port new-feed old-feed accumulator))))) ;; ---------------- @@ -375,7 +374,7 @@ [(atom-feed-input-port atom-feed-output-port) (get-atom-feed-ports)] [(make-atom-input-port) (get-make-atom-input-port)] [(old-res-table id) (get-res-table-and-id res-table-input-port)] - [(res-link) (resource-link r-type id #:homepage homepage)] + [(res-link) (resource-link r-type id)] [(tags) (get-tags r-type id)] [(new-content) (get-new-content source-input-port tags id)]) @@ -388,10 +387,12 @@ ;; see above (replace-resource source-input-port source-output-port new-content id) (update-res-table old-res-table res-table-output-port id)) - (compose-accumulator rollback-thunks)))) - - ;; - )) + (compose-accumulator rollback-thunks)) + + ;; only archive after everything else is done + (archive-file n-in x-test) + + (displayln "modify was successful"))))) ;(run modify) diff --git a/publish.rkt b/publish.rkt index eeee312..68e6dc0 100644 --- a/publish.rkt +++ b/publish.rkt @@ -5,13 +5,12 @@ (only-in racket/format ~a) (only-in racket/list append* first second third fourth fifth rest flatten add-between take) (only-in xml xexpr->string) + (only-in "./tool/utils.rkt" homepage list->csv add-atom-entry archive-file) csv-reading) (define-namespace-anchor anc) (define ns (namespace-anchor->namespace anc)) -(define homepage "https://sorrel.dev") - ;; publish needs to: @@ -97,11 +96,6 @@ (make-root-file-handle x-test l-headline) (make-res-file-handle x-test r-type r-id))) -(define (archive-file i x) - (if x - (copy-file i (string-replace i "in-progress" "publish-test/archive") #t) - (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)) @@ -184,17 +178,6 @@ (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 -(define (list->csv l) - (foldl (lambda (i res) - (string-append res i)) - "" - (flatten - (add-between (map (lambda (row) - (add-between row ",")) - l) - "\n")))) - (define (write-csv-to-file data handle) (let ([file (open-output-file handle #:exists 'replace)]) @@ -222,15 +205,6 @@ tag-list) new-tt)))) - (define (add-atom-entry atom-table new-row) - ;; take only first 21 rows (or all rows) - ;; insert new-row after header - (let ([out-length (min (+ 1 (length atom-table)) 21)] - [header (first atom-table)] - [old-content (rest atom-table)]) - (take (append (list header new-row) old-content) - out-length))) - (program (publish) @@ -340,7 +314,7 @@ (define feed ((eval (read (open-input-file (if x "publish-test/data/make-atom.txt" "data/make-atom.txt"))) ns) - "https://sorrel.dev/feed.atom" + "https://oxaliq.net/feed.atom" publish-time homepage (rest new-atom-table))) diff --git a/source/atom.txt b/source/atom.txt deleted file mode 100644 index 141ae89..0000000 --- a/source/atom.txt +++ /dev/null @@ -1,25 +0,0 @@ -(lambda (feed-ref update-time homepage) - `(feed - ((xmlns "http://www.w3.org/2005/Atom")) - (title "λ.sorrel.dev") - (link ((rel "self") - (href ,feed-ref))) - (updated ,update-time) - (author - (name "sorrel")) - (id ,homepage) - -; ,(map -; (lambda (item) -; `(entry -; (title ,(title item)) -; (link ((href ,(href item)))) -; (id ,(href item)) -; (type ,(type item)) ; usually html -; ,(map (lambda (category) -; `(category ((term ,(term category)) -; (scheme ,(scheme category))))) -; (categories item)) -; (updated ,(updated item))) -; items)) - )) \ No newline at end of file