draggor 已修改 . 還原成這個修訂版本
1 file changed, 1 insertion, 1 deletion
foundry-to-dokuwiki.sh
| @@ -5,7 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | 6 | set -e | |
| 7 | 7 | ||
| 8 | - | # Change PREFIX to be optional, get some argparse type things going | |
| 8 | + | # TODO: Change PREFIX to be optional, get some argparse type things going | |
| 9 | 9 | PREFIX=$1 | |
| 10 | 10 | SRC=$2 | |
| 11 | 11 | DST=$3 | |
draggor 已修改 . 還原成這個修訂版本
1 file changed, 5 insertions, 4 deletions
foundry-to-dokuwiki.sh
| @@ -5,8 +5,10 @@ | |||
| 5 | 5 | ||
| 6 | 6 | set -e | |
| 7 | 7 | ||
| 8 | - | SRC=$1 | |
| 9 | - | DST=$2 | |
| 8 | + | # Change PREFIX to be optional, get some argparse type things going | |
| 9 | + | PREFIX=$1 | |
| 10 | + | SRC=$2 | |
| 11 | + | DST=$3 | |
| 10 | 12 | ||
| 11 | 13 | # Create dokuwiki files "in place" or rather, alongside markdown | |
| 12 | 14 | find "$SRC" -iname "*.md" -type f -exec sh -c 'pandoc -f markdown -t dokuwiki "${0}" -o "${0%.md}.txt"' {} \; | |
| @@ -22,8 +24,7 @@ cd $DST | |||
| 22 | 24 | rename 'y/A-Z/a-z/' * | |
| 23 | 25 | ||
| 24 | 26 | # While here, spit out a TOC of top level journal name links | |
| 25 | - | # TODO: Make the dg:foundry: dokuwiki namespace prefix configurable | |
| 26 | - | find . -regex '.*journalentry\.[a-z0-9]+\.txt' -exec grep -m 1 -H '.' {} \; | sed -E 's/\.\/(journalentry\.[a-z0-9]+)\.txt:====== (.*) ======/ \* [[dg:foundry:\1|\2]]/' | |
| 27 | + | find . -regex '.*journalentry\.[a-z0-9]+\.txt' -exec grep -m 1 -H '.' {} \; | sed -E "s/\.\/(journalentry\.[a-z0-9]+)\.txt:====== (.*) ======/ \* [[$PREFIX\1|\2]]/" | |
| 27 | 28 | ||
| 28 | 29 | # Go back | |
| 29 | 30 | cd - | |
draggor 已修改 . 還原成這個修訂版本
1 file changed, 3 insertions
foundry-to-dokuwiki.sh
| @@ -1,5 +1,8 @@ | |||
| 1 | 1 | #!/bin/bash | |
| 2 | 2 | ||
| 3 | + | # This is the FoundryVTT export plugin used to generate these markdown files: | |
| 4 | + | # https://foundryvtt.com/packages/export-markdown | |
| 5 | + | ||
| 3 | 6 | set -e | |
| 4 | 7 | ||
| 5 | 8 | SRC=$1 | |
draggor 已修改 . 還原成這個修訂版本
1 file changed, 26 insertions
foundry-to-dokuwiki.sh(檔案已創建)
| @@ -0,0 +1,26 @@ | |||
| 1 | + | #!/bin/bash | |
| 2 | + | ||
| 3 | + | set -e | |
| 4 | + | ||
| 5 | + | SRC=$1 | |
| 6 | + | DST=$2 | |
| 7 | + | ||
| 8 | + | # Create dokuwiki files "in place" or rather, alongside markdown | |
| 9 | + | find "$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 | |
| 13 | + | find "$SRC" -mindepth 1 -type f -iname "*.txt" -exec cp -t "$DST" -i '{}' + | |
| 14 | + | ||
| 15 | + | # Move into destination folder for renaming | |
| 16 | + | cd $DST | |
| 17 | + | ||
| 18 | + | # Do the rename | |
| 19 | + | rename '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 | |
| 23 | + | find . -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 | |
| 26 | + | cd - | |