From c00c65de933a297e7eecf6b1fa15ce337677b672 Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Tue, 15 Nov 2022 22:43:27 +1300 Subject: [PATCH] Use JSON file for instance list --- docs.scrbl | 20 ++++++++++---------- files/instances.json | 7 +++++++ 2 files changed, 17 insertions(+), 10 deletions(-) create mode 100644 files/instances.json diff --git a/docs.scrbl b/docs.scrbl index 198add7..d6bebbb 100644 --- a/docs.scrbl +++ b/docs.scrbl @@ -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} diff --git a/files/instances.json b/files/instances.json new file mode 100644 index 0000000..add977d --- /dev/null +++ b/files/instances.json @@ -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"} +]