docs: Automatically update links to use the latest tagged release

This commit is contained in:
Tyler Wilding 2020-12-30 21:22:43 -05:00 committed by lightningterror
parent 3f8510eaae
commit 406403cd8e
10 changed files with 18 additions and 12 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +1,7 @@
---
title: "PCSX2 - Configuration Guide"
date: "2020"
footer-left: "[Document Source](https://github.com/PCSX2/pcsx2/blob/v1.6.0/pcsx2/Docs/Configuration_Guide/Configuration_Guide.md)"
footer-left: "[Document Source](https://github.com/PCSX2/pcsx2/blob/{LATEST-GIT-TAG}/pcsx2/Docs/Configuration_Guide/Configuration_Guide.md)"
urlcolor: "cyan"
...

View File

@ -1,7 +1,7 @@
---
title: "PCSX2 - Debugger Documentation"
date: "2020"
footer-left: "[Document Source](https://github.com/PCSX2/pcsx2/blob/v1.6.0/pcsx2/Docs/Debugger.md)"
footer-left: "[Document Source](https://github.com/PCSX2/pcsx2/blob/{LATEST-GIT-TAG}/pcsx2/Docs/Debugger.md)"
urlcolor: "cyan"
...

View File

@ -1,7 +1,7 @@
---
title: "PCSX2 - GameDB Documentation"
date: "2020"
footer-left: "[Document Source](https://github.com/PCSX2/pcsx2/blob/v1.6.0/pcsx2/Docs/GameIndex.md)"
footer-left: "[Document Source](https://github.com/PCSX2/pcsx2/blob/{LATEST-GIT-TAG}/pcsx2/Docs/GameIndex.md)"
urlcolor: "cyan"
...

View File

@ -1,7 +1,7 @@
---
title: "PCSX2 - Frequently Asked Questions"
date: "2020"
footer-left: "[Document Source](https://github.com/PCSX2/pcsx2/blob/v1.6.0/pcsx2/Docs/PCSX2_FAQ.md)"
footer-left: "[Document Source](https://github.com/PCSX2/pcsx2/blob/{LATEST-GIT-TAG}/pcsx2/Docs/PCSX2_FAQ.md)"
urlcolor: "cyan"
...

View File

@ -37,8 +37,6 @@ If you prefer Chocolatey or using the installer, consult pandoc's official docum
Run the following, this assumes you have access to bash, either by virtue of running on linux or through something like `git-bash` on Windows.
You'll likely want to update the tag for documentation source links in all markdown file's metadata block, this is not currently scripted at the time of writing.
```bash
> ./gen-docs.sh
```
@ -48,5 +46,3 @@ You'll likely want to update the tag for documentation source links in all markd
### Customizing Output
For generating the PDF's this popular template is used and has many features that could be useful https://github.com/Wandmalfarbe/pandoc-latex-template#usage reference it's documentation to take advantage of those if desired.
TODO commit with +x `git update-index --chmod=+x .\gen-docs.sh`

View File

@ -1,19 +1,29 @@
#!/bin/bash
### Retrieve the latest git tag
### - Assumes atleast git 2.18
LATEST_SEMVER=$(git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags https://github.com/PCSX2/pcsx2.git 'v*[0-9].*[0-9].*[0-9]' | tail --lines=1 | cut --delimiter='/' --fields=3)
OUT_DIR=${OUT_DIR:-"../../bin/docs"}
## Generate and Move Markdown->PDFs
### Configuration Guide
pushd Configuration_Guide
pandoc --template "../eisvogel.tex" --toc "Configuration_Guide.md" -o "Configuration_Guide.pdf"
pushd ./Configuration_Guide
cp Configuration_Guide.md Configuration_Guide.temp.md
sed -i 's/{LATEST-GIT-TAG}/'"$LATEST_SEMVER"'/' Configuration_Guide.temp.md
pandoc --template ../eisvogel.tex --toc Configuration_Guide.temp.md -o Configuration_Guide.pdf
rm Configuration_Guide.temp.md
popd
mv -f "./Configuration_Guide/Configuration_Guide.pdf" "$OUT_DIR"
mv -f ./Configuration_Guide/Configuration_Guide.pdf "$OUT_DIR"
### The rest!
find . -maxdepth 1 -name "*.md" -not -path "./README.md" | while read filename; do
filename="${filename%.*}"
pandoc --template "./eisvogel.tex" --toc "$filename.md" -o "$filename.pdf"
cp "$filename.md" "$filename.temp.md"
sed -i 's/{LATEST-GIT-TAG}/'"$LATEST_SEMVER"'/' "$filename.temp.md"
pandoc --template ./eisvogel.tex --toc "$filename.temp.md" -o "$filename.pdf"
mv -f "$filename.pdf" "$OUT_DIR"
rm "$filename.temp.md"
done