diff --git a/.github/actions/wiki_sync/refactor.sh b/.github/actions/wiki_sync/refactor.sh
new file mode 100755
index 0000000..3d79098
--- /dev/null
+++ b/.github/actions/wiki_sync/refactor.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+# 'docs' folder needs to be set as the working directory
+
+# Declare arrays
+declare -a titles
+declare -a keys
+
+# Special characters that are used for refactoring
+dash=$(echo -e "\xE2\x80\x90")
+dash_url="%E2%80%90"
+colon=$(echo -e "\xEA\x9E\x89")
+colon_url="%EA%9E%89"
+
+# Output colors
+cyan="\033[1;36m"
+green="\033[1;32m"
+reset="\033[0m"
+
+# Store the file name and id for each extension
+# Also refactor the file names
+cd Extensions
+for file in XLE-*.md; do
+ id=$(grep -oP "XLE-\K[0-9]+" <<< ${file%.md})
+ name=$(grep -oP "XLE-([0-9]+)=\K.*" <<< ${file%.md})
+ keys[$id]=$(sed -e "s/-/$dash/g" -e "s/_/-/g" <<< $name)
+ titles[$id]=$(sed "s/_/ /g" <<< $name)
+ echo -e "${cyan}Found '${green}XLE-$id${cyan}: ${titles[$id]}' ${reset}(Refactoring to '${keys[$id]}')"
+ mv $file "XLE$dash$id$colon-${keys[$id]}.md"
+done
+
+# Refactor extension set file names
+cd ../Extension\ Sets
+extset_list=""
+extset_list_macro='\${EXTSET_LIST}'
+for file in *.md; do
+ name=$(grep -oP '\`\K(.*?)(?=\`)' <<< "$file")
+ renamed=$(sed -e "s/-/$dash/g" -e "s/_/-/g" <<< "$file")
+ extset_list="$extset_list[$name](Extension-Set-$renamed)\n\n"
+ echo -e "${cyan}Found extension set \`${green}$name${cyan}\` ${reset}(Renaming to 'Extension-Set-$renamed')"
+ mv $file "Extension-Set-$renamed"
+done
+
+# Replace ${XLE-#}, ${XLE-#_LINK}, and ${XLE-#_NAME} macros in each file
+cd ..
+for file in ./Extensions/*.md ./Extension\ Sets/*.md; do
+ for id in $(grep -oP '\${XLE-\K([0-9]+)(?=.*?})' "$file" | sort -u); do
+ macro_prefix='\${XLE-'$id
+ link="XLE$dash_url$id$colon_url-${keys[$id]}"
+ name="${titles[$id]}"
+ sed -i \
+ -e "s|${macro_prefix}}|[XLE-$id: $name]($link)
|g" \
+ -e "s|${macro_prefix}_LINK}|$link|g" \
+ -e "s|${macro_prefix}_NAME}|$name|g" \
+ "$file"
+ done;
+done
+
+# Replace ${XLE_LIST} and ${EXTSET_LIST}in _Sidebar.md
+ext_list=""
+ext_list_macro='\${XLE_LIST}'
+for id in "${!titles[@]}"; do
+ ext_list="$ext_list[XLE-$id: ${titles[$id]}](XLE$dash_url$id$colon_url-${keys[$id]})
\n"
+done
+sed -i \
+ -e "s|$ext_list_macro|$ext_list|g" \
+ -e "s|$extset_list_macro|$extset_list|g" \
+"_Sidebar.md"
\ No newline at end of file
diff --git a/.github/workflows/wiki_sync.yml b/.github/workflows/wiki_sync.yml
index 3a77540..44fe3ab 100644
--- a/.github/workflows/wiki_sync.yml
+++ b/.github/workflows/wiki_sync.yml
@@ -4,52 +4,23 @@ on:
push:
paths:
- "docs/**"
+ workflow_dispatch:
repository_dispatch:
types: [docs]
- gollum:
+
env:
- docs: $GITHUB_WORKSPACE/main/docs
- wiki: $GITHUB_WORKSPACE/wiki
+ docs: ./main/docs
+ wiki: ./wiki
#suffix: [github-actions-bot]
-jobs:
- check-diff:
- name: Check for changes
- runs-on: ubuntu-latest
- if: github.sender.login != 'github-actions[bot]'
- outputs:
- DIFF: ${{ steps.diff-check.outputs.DIFF }}
- steps:
- - name: Print Sender (For Logging Purposes)
- run: echo "${{ github.event.sender.login }}"
- - name: Checkout Main Repo
- uses: actions/checkout@v3
- with:
- path: main
- - name: Checkout Wiki Repo
- uses: actions/checkout@v3
- with:
- path: wiki
- repository: ${{github.repository}}.wiki
- - name: Check for Differences
- id: diff-check
- run: |
- EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
- echo "DIFF<<$EOF" >> "$GITHUB_OUTPUT"
- # The echo is here to put a newline so that github doesn't complain about a missing newline
- diff -qr --exclude=.git "${{env.docs}}" "${{env.wiki}}" >> "$GITHUB_OUTPUT" && echo "" >> "$GITHUB_OUTPUT"
- echo "$EOF" >> "$GITHUB_OUTPUT"
- - name: Print Output
- run: echo "${{steps.diff-check.outputs.DIFF}}"
-
+
+jobs:
sync:
- name: Sync Docs with Wiki
+ name: Sync Docs to Wiki
runs-on: ubuntu-latest
- needs: check-diff
permissions:
contents: write
- if: needs.check-diff.outputs.DIFF != ''
steps:
- name: Checkout Main Repo
uses: actions/checkout@v3
@@ -62,31 +33,20 @@ jobs:
path: wiki
repository: ${{github.repository}}.wiki
#token: ${{env.token}}
- # Go to source folder
- - name: Set Wiki as Source Folder
- if: github.event_name == 'gollum'
- run: |
- echo "SRC=${{env.wiki}}" >> $GITHUB_ENV
- echo "DST=${{env.docs}}" >> $GITHUB_ENV
- - name: Set Docs as Source Folder
- if: github.event_name != 'gollum'
- run: |
- echo "SRC=${{env.docs}}" >> $GITHUB_ENV
- echo "DST=${{env.wiki}}" >> $GITHUB_ENV
- name: Get Commit Author
id: get-author
- working-directory: ${{env.SRC}}
+ working-directory: ${{env.docs}}
run: echo "AUTHOR=$(git log -1 --format="%an")" >> $GITHUB_OUTPUT
- name: Get Commit Email
id: get-email
- working-directory: ${{env.SRC}}
+ working-directory: ${{env.docs}}
run: echo "EMAIL=$(git log -1 --format="%ae")" >> $GITHUB_OUTPUT
- name: Print Commit Message
- working-directory: ${{env.SRC}}
+ working-directory: ${{env.docs}}
run: echo "$(git log -1 --format="%B")"
- name: Get Commit Message
id: get-message
- working-directory: ${{env.SRC}}
+ working-directory: ${{env.docs}}
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "MESSAGE<<$EOF" >> "$GITHUB_OUTPUT"
@@ -94,7 +54,7 @@ jobs:
echo "$EOF" >> "$GITHUB_OUTPUT"
- name: Get Source Commit Subject
id: get-src-sub
- working-directory: ${{env.SRC}}
+ working-directory: ${{env.docs}}
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "SUB<<$EOF" >> "$GITHUB_OUTPUT"
@@ -102,26 +62,32 @@ jobs:
echo "$EOF" >> "$GITHUB_OUTPUT"
- name: Get Destination Commit Subject
id: get-dst-sub
- working-directory: ${{env.DST}}
+ working-directory: ${{env.wiki}}
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "SUB<<$EOF" >> "$GITHUB_OUTPUT"
git log -1 --format="%s" >> "$GITHUB_OUTPUT"
echo "$EOF" >> "$GITHUB_OUTPUT"
- - name: Copy Source Files to Destination
+ - name: Preprocess and Refactor Files
+ working-directory: ${{env.docs}}
+ run: |
+ chmod +x ../.github/actions/wiki_sync/refactor.sh
+ ../.github/actions/wiki_sync/refactor.sh
+ shell: bash
+ - name: Copy Doc Files to Wiki
run: |
- rsync -avzr --delete --exclude='.git/' "${{env.SRC}}/" "${{env.DST}}/"
+ rsync -avzr --delete --exclude='.git/' "${{env.docs}}/" "${{env.wiki}}/"
- name: Push
- working-directory: ${{env.DST}}
+ working-directory: ${{env.wiki}}
run: |
- export GIT_AUTHOR_NAME="github-actions[bot]"
- export GIT_AUTHOR_EMAIL="41898282+github-actions[bot]@users.noreply.github.com"
- export GIT_COMMITTER_NAME="${{ steps.get-author.outputs.AUTHOR }}"
- export GIT_COMMITTER_EMAIL="${{ steps.get-email.outputs.EMAIL }}"
- #export GIT_AUTHOR_NAME="${{ steps.get-author.outputs.AUTHOR }}"
- #export GIT_AUTHOR_EMAIL="${{ steps.get-email.outputs.EMAIL }}"
- #export GIT_COMMITTER_NAME="github-actions[bot]"
- #export GIT_COMMITTER_EMAIL="41898282+github-actions[bot]@users.noreply.github.com"
+ #export GIT_AUTHOR_NAME="github-actions[bot]"
+ #export GIT_AUTHOR_EMAIL="41898282+github-actions[bot]@users.noreply.github.com"
+ #export GIT_COMMITTER_NAME="${{ steps.get-author.outputs.AUTHOR }}"
+ #export GIT_COMMITTER_EMAIL="${{ steps.get-email.outputs.EMAIL }}"
+ export GIT_AUTHOR_NAME="${{ steps.get-author.outputs.AUTHOR }}"
+ export GIT_AUTHOR_EMAIL="${{ steps.get-email.outputs.EMAIL }}"
+ export GIT_COMMITTER_NAME="github-actions[bot]"
+ export GIT_COMMITTER_EMAIL="41898282+github-actions[bot]@users.noreply.github.com"
git add .
if [ "${{ steps.get-src-sub.outputs.SUB }}" = ${{ steps.get-dst-sub.outputs.SUB }}]; then
git commit --amend --no-edit
diff --git a/docs/Extension Sets/Extension-Set-`ini`.md b/docs/Extension Sets/Extension-Set-`ini`.md
deleted file mode 100644
index 1cdd37d..0000000
--- a/docs/Extension Sets/Extension-Set-`ini`.md
+++ /dev/null
@@ -1,12 +0,0 @@
-**Functionality:** INI Backwards Compatibility
-
-**Version**: 1.0
-
-**Created On**: May 18th, 2023
-
-**Extension List:**
-
-[XLE-2: Equals as Key-Value Separator](XLE%E2%80%902%EA%9E%89-Equals-as-Key%E2%80%90Value-Separator)
-[XLE-6: Quoted Strings](XLE%E2%80%906%EA%9E%89-Quoted-Strings)
-[XLE-8: Headers for Objects](XLE%E2%80%908%EA%9E%89-Headers-for-Objects)
-[XLE-9: Alternate Comment Characters](XLE%E2%80%909%EA%9E%89-Alternate-Comment-Characters)
\ No newline at end of file
diff --git a/docs/Extension Sets/Extension-Set-`json`.md b/docs/Extension Sets/Extension-Set-`json`.md
deleted file mode 100644
index 29bf6b4..0000000
--- a/docs/Extension Sets/Extension-Set-`json`.md
+++ /dev/null
@@ -1,12 +0,0 @@
-**Functionality:** JSON Backwards Compatibility
-
-**Version**: 1.0
-
-**Created On**: May 17th, 2023
-
-**Extension List:**
-
-[XLE-3: All Value Types in Arrays](XLE%E2%80%903%EA%9E%89-All-Value-Types-in-Arrays)
-[XLE-5: Commas After Values](XLE%E2%80%905%EA%9E%89-Commas-After-Values)
-[XLE-6: Quoted Strings](XLE%E2%80%906%EA%9E%89-Quoted-Strings)
-[XLE-7: Root-Level Object or Array](XLE%E2%80%907%EA%9E%89-Root%E2%80%90Level-Object-or-Array)
\ No newline at end of file
diff --git a/docs/Extension Sets/Extension-Set-`toml`.md b/docs/Extension Sets/Extension-Set-`toml`.md
deleted file mode 100644
index af25a2a..0000000
--- a/docs/Extension Sets/Extension-Set-`toml`.md
+++ /dev/null
@@ -1,12 +0,0 @@
-**Functionality:** TOML Backwards Compatibility
-
-**Version**: 1.0
-
-**Created On**: May 17th, 2023
-
-**Extension List:**
-
-[XLE-2: Equals as Key-Value Separator](XLE%E2%80%902%EA%9E%89-Equals-as-Key%E2%80%90Value-Separator)
-[XLE-3: All Value Types in Arrays](XLE%E2%80%903%EA%9E%89-All-Value-Types-in-Arrays)
-[XLE-6: Quoted Strings](XLE%E2%80%906%EA%9E%89-Quoted-Strings)
-[XLE-8: Headers for Objects](XLE%E2%80%908%EA%9E%89-Headers-for-Objects)
\ No newline at end of file
diff --git a/docs/Extension Sets/`ini`.md b/docs/Extension Sets/`ini`.md
new file mode 100644
index 0000000..2d54b2b
--- /dev/null
+++ b/docs/Extension Sets/`ini`.md
@@ -0,0 +1,12 @@
+**Functionality:** INI Backwards Compatibility
+
+**Version**: 1.0
+
+**Created On**: May 18th, 2023
+
+**Extension List:**
+
+${XLE-2}
+${XLE-6}
+${XLE-8}
+${XLE-9}
\ No newline at end of file
diff --git a/docs/Extension Sets/`json`.md b/docs/Extension Sets/`json`.md
new file mode 100644
index 0000000..3b4ba6b
--- /dev/null
+++ b/docs/Extension Sets/`json`.md
@@ -0,0 +1,12 @@
+**Functionality:** JSON Backwards Compatibility
+
+**Version**: 1.0
+
+**Created On**: May 17th, 2023
+
+**Extension List:**
+
+${XLE-3}
+${XLE-5}
+${XLE-6}
+${XLE-7}
\ No newline at end of file
diff --git a/docs/Extension Sets/`toml`.md b/docs/Extension Sets/`toml`.md
new file mode 100644
index 0000000..0f03f90
--- /dev/null
+++ b/docs/Extension Sets/`toml`.md
@@ -0,0 +1,12 @@
+**Functionality:** TOML Backwards Compatibility
+
+**Version**: 1.0
+
+**Created On**: May 17th, 2023
+
+**Extension List:**
+
+${XLE-2}
+${XLE-3}
+${XLE-6}
+${XLE-8}
\ No newline at end of file
diff --git "a/docs/Extensions/XLE\342\200\2200\352\236\211-Schema-Files.md" b/docs/Extensions/XLE-0=Schema_Files.md
similarity index 100%
rename from "docs/Extensions/XLE\342\200\2200\352\236\211-Schema-Files.md"
rename to docs/Extensions/XLE-0=Schema_Files.md
diff --git "a/docs/Extensions/XLE\342\200\2201\352\236\211-Omit-Key\342\200\220Value-Separator.md" b/docs/Extensions/XLE-1=Omit_Key-Value_Separator.md
similarity index 100%
rename from "docs/Extensions/XLE\342\200\2201\352\236\211-Omit-Key\342\200\220Value-Separator.md"
rename to docs/Extensions/XLE-1=Omit_Key-Value_Separator.md
diff --git "a/docs/Extensions/XLE\342\200\2202\352\236\211-Equals-as-Key\342\200\220Value-Separator.md" b/docs/Extensions/XLE-2=Equals_as_Key-Value_Separator.md
similarity index 100%
rename from "docs/Extensions/XLE\342\200\2202\352\236\211-Equals-as-Key\342\200\220Value-Separator.md"
rename to docs/Extensions/XLE-2=Equals_as_Key-Value_Separator.md
diff --git "a/docs/Extensions/XLE\342\200\2203\352\236\211-All-Value-Types-in-Arrays.md" b/docs/Extensions/XLE-3=All_Value_Types_in_Arrays.md
similarity index 100%
rename from "docs/Extensions/XLE\342\200\2203\352\236\211-All-Value-Types-in-Arrays.md"
rename to docs/Extensions/XLE-3=All_Value_Types_in_Arrays.md
diff --git "a/docs/Extensions/XLE\342\200\2204\352\236\211-Escaped-Characters.md" b/docs/Extensions/XLE-4=Escaped_Characters.md
similarity index 100%
rename from "docs/Extensions/XLE\342\200\2204\352\236\211-Escaped-Characters.md"
rename to docs/Extensions/XLE-4=Escaped_Characters.md
diff --git "a/docs/Extensions/XLE\342\200\2205\352\236\211-Commas-After-Values.md" b/docs/Extensions/XLE-5=Commas_After_Values.md
similarity index 90%
rename from "docs/Extensions/XLE\342\200\2205\352\236\211-Commas-After-Values.md"
rename to docs/Extensions/XLE-5=Commas_After_Values.md
index 04e1e13..a874730 100644
--- "a/docs/Extensions/XLE\342\200\2205\352\236\211-Commas-After-Values.md"
+++ b/docs/Extensions/XLE-5=Commas_After_Values.md
@@ -20,7 +20,7 @@ In addition to JSON compatiblity, this extension can be used for convenience pur
The below example demonstrates how, for example, a C++ enum can be seamlessly copied into an XSON object;
The enum contents are unchanged.
-Note that in this specific example, [XLE-2 (Equals as Key-Value Separator)](XLE%u20102%uA789-Equals-as-Key%u2010Value-Separator)
+Note that in this specific example, [XLE-2 (${XLE-2_NAME})](${XLE-2_LINK})
is needed due to C++'s syntax.