Use JSON file for instance list

This commit is contained in:
Cadence Ember 2022-11-15 22:43:27 +13:00
parent 477095b236
commit c00c65de93
Signed by: cadence
GPG key ID: BC1C2C61CF521B17
2 changed files with 17 additions and 10 deletions

View file

@ -1,6 +1,6 @@
#lang scribble/base
@(require scribble/manual scribble/core racket/list)
@(require scribble/manual scribble/core racket/list json)
@(define (code . pre-content) (elem (apply literal pre-content) #:style 'tt))
@title{BreezeWiki Documentation}
@ -28,15 +28,15 @@
@subsection{Instances}
@tabular[#:style (style "user-table instance-list user-table--title" null)
(map (λ (row) (list (if (string? (second row)) (hyperlink (second row) (first row)) (first row))
(if (string? (third row)) (url (third row)) (third row))))
`((,(literal "Hoster") #f ,(literal "Link"))
("Cadence" "https://cadence.moe" "https://breezewiki.com")
("PussTheCat.org" "https://pussthecat.org" "https://breezewiki.pussthecat.org")
("Odyssey346" "https://odyssey346.dev" "https://bw.odyssey346.dev")
("~vern" "https://vern.cc" "https://bw.vern.cc")
("Esmail" "https://en.esmailelbob.xyz" "https://breezewiki.esmailelbob.xyz")
))]
`((,(literal "Hoster") ,(literal "Link"))
,@(for/list ([item (with-input-from-file "files/instances.json" (lambda () (read-json)))])
(define-values (owner-name owner-website instance)
(apply values (for/list ([key '(owner_name owner_website instance)])
(hash-ref item key))))
(list (if (string? owner-website) (hyperlink owner-website owner-name) owner-name)
(url instance))))]
Instances JSON data: @url{https://docs.breezewiki.com/files/instances.json}
@subsection[#:tag "Tools"]{Tools}

7
files/instances.json Normal file
View file

@ -0,0 +1,7 @@
[
{"owner_name": "Cadence", "owner_website": "https://cadence.moe", "instance": "https://breezewiki.com"},
{"owner_name": "PussTheCat.org", "owner_website": "https://pussthecat.org", "instance": "https://breezewiki.pussthecat.org"},
{"owner_name": "Odyssey346", "owner_website": "https://odyssey346.dev", "instance": "https://bw.odyssey346.dev"},
{"owner_name": "~vern", "owner_website": "https://vern.cc", "instance": "https://bw.vern.cc"},
{"owner_name": "Esmail", "owner_website": "https://en.esmailelbob.xyz", "instance": "https://breezewiki.esmailelbob.xyz"}
]