summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordan <[email protected]>2023-03-10 21:40:18 -0500
committerdan <[email protected]>2023-03-10 21:40:18 -0500
commit9fe05d3aeefedd0d96606f18ec1fa0415b500b32 (patch)
treefe67e33ee33e60d0f1d64a4a5cbdf8d2dccb33de
parent7698a174d89cd9ff814c55a456b3444df9e439cd (diff)
download54-9fe05d3aeefedd0d96606f18ec1fa0415b500b32.tar.gz
54-9fe05d3aeefedd0d96606f18ec1fa0415b500b32.tar.bz2
54-9fe05d3aeefedd0d96606f18ec1fa0415b500b32.zip
fix: links display correctly when text is after them
-rw-r--r--main.scm28
-rw-r--r--style.css8
2 files changed, 18 insertions, 18 deletions
diff --git a/main.scm b/main.scm
index f6a049c..0027a30 100644
--- a/main.scm
+++ b/main.scm
@@ -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"])
diff --git a/style.css b/style.css
index 4bd93b0..252aab8 100644
--- a/style.css
+++ b/style.css
@@ -200,11 +200,3 @@ textarea {
min-height:0.5em;
white-space:pre-wrap;
}
-
-.content-link {
- display: inline-block;
-}
-
-.content-text {
- display: inline-block;
-}