forked from MODFLOW-USGS/modflow6
-
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.
chore(release): generate release notes latex file from toml
- Loading branch information
Showing
8 changed files
with
24,649 additions
and
23,026 deletions.
There are no files selected for viewing
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,10 @@ | ||
\item \currentmodflowversion | ||
|
||
{% for section, notes in sections|groupby("type") %} | ||
\underline{{{ section }}} | ||
\begin{itemize} | ||
{% for note in section %} | ||
\item {{ note.text }} | ||
{% endfor %} | ||
\end{itemize} | ||
{% endfor %} |
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,36 @@ | ||
# This script converts the release notes TOML file | ||
# to a latex file to include in the release notes. | ||
import argparse | ||
from pathlib import Path | ||
import sys | ||
from warnings import warn | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("path") | ||
args = parser.parse_args() | ||
|
||
fname = "develop" | ||
fpath = Path(args.path).expanduser().absolute() | ||
fnametex = Path(f"{fname}.tex").absolute() | ||
fnametex.unlink(missing_ok=True) | ||
|
||
if not fpath.is_file(): | ||
warn(f"Release notes TOML file not found: {fpath}") | ||
sys.exit(0) | ||
|
||
from jinja2 import Environment, FileSystemLoader | ||
import tomlkit | ||
|
||
loader = FileSystemLoader(fnametex.parent) | ||
env = Environment( | ||
loader=loader, | ||
trim_blocks=True, | ||
lstrip_blocks=True, | ||
line_statement_prefix="_", | ||
keep_trailing_newline=True, | ||
) | ||
template = env.get_template(f"{fnametex.name}.jinja") | ||
with open(fnametex, "w") as f: | ||
f.write(template.render(tomlkit.load(f"{fname}.toml"))) |
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