diff options
author | dan <[email protected]> | 2023-03-10 21:40:18 -0500 |
---|---|---|
committer | dan <[email protected]> | 2023-03-10 21:40:18 -0500 |
commit | 9fe05d3aeefedd0d96606f18ec1fa0415b500b32 (patch) | |
tree | fe67e33ee33e60d0f1d64a4a5cbdf8d2dccb33de | |
parent | 7698a174d89cd9ff814c55a456b3444df9e439cd (diff) | |
download | 54-9fe05d3aeefedd0d96606f18ec1fa0415b500b32.tar.gz 54-9fe05d3aeefedd0d96606f18ec1fa0415b500b32.tar.bz2 54-9fe05d3aeefedd0d96606f18ec1fa0415b500b32.zip |
fix: links display correctly when text is after them
-rw-r--r-- | main.scm | 28 | ||||
-rw-r--r-- | style.css | 8 |
2 files changed, 18 insertions, 18 deletions
@@ -183,8 +183,13 @@ (let ([r "(https://[^ ]*)"]) (if (irregex-search r content) (let* ([starts-with-link (= 0 (irregex-match-start-index (irregex-search r content)))] - [texts (map (cut list 'div '(@ [class "content-text"]) <>) (irregex-split r content))] - [links (map (lambda (x) `(a (@ [href ,x] [class "content-link"]) ,x)) (irregex-extract r content))]) + [texts (map (cut list 'span <>) (irregex-split r content))] + [links (map (lambda (x) + `(a (@ [href ,x] + [target "_blank"] + [rel "noreferrer"]) + ,x)) (irregex-extract r content))]) + (display `(,texts ,links)) (define (go xs ys take-y?) (cond [(and (not (null-list? ys)) take-y?) @@ -250,14 +255,17 @@ )) (define (page inner) - (with-output-to-string (lambda () - (sxml-display-as-html - `(html (head - (link (@ [rel "stylesheet"] [href "/style.css"])) - (meta (@ [name "viewport"] [content "width=device-width, initial-scale=1"]))) - (body - ,inner - )))))) + (string-append + "<!DOCTYPE html>" + (with-output-to-string + (lambda () + (sxml-display-as-html + `(html (head + (link (@ [rel "stylesheet"] [href "/style.css"])) + (meta (@ [name "viewport"] [content "width=device-width, initial-scale=1"]))) + (body + ,inner + ))))))) (define login-form `(form (@ [class "login-form"] [action "/login"] [method "POST"]) @@ -200,11 +200,3 @@ textarea { min-height:0.5em; white-space:pre-wrap; } - -.content-link { - display: inline-block; -} - -.content-text { - display: inline-block; -} |