-
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.
- Loading branch information
1 parent
54004b6
commit 934533e
Showing
2 changed files
with
41 additions
and
0 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
!.gitignore | ||
!doxyfile | ||
!doxygen-awesome.css | ||
!prepareDocs.py |
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,40 @@ | ||
# The main readme.md at the repository's root is used as the landing | ||
# page of the doxygen documentation, which becomes an issue when | ||
# resolving links (github vs local docs). This script creates a | ||
# separate readme.md for doxygen and replaces the links to point to | ||
# local or github links, depending in the provided arguments. | ||
|
||
# --- STD Imports --- | ||
import pathlib | ||
import re | ||
import argparse | ||
|
||
|
||
parser = argparse.ArgumentParser("prepareDocs") | ||
parser.add_argument("-w", | ||
dest = "web", | ||
action = "store_const", | ||
const = True, | ||
default = False, | ||
help = "prepare docs for the web") | ||
arguments = parser.parse_args() | ||
|
||
rootPath = "https://matekelemen.github.io/mcgs/" if arguments.web else "../../" | ||
docPath = rootPath + "docs/html/" | ||
assetPath = rootPath + ".github/assets/" | ||
|
||
docLinkPattern = re.compile(r"\[mcgs::(\w+)\]\(([\w0-9\.#]+)\)") | ||
docLinkReplace = r"[mcgs::\1](" + docPath + r"\2)" | ||
assetLinkPattern = re.compile(r"\.github/assets/") | ||
assetLinkReplace = assetPath | ||
|
||
readme = "" | ||
with open(pathlib.Path(__file__).absolute().parent.parent / "readme.md", "r") as inputFile: | ||
readme = inputFile.read() | ||
|
||
with open(pathlib.Path(__file__).parent / "readme.md", "w") as outputFile: | ||
outputFile.write(re.sub(assetLinkPattern, | ||
assetLinkReplace, | ||
re.sub(docLinkPattern, | ||
docLinkReplace, | ||
readme))) |