From d3b869e52d13d77995c8d2dd35ccadfe7d950214 Mon Sep 17 00:00:00 2001 From: Andre Alves Garzia Date: Wed, 16 Feb 2022 19:04:13 +0000 Subject: [PATCH] adding a suffix to web links in gemini-renderer% --- config.rkt | 2 +- renderers/gemini-renderer.rkt | 9 +++++++++ styles.rkt | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/config.rkt b/config.rkt index bb91017..db9173f 100644 --- a/config.rkt +++ b/config.rkt @@ -26,6 +26,6 @@ version ;; Config parameters -(define debug-mode? (make-parameter #t)) +(define debug-mode? (make-parameter #f)) diff --git a/renderers/gemini-renderer.rkt b/renderers/gemini-renderer.rkt index f3275c6..4b84feb 100644 --- a/renderers/gemini-renderer.rkt +++ b/renderers/gemini-renderer.rkt @@ -1,6 +1,7 @@ #lang racket/gui (require + net/url "../styles.rkt" "../config.rkt" "../persist.rkt" @@ -123,9 +124,17 @@ [(eq? level 5) (insert-with-styles txt (cons h5-style style-list))] [(eq? level 6) (insert-with-styles txt (cons h6-style style-list))] [else (insert-with-styles txt (cons h6-style style-list))])) + (define (glyph-for-schema link) + (define u (string->url link)) + (define s (or (url-scheme u) "")) + (cond + [(equal? s "gemini") ""] + [(string-prefix? s "http") " (web)"] + [else ""])) (define (insert-link link label style-list) (when (not (non-empty-string? label)) (set! label link)) + (set! label (string-append label (glyph-for-schema link))) (let ((start (send text last-position))) (insert-with-styles label (cons hyperlink-style style-list)) (define end (send text last-position)) diff --git a/styles.rkt b/styles.rkt index 39d03da..a97901d 100644 --- a/styles.rkt +++ b/styles.rkt @@ -18,7 +18,7 @@ (let ([delta (make-object style-delta%)]) (send delta set-delta-foreground (make-object color% 68 119 170)) (send delta set-alignment-on 'base) - (send delta set-underlined-on #t) + (send delta set-underlined-on #f) delta)) ;; Style used for hyperlinks when clicked on -- 2.45.2