-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathgenerate.sh
More file actions
executable file
·30 lines (21 loc) · 964 Bytes
/
generate.sh
File metadata and controls
executable file
·30 lines (21 loc) · 964 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
########################################################################
# Generate github markdown pages from confluence export
########################################################################
# From https://stackoverflow.com/a/246128
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
set -e
echo "Creating output directories"
mkdir -pv out/page-xml
mkdir -pv out/wiki/images
echo "Generating page xmls and image mapping"
xsltproc --stringparam dtd-path "$SCRIPT_DIR/page.dtd" $SCRIPT_DIR/entities.xsl entities.xml
echo "Copying images from attachments"
xsltproc $SCRIPT_DIR/image-mappings.xsl out/image-mappings.xml | bash
echo "Convert page xmls to github markdown"
for PAGE_PATH in out/page-xml/*.xml; do
PAGE_XML=${PAGE_PATH##out/page-xml/}
PAGE_MD=${PAGE_XML%%.xml}.md
xsltproc --path . $SCRIPT_DIR/page.xsl "${PAGE_PATH}" > "out/wiki/${PAGE_MD}"
done
echo "Content generated to out/wiki"