Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Commit

Permalink
home cooking
Browse files Browse the repository at this point in the history
  • Loading branch information
technicat committed Aug 21, 2023
1 parent 18aa9c3 commit 254940b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 9 deletions.
2 changes: 1 addition & 1 deletion assets/json/place/usrhodeisland.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name":"Rhode Island",
"name": "Rhode Island",
"places":
[

Expand Down
4 changes: 2 additions & 2 deletions assets/json/words/cuisinewords.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
""
]
},
"Yale": "jit choi",
"Pinyin": "zhè cài"
"Yale": "gā sèuhng choi",
"Pinyin": "jiā cháng cài"
}
]
38 changes: 32 additions & 6 deletions hugo.scm
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,40 @@
(vector->list (read-json #"assets/json/words/~|file|.json")))
files))))

(define (read-places)
(let ((files (read-json "assets/json/countries.json")))
(concatenate (map (lambda (file)
(read-json #"assets/json/place/~|file|.json"))
files))))

(define (read-phrases)
(let ((files (read-json "assets/json/phrases.json")))
(concatenate (map (lambda (file)
(read-json #"assets/json/phrases/~|file|.json"))
files))))

; places

(define (country-regions country)
(res-value "regions" country))

(define (state-name state)
(res-value "name" state))

(define (read-places)
(let ((us (read-json "assets/json/place/us.json")))
(map (lambda (file)
(read-json #"assets/json/place/~|file|.json"))
(country-regions us))))

(define (write-places places)
(for-each (lambda (state)
(write-state-file state))
places))

(define (write-state-file state)
(let ((file #"../hugodimsum/content/places/~(state-name state).md"))
(call-with-output-file file (lambda (out)
(write-state-header state out)))))

(define (write-state-header state out)
(hugo-header-line out)
(newline out)
(hugo-title (state-name state) out)
(hugo-date-none out)
(hugo-header-line out)
(news out))

0 comments on commit 254940b

Please sign in to comment.