-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add preprocessor bash script for syncing documentation files to wiki
Change documentation file names to be more user-friendly by removing the special characters. Thus add refactoring within the script that renames the files (to be compatible with GItHub wiki) before pushing to wiki. Also add preprocessing within the script that automatically replaces pre-defined macros within documentation files with correct and updated links. This commit makes bi-directional syncing much more tedious, so it has been dropped. Only changes in the docs folder in the main repo will be pushed to the wiki. Changes directly to the wiki repo will no longer be persisted. The contribution guidelines will need to be significantly udpated after this commit. The script could also be converted into CMake instead of bash if need be,
- Loading branch information
Showing
19 changed files
with
136 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)<br\/>|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]}) <br\/>\n" | ||
done | ||
sed -i \ | ||
-e "s|$ext_list_macro|$ext_list|g" \ | ||
-e "s|$extset_list_macro|$extset_list|g" \ | ||
"_Sidebar.md" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5719797
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@check-spelling-bot Report
🔴 Please review
See the 📜action log or 📝 job summary for details.
See ❌ Event descriptions for more information.