From 39c620c2703f7d4afcb16ee03ea6259393af9a4a Mon Sep 17 00:00:00 2001 From: servostar Date: Thu, 22 Aug 2024 10:51:35 +0200 Subject: [PATCH] add domain name after url text (#46) --- src/lib.typ | 8 +++++++- template/main.typ | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib.typ b/src/lib.typ index 5496030..d752a4e 100644 --- a/src/lib.typ +++ b/src/lib.typ @@ -40,7 +40,13 @@ } #let url(label, content) = { - link(label)[#underline(offset: 2pt, stroke: 0.5pt + blue, text(fill: blue, content))] + link(label)[#underline(offset: 2pt, stroke: 0.5pt + blue, text(fill: blue)[ + #content + #let domain = label.find(regex("\w+\.\w+(?:\.\w+)*")) + #if domain.len() > 0 [ + (#domain) + ] + ])] } // start of template pages and styles diff --git a/template/main.typ b/template/main.typ index 2765dc8..9f4d232 100644 --- a/template/main.typ +++ b/template/main.typ @@ -68,7 +68,7 @@ $ lorem(200), ) -#url("https://github.com", "text (github.com)") +#url("https://github.com", "text") #lorem(50)