Skip to content

Commit 1493d82

Browse files
committed
Fix Docu: unintended line breaks before images#2247
1 parent 22498a5 commit 1493d82

File tree

1 file changed

+19
-19
lines changed
  • Console/BExIS.Web.Shell.Svelte/src/routes/home/docs/[...slug]/[category]

1 file changed

+19
-19
lines changed

Console/BExIS.Web.Shell.Svelte/src/routes/home/docs/[...slug]/[category]/+page.svelte

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -221,28 +221,28 @@
221221
const svg_save =
222222
'<svg class="svelte-fa svelte-fa-base undefined svelte-bvo74f inline" viewBox="0 0 448 512" aria-hidden="true" role="img" xmlns="http://www.w3.org/2000/svg"><g transform="translate(224 256)" transform-origin="112 0"><g transform="translate(0,0) scale(1,1)"><path d="M64 32C28.7 32 0 60.7 0 96L0 416c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-242.7c0-17-6.7-33.3-18.7-45.3L352 50.7C340 38.7 323.7 32 306.7 32L64 32zm0 96c0-17.7 14.3-32 32-32l192 0c17.7 0 32 14.3 32 32l0 64c0 17.7-14.3 32-32 32L96 224c-17.7 0-32-14.3-32-32l0-64zM224 288a64 64 0 1 1 0 128 64 64 0 1 1 0-128z" fill="currentColor" transform="translate(-256 -256)"></path></g></g></svg>';
223223
224-
if (text.startsWith('[!LINK_VIEW]')) {
225-
return `<div class="inline-flex not-prose mt-2"><div class="mr-1 ">${svg_view}</div><a class="underline" href="${href}" title="${title || ''} ">${text.replace('[!LINK_VIEW]', '').trim()}</a></div>`;
224+
const icons = {};
225+
icons['[!LINK_VIEW]'] = svg_view;
226+
icons['[!LINK_EDIT]'] = svg_edit;
227+
icons['[!LINK_CREATE]'] = svg_add;
228+
icons['[!LINK_DELETE]'] = svg_delete;
229+
icons['[!LINK_MANAGE]'] = svg_manage;
230+
icons['[!LINK_CONFIGURE]'] = svg_configure;
231+
icons['[!LINK_SAVE]'] = svg_save;
232+
233+
// use regex to extract the link type and the rest of the text
234+
const text_type = text.match(/(\[!LINK_[A-Z]+\])/);
235+
if (!text_type) {
236+
return `<a class="underline" href="${href}" title="${title || ''}">${text}</a>`;
226237
}
227-
if (text.startsWith('[!LINK_EDIT]')) {
228-
return `<div class="inline-flex not-prose"><div class="mr-1">${svg_edit}</div><a class="underline" href="${href}" title="${title || ''} ">${text.replace('[!LINK_EDIT]', '').trim()}</a></div>`;
238+
const text_rest = text.replace(text_type[0], '').trim();
239+
if (text_type[0] in icons) {
240+
return `<span class="inline-flex not-prose mt-2"><span class="mr-1 ">${icons[text_type[0]]}</span><a class="underline" href="${href}" title="${title || ''} ">${text_rest}</a></span>`;
229241
}
230-
if (text.startsWith('[!LINK_CREATE]')) {
231-
return `<div class="inline-flex not-prose"><div class="mr-1 ">${svg_add}</div><a class="underline" href="${href}" title="${title || ''} ">${text.replace('[!LINK_CREATE]', '').trim()}</a></div>`;
242+
else
243+
{
244+
return `<a class="underline" href="${href}" title="${title || ''}">${text}</a>`;
232245
}
233-
if (text.startsWith('[!LINK_DELETE]')) {
234-
return `<div class="inline-flex not-prose"><div class="mr-1 ">${svg_delete}</div><a class="underline" href="${href}" title="${title || ''} ">${text.replace('[!LINK_DELETE]', '').trim()}</a></div>`;
235-
}
236-
if (text.startsWith('[!LINK_MANAGE]')) {
237-
return `<div class="inline-flex not-prose"><div class="mr-1 ">${svg_manage}</div><a class="underline" href="${href}" title="${title || ''} ">${text.replace('[!LINK_MANAGE]', '').trim()}</a></div>`;
238-
}
239-
if (text.startsWith('[!LINK_CONFIGURE]')) {
240-
return `<div class="inline-flex not-prose"><div class="mr-1 ">${svg_configure}</div><a class="underline" href="${href}" title="${title || ''} ">${text.replace('[!LINK_CONFIGURE]', '').trim()}</a></div>`;
241-
}
242-
if (text.startsWith('[!LINK_SAVE]')) {
243-
return `<div class="inline-flex not-prose"><div class="mr-1 ">${svg_save}</div><a class="underline" href="${href}" title="${title || ''} ">${text.replace('[!LINK_SAVE]', '').trim()}</a></div>`;
244-
}
245-
return `<a class="underline" href="${href}" title="${title || ''}">${text}</a>`;
246246
};
247247
248248
async function toggleVisibility(index: number, init = false) {

0 commit comments

Comments
 (0)