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

Commit

Permalink
pronuncication links
Browse files Browse the repository at this point in the history
  • Loading branch information
technicat committed Aug 8, 2023
1 parent c8dec46 commit e95e2d7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion assets/json/dish/fruit.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"Yale": "mōng gwó",
"Jyutping": "mong1 gwo2",
"Pinyin": "máng guǒ",
"description": "{芒} is phonetic for the first syllable in [mango](https://en.wikipedia.org/wiki/Mango), and {果} is *fruit*."
"description": "{芒} is phonetic for the first syllable in [mango](https://en.wikipedia.org/wiki/Mango), and {果} is *fruit* but also sounds like the second syllable in [mango](https://en.wikipedia.org/wiki/Mango)."
},
"images": [
{
Expand Down
34 changes: 18 additions & 16 deletions hugo.scm
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,20 @@
(define (write-dish-cantonese dish out)
(h3 "Cantonese" out)
(write-dish-text (cantonese dish) out)
(h4 "Pronunciation (Yale)" out)
(if (yale dish)
(write-string (yale dish) out)
(let ((yalestr (linkstr "Yale" "https://en.wikipedia.org/wiki/Yale_romanization_of_Cantonese")))
(h4 #"Pronunciation (~yalestr)" out)
(write-string (yale dish) out))
(write-string "Missing Yale" out))
(write-dish-wkty (cantonese dish) out))

(define (write-dish-mandarin dish out)
(h3 "Mandarin" out)
(write-dish-text (mandarin dish) out)
(h4 "Pronunciation (Pinyin)" out)
(if (pinyin dish)
(write-string (pinyin dish) out)
(let ((str (linkstr "Mandarin" "https://en.wikipedia.org/wiki/Pinyin")))
(h4 "Pronunciation (~str)" out)
(write-string (pinyin dish) out))
(write-string "Missing Pinyin" out))
(write-dish-wkty (mandarin dish) out))

Expand Down Expand Up @@ -219,21 +221,21 @@
(res-value "description" (word dish)))

(define (replace-wkty text)
(regexp-replace-all #/{([^{]*)}/ text "[\\1](https://en.wiktionary.org/wiki/\\1)"))
(regexp-replace-all #/{([^{]*)}/ text "[\\1](https://en.wiktionary.org/wiki/\\1)"))

(define (tags dish)
(res-value "tags" dish))
(define (tags dish)
(res-value "tags" dish))

(define (refs dish)
(res-value "resources" dish))
(define (refs dish)
(res-value "resources" dish))

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

(define (ref-url ref)
(res-value "URL" ref))
(define (ref-url ref)
(res-value "URL" ref))

; categories
; categories

(define (read-cats)
(read-json "assets/json/categories.json"))
(define (read-cats)
(read-json "assets/json/categories.json"))

0 comments on commit e95e2d7

Please sign in to comment.