dgwk25-huginfo/assets/js/custom/services/service.js

61 lines
1.4 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use strict';
import * as lodash from "../../lodash/lodash-core.js";
import * as sol from "../../solight/sol.js";
const process_data = (scheduleFile) =>
sol.processScheduleFile(scheduleFile);
const trackIndexMap = new Map([
['Andere', 0],
['Ethik, Wissenschaft, Kultur & Gesellschaft', 1],
['Recht & Politik', 2],
['Netzwerke, Security, Hard- & Software', 3],
['Digitale Selbstverteidigung', 4]]);
const track_index = (track) =>
trackIndexMap.get(track);
const sort_tracks = (tracks) =>
lodash.sortBy(tracks, track_index);
const person_names_concat = (persons) =>
// persons.map(p => sol.personName(p)).join(', ');
// persons.map(p => sol.personName(p)).join(' & ');
persons.map(p => sol.personName(p)).join(' · ');
const ndash_fix_regexp = RegExp('\\s+-\\s+');
const ndash_fix_replacement = ' ';
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_markdown,
fix_markdown_urls
}