Autofix some markdown
This commit is contained in:
		
							parent
							
								
									94982fbfa9
								
							
						
					
					
						commit
						a05ce3d8ec
					
				| 
						 | 
				
			
			@ -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``;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue