From 2babefddb5b38b7a2d65c528c246a2e6705660a4 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sun, 19 Jun 2022 21:53:30 +0200 Subject: convert meta and tag directives to TOML frontmatter command: ``` find * -type f -name '*.md' -execdir perl -MTOML::Tiny=to_toml -C63 -gni -E '%x=();s/\[\[!meta\s+(title|date)="?([^\]"]+?)\s*"?\s*\]\]\s*\n*/$x{$1}=$2;""/eg; s/\[\[!meta\s+stylesheet="?edu"?\s+rel="?stylesheet"?\s*\]\]\n*/$x{taxonomies}{categories}=["education"];""/e; s/\[\[!tag((?:\s+[^\]\s]+)+)\s*\]\]\n*/push @{$x{taxonomies}{tags}}, $1=~m{\S+}g;""/eg; s/\[\[!meta\s+(?:author|name)="?([^\]"]+?)\s*"?\s*\]\]\s*\n*/$x{extra}{author}=$1;""/eg; say "+++"; say to_toml({%x}); say "+++"; say $_' '{}' + ``` --- test2/index.md | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test2') diff --git a/test2/index.md b/test2/index.md index 976e1b9a..03f9e4d2 100644 --- a/test2/index.md +++ b/test2/index.md @@ -1,3 +1,6 @@ ++++ + ++++ [[!if test="included()" then=""" {{ img(path="tours/vindue_turliste.jpg" class="solo" link="tours" size="480x") }} """ @@ -10,3 +13,4 @@ else=""" [[!inline pages="events" raw="yes"]] """]] + -- cgit v1.2.3