Dernière activité 1717872673

Using the FoundryVTT markdown export plugin, convert those files to dokuwiki things, and give a Table of Contents

Révision 5c75c9b06f485109a6cd3bdeef90297486808579

foundry-to-dokuwiki.sh Brut
1#!/bin/bash
2
3set -e
4
5SRC=$1
6DST=$2
7
8# Create dokuwiki files "in place" or rather, alongside markdown
9find "$SRC" -iname "*.md" -type f -exec sh -c 'pandoc -f markdown -t dokuwiki "${0}" -o "${0%.md}.txt"' {} \;
10
11# Copy over the dokuwiki .txt files, flatten along the way:
12# FoundryVTT uses uuids so names shouldn't clash
13find "$SRC" -mindepth 1 -type f -iname "*.txt" -exec cp -t "$DST" -i '{}' +
14
15# Move into destination folder for renaming
16cd $DST
17
18# Do the rename
19rename 'y/A-Z/a-z/' *
20
21# While here, spit out a TOC of top level journal name links
22# TODO: Make the dg:foundry: dokuwiki namespace prefix configurable
23find . -regex '.*journalentry\.[a-z0-9]+\.txt' -exec grep -m 1 -H '.' {} \; | sed -E 's/\.\/(journalentry\.[a-z0-9]+)\.txt:====== (.*) ======/ \* [[dg:foundry:\1|\2]]/'
24
25# Go back
26cd -