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