Skip to content

Commit

Permalink
apply replacements to rstcheck
Browse files Browse the repository at this point in the history
Signed-off-by: Dave Dykstra <[email protected]>
  • Loading branch information
DrDaveD committed Feb 16, 2022
1 parent dee6c69 commit 418434e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ jobs:
- name: Lint rst
run: |
rstcheck --ignore-language c,c++ --report warning *.rst
set -x
python3 copyreplace.py *.rst
rstcheck --ignore-language c,c++ --report warning *.rep
rm -f *.rep
- name: Build web documentation
run: |
Expand Down
3 changes: 1 addition & 2 deletions contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ help out other users!
======================

Many of our users come to Slack for quick help with an issue. You can
find us at `apptainer
<https://apptainer.slack.com/>`_.
join through the `apptainer help page <https://apptainer.org/help/>`_.

.. _contributing-to-documentation:

Expand Down
16 changes: 16 additions & 0 deletions copyreplace.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# This copies all files given in argv to the same file name with a '.rep'
# extension, replacing all the strings defined in replacements.py.
# This is intended for use in conjunction with rstcheck which runs
# independently of the variable replacement that sphinx does.
#
from replacements import *
import sys

for f in sys.argv[1:]:
with open(f, 'r', encoding='utf-8') as fdin:
data = fdin.read()
for key in variable_replacements:
data = data.replace(key, variable_replacements[key])
with open(f + '.rep', 'w', encoding='utf-8') as fdout:
fdout.write(data)

0 comments on commit 418434e

Please sign in to comment.