From c021515896617a53eb819dfeca04592148be58c7 Mon Sep 17 00:00:00 2001 From: eliott <eliott.sammier@tetras-libre.fr> Date: Wed, 31 Jul 2024 17:32:00 +0200 Subject: [PATCH] mt:module template more legible --- tetras_extraction/script/templates/module.rq | 24 ++++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/tetras_extraction/script/templates/module.rq b/tetras_extraction/script/templates/module.rq index e2a3c458..f48e7a89 100644 --- a/tetras_extraction/script/templates/module.rq +++ b/tetras_extraction/script/templates/module.rq @@ -5,23 +5,17 @@ PREFIX st: <http://ns.inria.fr/sparql-template/> # Recursive template for Modules and SousParties (because SousParties are just # leaf-level modules) template mt:module(?mod) { - mt:start_marker(?mod) "/_index.md" st:nl() - format { - """+++ -title = "%s" -%sbookCollapseSection = true -+++ + mt:start_marker(?mod) "/_index.md" "\n" -# %1$s + "+++\n" + 'title = "' ?title '"\n' + coalesce(st:format("weight = %s\n", ?weight * 10), "") + "bookCollapseSection = true\n" + "+++\n\n" -{{< section >}} -""" - # STTL format{} apparently supports printf-style format string syntax - # (not explicitly documented but confirmed from testing), including - # "%1$" position specifiers, which allows reusing the 1st param by index - ?title - coalesce(st:format("weight = %s\n", ?weight * 10), "") - } st:nl() + "# " ?title "\n\n" + + "{{< section >}}\n\n" group { st:call-template(mt:module, ?child) ; separator='' -- GitLab