From b0915d0973c8cda068399e575b71ea33e167370e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20P?= Date: Wed, 12 Nov 2025 17:16:53 +0100 Subject: [PATCH] Simplify marker regex + link CSS --- webgis/js/components/utils.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/webgis/js/components/utils.js b/webgis/js/components/utils.js index 5cebc3a..5500480 100644 --- a/webgis/js/components/utils.js +++ b/webgis/js/components/utils.js @@ -4,7 +4,6 @@ import { GisState } from "../state.js"; */ const Utils = {}; - /** * * @param {string} galleryId The image gallery's id @@ -145,13 +144,12 @@ Utils.buildBibliography = async function(recordUri, recordId) { } /** - * - * @param {String} text - The content text from database * Parse marker strings (pseudo-shortcodes) and convert them * to Stimulus links + * @param {String} text - The content text from database */ Utils.parseMarkers = function(text) { - const regex = /(?\[marker coords=\"(?[\d\s\.]+)\"\ ?(group=\"(?\w+)\")?](?[\w\d\s\.;,:\-\(\)\"\']+)\[\/marker\])/mig; + const regex = /(?\[marker coords=\"(?[\d\s\.]+)\"\ ?(group=\"(?\w+)\")?](?[\s\S]+?)\[\/marker\])/mig; if (!text) return text; @@ -159,9 +157,9 @@ Utils.parseMarkers = function(text) { if (matches.length) { matches.forEach(match => { - const replacement = ` - ${match.groups.content}`; + const replacement = `${match.groups.content.trim()}`; text = text.replace(match.groups.marker, replacement.trim()); }); }