defs.ss (4095B)
1 (define deltachat-link "https://i.delta.chat/#76C7146A9B680D58FCDF92DFE5194EDDDA927637&i=J8yTBGeFv2aDfEJ6TutzCGPx&s=nDUt7FB9Fj0zO7yUreGWnXWa&a=9fgfha9a5kte%40chat.zashm.org&n=fozunja") 2 (define snac-link "https://glamour.ovh/fozunja") 3 (define pleroma-link "https://pl.m0e.space/fozunja") 4 (define wired-link "https://the-wired.club/fdr") 5 (define git-link "https://git.glamour.ovh/fozunja") 6 (define xmpp-link "https://xmpp.link/#fozunja@glamour.ovh") 7 (define peertube-link "https://peertube.wtf/c/fznj") 8 (define my-url "https://fozunja.glamour.ovh") 9 (define button-url (string-append my-url "/88x31/fznj.png")) 10 (define spoiler-count 0) 11 12 (define (next-spoiler) 13 (begin (set! spoiler-count (+ spoiler-count 1)) 14 (number->string (- spoiler-count 1)))) 15 16 (define (divc class . content) 17 (apply div `(class ,class ,@content))) 18 (define (spanc class . content) 19 (apply span `(class ,class ,@content))) 20 (define (ah link . content) 21 (apply a `(href ,link ,@content))) 22 (define (ah* link . content) 23 (apply a* `(href ,link ,@content))) 24 25 (define (spoiler text . content) 26 (let ((spoiler-id `("scb",(next-spoiler)))) 27 (divc "spoiler" 28 (ah `("#" ,@spoiler-id) 'id spoiler-id 'class "spoiler-link" text) 29 (divc "spoiler-content" content)))) 30 31 ;; performance doesn't really matter for small things like IDs 32 (define (kebab text) 33 (list->string 34 (map (lambda (c) 35 (case c 36 ((#\space) #\-) 37 ((#\& #\/) #\n) 38 (else c))) 39 (string->list text)))) 40 41 (define (card name . content) 42 (divc "section" 'id (kebab name) 43 (h2 44 (ah* `("#" ,(kebab name)) name)) 45 content)) 46 47 (define (p-card name . content) 48 (card name (p content))) 49 50 (define (spoiler-card name . content) 51 (divc "section spoiler-section" 'id (kebab name) 52 (spoiler name content))) 53 54 (define (list-card name . content) 55 (card name 56 (list->html-list 57 (if (and (= 1 (length content)) 58 (list? (car content))) 59 (car content) 60 content)))) 61 62 (define (list-card* name . content) 63 (apply list-card `(,name ,@(map escape content)))) 64 65 (define (b88x31 file url) 66 (ah url (img 'src `("/88x31/",file) 67 'alt "88x31 button"))) 68 (define (codeblock name . content) 69 (divc "codeblock" (p name) (pre (apply code* content)))) 70 (define (codeblock* name . content) 71 (codeblock name (apply string-append content))) 72 73 (define navbar 74 (divc "navbar" 75 (divc "container" 76 (table 'class "navbar-inner" 77 (tbody 78 (tr 79 (td (ah "/" "FZNJ")) 80 (td 'class "navbar-right" 'colspan "8" 81 (ah "/faq.xhtml" "FAQ") " " 82 (ah "/pc.xhtml" "PC")))))))) 83 84 (define basement 85 (divc "basement" 86 (divc "container" 87 (p "This website was last edited" argv2 "seconds after 1970-01-01" br/ 88 "Made with :3 by fozunja (fozunja@glamour.ovh); 2026")))) 89 90 (define (default-template page-title page-header . content) 91 (!xhtml 92 (head 93 (title "Fozunja |" page-title) 94 (link 'rel "stylesheet" 'href "/style.css") 95 (meta 'name "robots" 'content "noindex, nofollow, noarchive")) 96 (body 97 (apply divc `("container" 98 ,navbar 99 ,(divc "header" 100 (h1* page-header)) 101 ,@content)) 102 basement))) 103 104 (define (tagged-list lst) 105 (let loop ((result "") (istag #f) (lst lst)) 106 (cond 107 ((null? lst) 108 (if istag 109 (error "tagged-list" "expected list, found nothing") 110 (ul result))) 111 (istag 112 (loop (string-append 113 result 114 (cond 115 ((list? (car lst)) 116 (tagged-list (car lst))) 117 (else 118 (error "tagged-list" "expected list"))) 119 "</li>") 120 #f 121 (cdr lst))) 122 ((symbol? (car lst)) 123 (loop (string-append result "<li>"(symbol->string (car lst))" ") 124 #t 125 (cdr lst))) 126 (else 127 (loop (string-append result (li* (car lst))) 128 #f 129 (cdr lst)))))) 130 131 (define (tagged-card name content) 132 (card name (tagged-list content)))