Autofix some markdown

This commit is contained in:
Ral 2025-02-26 20:32:45 +01:00
parent 94982fbfa9
commit a05ce3d8ec
2 changed files with 22 additions and 3 deletions

View File

@ -42,11 +42,13 @@ const event_description = (event) => {
const dtext = sol.defined(description) ? description : "";
const text = atext.length >= dtext.length ? atext : dtext;
const text_fixed = serv.fix_markdown(text);
const text_fixed_urls = serv.fix_markdown_urls(text_fixed);
return html`
<div class="event-description">
<div class="event-description-title">Beschreibung:</div>
<div class="event-description-text" lang="de">${text}</div>
<div class="event-description-text" lang="de">${text_fixed_urls}</div>
</div>`;
};
@ -56,13 +58,15 @@ const event_content = (event) =>
const speaker_info = (speaker, count) => {
const name = serv.fix_dash(sol.personName(speaker));
const bio = sol.personBiography(speaker);
const btext = sol.defined(bio) ? bio : "";
const bio_fixed = serv.fix_markdown_urls(btext);
let inner;
if (sol.defined(bio) && bio.length >= minBioLength) {
inner = html`
<div class="speaker-info">
<div class="speaker-name">${name}</div>
<div class="speaker-bio speaker-count-${count}" lang="de">${bio}</div>
<div class="speaker-bio speaker-count-${count}" lang="de">${bio_fixed}</div>
</div>`;
} else {
inner = html``;

View File

@ -36,10 +36,25 @@ const fix_dash = (string) =>
string.replace(ndash_fix_regexp, ndash_fix_replacement);
const markdown_fix_regexp = '**';
const markdown_fix_replacement = '';
const fix_markdown = (string) =>
string.replaceAll(markdown_fix_regexp, markdown_fix_replacement);
const url_fix_regexp = RegExp('\\[([^\\]]+)\\]\\([^)]+\\)', "g");
const fix_markdown_urls = (string) =>
string.replace(url_fix_regexp, '$1');
export {
process_data,
track_index,
sort_tracks,
person_names_concat,
fix_dash
fix_dash,
fix_markdown,
fix_markdown_urls
}