diff options
Diffstat (limited to 'scripts/subpages.jq')
-rw-r--r-- | scripts/subpages.jq | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/subpages.jq b/scripts/subpages.jq new file mode 100644 index 0000000..4850703 --- /dev/null +++ b/scripts/subpages.jq | |||
@@ -0,0 +1,8 @@ | |||
1 | [ | ||
2 | .[] | ||
3 | | . as $page | ||
4 | | (.namespace | ltrimstr($namespace + "/") | split("/") | (.[] |= ["pages",.]) | flatten) as $path | ||
5 | | null | ||
6 | | setpath($path; $page) | ||
7 | ] | ||
8 | | reduce .[] as $item ({}; . * $item) | ||