Unify application footer

This commit is contained in:
Cadence Ember 2022-09-05 01:58:45 +12:00
parent eabe699587
commit 6be10ed319
Signed by untrusted user: cadence
GPG key ID: BC1C2C61CF521B17
2 changed files with 37 additions and 41 deletions

View file

@ -5,6 +5,8 @@
(provide (provide
; timeout durations for http-easy requests ; timeout durations for http-easy requests
timeouts timeouts
; generates a consistent footer
application-footer
; generates a consistent template for wiki page content to sit in ; generates a consistent template for wiki page content to sit in
generate-wiki-page) generate-wiki-page)
@ -14,6 +16,38 @@
(define timeouts (make-timeout-config #:lease 5 #:connect 5)) (define timeouts (make-timeout-config #:lease 5 #:connect 5))
(define (application-footer source-url)
`(footer (@ (class "custom-footer"))
(div (@ (class ,(if source-url "custom-footer__cols" "internal-footer")))
(div (p
(img (@ (class "my-logo") (src "/static/breezewiki.svg"))))
(p
(a (@ (href "https://gitdab.com/cadence/breezewiki"))
,(format "~a source code" (config-get 'application_name))))
(p
(a (@ (href "https://docs.breezewiki.com"))
"Documentation and more information"))
(p
(a (@ (href "https://lists.sr.ht/~cadence/breezewiki-discuss"))
"Discussions / Bug reports / Feature requests"))
,(if (config-true? 'instance_is_official)
`(p ,(format "This instance is run by the ~a developer, " (config-get 'application_name))
(a (@ (href "https://cadence.moe/contact"))
"Cadence."))
`(p
,(format "This unofficial instance is based off the ~a source code, but is not controlled by the code developer." (config-get 'application_name)))))
,(if source-url
`(div (p "This page displays proxied content from "
(a (@ (href ,source-url) (rel "noreferrer")) ,source-url)
". Text content is available under the Creative Commons Attribution-Share Alike License 3.0 (Unported), "
(a (@ (href "https://www.fandom.com/licensing")) "see license info.")
" Media files may have different copying restrictions.")
(p ,(format "Fandom is a trademark of Fandom, Inc. ~a is not affiliated with Fandom." (config-get 'application_name))))
`(div (p "Text content on wikis run by Fandom is available under the Creative Commons Attribution-Share Alike License 3.0 (Unported), "
(a (@ (href "https://www.fandom.com/licensing")) "see license info.")
" Media files and official Fandom documents have different copying restrictions.")
(p ,(format "Fandom is a trademark of Fandom, Inc. ~a is not affiliated with Fandom." (config-get 'application_name))))))))
(define (generate-wiki-page source-url wikiname title content) (define (generate-wiki-page source-url wikiname title content)
(define (required-styles origin) (define (required-styles origin)
(map (λ (dest-path) (format dest-path origin)) (map (λ (dest-path) (format dest-path origin))
@ -46,29 +80,6 @@
(div (@ (id "content") #;(class "page-content")) (div (@ (id "content") #;(class "page-content"))
(div (@ (id "mw-content-text")) (div (@ (id "mw-content-text"))
,content)) ,content))
(footer (@ (class "custom-footer")) ,(application-footer source-url)))))))
(div (@ (class "custom-footer__cols"))
(div
(p
(img (@ (class "my-logo") (src "/static/breezewiki.svg"))))
(p
(a (@ (href "https://gitdab.com/cadence/breezewiki"))
,(format "~a source code" (config-get 'application_name))))
(p
(a (@ (href "https://lists.sr.ht/~cadence/breezewiki-discuss"))
"Discussions / Bug reports / Feature requests"))
,(if (config-get 'instance_is_official)
`(p ,(format "This instance is run by the ~a developer, " (config-get 'application_name))
(a (@ (href "https://cadence.moe/contact"))
"Cadence."))
`(p
,(format "This unofficial instance is based off the ~a source code, but is not controlled by the code developer." (config-get 'application_name)))))
(div
(p "This page displays proxied content from "
(a (@ (href ,source-url) (rel "noreferrer")) ,source-url)
". Text content is available under the Creative Commons Attribution-Share Alike License 3.0 (Unported), "
(a (@ (href "https://www.fandom.com/licensing")) "see license info.")
" Media files may have different copying restrictions.")
(p ,(format "Fandom is a trademark of Fandom, Inc. ~a is not affiliated with Fandom." (config-get 'application_name))))))))))))
(module+ test (module+ test
(check-not-false (xexp->html (generate-wiki-page "" "test" "test" '(template))))) (check-not-false (xexp->html (generate-wiki-page "" "test" "test" '(template)))))

View file

@ -3,6 +3,7 @@
(require net/url (require net/url
html-writing html-writing
web-server/http web-server/http
"application-globals.rkt"
"xexpr-utils.rkt" "xexpr-utils.rkt"
"config.rkt") "config.rkt")
@ -57,23 +58,7 @@
(div (@ (id "content") #;(class "page-content")) (div (@ (id "content") #;(class "page-content"))
(div (@ (id "mw-content-text")) (div (@ (id "mw-content-text"))
,@content)) ,@content))
(footer (@ (class "custom-footer")) ,(application-footer #f)))))))
(div (@ (class "internal-footer"))
(img (@ (class "my-logo") (src "/static/breezewiki.svg")))
,(if (config-true? 'instance_is_official)
`(div
(p ,(format "This instance is run by the ~a developer, " (config-get 'application_name))
(a (@ (href "https://cadence.moe/contact"))
"Cadence."))
(p "Hosting generously provided by "
(a (@ (href "http://alphamethyl.barr0w.net/"))
"alphamethyl.")))
`(p
,(format "This unofficial instance is based off the ~a source code, but is not controlled by the code developer." (config-get 'application_name))))
(p "Text content on wikis run by Fandom is available under the Creative Commons Attribution-Share Alike License 3.0 (Unported), "
(a (@ (href "https://www.fandom.com/licensing")) "see license info.")
" Media files and official Fandom documents have different copying restrictions.")
(p ,(format "Fandom is a trademark of Fandom, Inc. ~a is not affiliated with Fandom." (config-get 'application_name)))))))))))
(module+ test (module+ test
(check-not-false (xexp->html body))) (check-not-false (xexp->html body)))