-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Insert example from example.js * Update dependencies * Bump version to 24.7
- Loading branch information
1 parent
3e7194b
commit dc48d2c
Showing
7 changed files
with
348 additions
and
259 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
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
Large diffs are not rendered by default.
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
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,8 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
cd "$( dirname "${BASH_SOURCE[0]}" )/.." | ||
|
||
python "./scripts/insert-example.py" "README.template" > "README.md" | ||
|
||
rm "README.template" |
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,34 @@ | ||
import argparse | ||
import os | ||
import re | ||
import typing | ||
|
||
REPLACE_RE = re.compile(r'^%insert (?P<file_name>[^%]+)%$', re.MULTILINE) | ||
|
||
|
||
def read_text(filename: str) -> str: | ||
with open(filename, "rt") as rf: | ||
text = rf.read() | ||
return text | ||
|
||
|
||
def main(template: typing.TextIO) -> None: | ||
content: str = template.read() | ||
|
||
def sub_match(match): | ||
file_name = match.group('file_name') | ||
return read_text(file_name) | ||
|
||
text = REPLACE_RE.sub(sub_match, content) | ||
print(text) | ||
|
||
|
||
def parse_args() -> typing.Dict[str, typing.Any]: | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("template", type=argparse.FileType("rt"), help="README.template") | ||
kwargs = vars(parser.parse_args()) | ||
return kwargs | ||
|
||
|
||
if __name__ == "__main__": | ||
main(**parse_args()) |
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