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 dtext = sol.defined(description) ? description : "";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const text = atext.length >= dtext.length ? atext : dtext;
 | 
					    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`
 | 
					    return html`
 | 
				
			||||||
    <div class="event-description">
 | 
					    <div class="event-description">
 | 
				
			||||||
      <div class="event-description-title">Beschreibung:</div>
 | 
					      <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>`;
 | 
					    </div>`;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -56,13 +58,15 @@ const event_content = (event) =>
 | 
				
			||||||
const speaker_info = (speaker, count) => {
 | 
					const speaker_info = (speaker, count) => {
 | 
				
			||||||
    const name = serv.fix_dash(sol.personName(speaker));
 | 
					    const name = serv.fix_dash(sol.personName(speaker));
 | 
				
			||||||
    const bio = sol.personBiography(speaker);
 | 
					    const bio = sol.personBiography(speaker);
 | 
				
			||||||
 | 
					    const btext = sol.defined(bio) ? bio : "";
 | 
				
			||||||
 | 
					    const bio_fixed = serv.fix_markdown_urls(btext);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let inner;
 | 
					    let inner;
 | 
				
			||||||
    if (sol.defined(bio) && bio.length >= minBioLength) {
 | 
					    if (sol.defined(bio) && bio.length >= minBioLength) {
 | 
				
			||||||
        inner = html`
 | 
					        inner = html`
 | 
				
			||||||
        <div class="speaker-info">
 | 
					        <div class="speaker-info">
 | 
				
			||||||
          <div class="speaker-name">${name}</div>
 | 
					          <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>`;
 | 
					        </div>`;
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        inner = html``;
 | 
					        inner = html``;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,10 +36,25 @@ const fix_dash = (string) =>
 | 
				
			||||||
    string.replace(ndash_fix_regexp, ndash_fix_replacement);
 | 
					    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 {
 | 
					export {
 | 
				
			||||||
    process_data,
 | 
					    process_data,
 | 
				
			||||||
    track_index,
 | 
					    track_index,
 | 
				
			||||||
    sort_tracks,
 | 
					    sort_tracks,
 | 
				
			||||||
    person_names_concat,
 | 
					    person_names_concat,
 | 
				
			||||||
    fix_dash
 | 
					    fix_dash,
 | 
				
			||||||
 | 
					    fix_markdown,
 | 
				
			||||||
 | 
					    fix_markdown_urls
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue