namespace leitfaden { /** */ export async function promise_all_stable( promises : Array> ) : Promise> { const result : Array = []; for (const promise of promises) { result.push(await promise); } return result; } /** */ let template_cache : lib_plankton.cache.type_subject; /** */ export async function render( template_name : string, arguments_ : Record ) : Promise { const template_content : string = await lib_plankton.cache.get( template_cache, template_name, null, () => lib_plankton.file.read( lib_plankton.string.coin( "templates/{{name}}.html.tpl", { "name": template_name, } ) ) ); return lib_plankton.string.coin( template_content, arguments_ ); } /** */ export async function templates_init( ): Promise { template_cache = await lib_plankton.cache.make(); } /** */ let tabs_count : int = 0; /** */ export function tabs( sections : Array< { name : string; title : string; content : string; } > ) : Promise { tabs_count += 1; const identifier : string = tabs_count.toFixed(0).padStart(4, "0"); return render( "tabs", { "id": lib_plankton.string.coin( "tabs-{{identifier}}", { "identifier": identifier, } ), "head": ( sections .map( (section, index) => lib_plankton.string.coin( "