diff --git a/webgis/js/components/Reuse.js b/webgis/js/components/Reuse.js
index fd6fd01..4bf12bf 100644
--- a/webgis/js/components/Reuse.js
+++ b/webgis/js/components/Reuse.js
@@ -62,7 +62,7 @@ export class Reuse {
imageContainer.innerHTML = '
Nessuna risorsa visuale disponibile
';
}
/**
- * @param {number} recordId
+ * @param {Number} recordId
*/
async biblio(recordId) {
let {citations, biblioElements} = await Utils.buildBibliography('reuse', recordId);
diff --git a/webgis/js/components/SiteSheet.js b/webgis/js/components/SiteSheet.js
index c2c30af..5b7bb66 100644
--- a/webgis/js/components/SiteSheet.js
+++ b/webgis/js/components/SiteSheet.js
@@ -1,3 +1,4 @@
+import Utils from "./utils.js";
/**
* Component to render data for site sheet
* @class SiteSheet
@@ -60,6 +61,9 @@ export class SiteSheet {
}
renderShort() {
+ // TEST
+ const shortDesc = Utils.parseMarkers(this._siteData.shortDescription);
+
return `
@@ -81,7 +85,7 @@ export class SiteSheet {
Località generica: ${this._siteData.genericPlace}
- ${this._siteData.shortDescription}
+ ${shortDesc}
diff --git a/webgis/js/components/utils.js b/webgis/js/components/utils.js
index 6f2e657..7d9e621 100644
--- a/webgis/js/components/utils.js
+++ b/webgis/js/components/utils.js
@@ -144,6 +144,30 @@ Utils.buildBibliography = async function(recordUri, recordId) {
return bibliography;
}
+/**
+ *
+ * @param {String} text - The content text from database
+ * Parse marker strings (pseudo-shortcodes) and convert them
+ * to Stimulus links
+ */
+Utils.parseMarkers = function(text) {
+ const regex = /(?\[marker coords=\"(?[\d\s\.]+)\"\](?[\w\s\.;:\-]+)\[\/marker\])/mig;
+ let matches = [...text.matchAll(regex)];
+
+ if (matches.length) {
+ matches.forEach(match => {
+ const replacement = `
+
+ ${match.groups.content}
+
+ `;
+ text = text.replace(match.groups.marker, replacement);
+ });
+ }
+
+ return text;
+}
+
Utils.fetchData = async function(url) {
return await fetch(url).then(res => res.ok ? res.json() : new Error())
.catch(err => console.log(err));