Update Core.js
This commit is contained in:
parent
2096a1fd9a
commit
8de5ff9ce2
1 changed files with 6 additions and 2 deletions
8
Core.js
8
Core.js
|
|
@ -234,6 +234,7 @@ class SimonUp {
|
||||||
return `<h${level} id="${id}">${title}</h${level}>${rest}`;
|
return `<h${level} id="${id}">${title}</h${level}>${rest}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Explizit deklarierte Regeln für die Schleife
|
||||||
const inlineRules = [
|
const inlineRules = [
|
||||||
{ tag: 'strong', symbol: '\\*\\*' },
|
{ tag: 'strong', symbol: '\\*\\*' },
|
||||||
{ tag: 'span style="font-weight: 500;"', symbol: '\\*' },
|
{ tag: 'span style="font-weight: 500;"', symbol: '\\*' },
|
||||||
|
|
@ -246,15 +247,18 @@ class SimonUp {
|
||||||
{ tag: 'code', symbol: '`' }
|
{ tag: 'code', symbol: '`' }
|
||||||
];
|
];
|
||||||
|
|
||||||
inlineRules.forEach(rule => {
|
// Klassische Schleife verhindert Scope-Verwirrungen des Parsers
|
||||||
|
for (const rule of inlineRules) {
|
||||||
let regex = new RegExp(`${rule.symbol}(.+?)\/${rule.symbol}`, 'g');
|
let regex = new RegExp(`${rule.symbol}(.+?)\/${rule.symbol}`, 'g');
|
||||||
html = html.replace(regex, `<${rule.tag}>$1</${rule.tag.split(' ')[0]}>`);
|
html = html.replace(regex, `<${rule.tag}>$1</${rule.tag.split(' ')[0]}>`);
|
||||||
|
|
||||||
let resetRegex = new RegExp(`${rule.symbol}(.+?)(?=)`, 'g');
|
let resetRegex = new RegExp(`${rule.symbol}(.+?)(?=)`, 'g');
|
||||||
html = html.replace(resetRegex, `<${rule.tag}>$1</${rule.tag.split(' ')[0]}>`);
|
html = html.replace(resetRegex, `<${rule.tag}>$1</${rule.tag.split(' ')[0]}>`);
|
||||||
});
|
}
|
||||||
|
|
||||||
html = html.replace(//g, '');
|
html = html.replace(//g, '');
|
||||||
|
|
||||||
|
// Absolut isolierte Definition für alignMap
|
||||||
const alignMap = { l: 'left', r: 'right', c: 'center', j: 'justify' };
|
const alignMap = { l: 'left', r: 'right', c: 'center', j: 'justify' };
|
||||||
html = html.replace(/>([lrcj])\s+(.+?)\s*\/>/g, (m, dir, content) => {
|
html = html.replace(/>([lrcj])\s+(.+?)\s*\/>/g, (m, dir, content) => {
|
||||||
return `<div style="text-align: ${alignMap[dir]};">${content}</div>`;
|
return `<div style="text-align: ${alignMap[dir]};">${content}</div>`;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue