Skip to content
Snippets Groups Projects
Commit 754d22bc authored by tuhe's avatar tuhe
Browse files

Minor fixes

parent 747fc1d7
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,7 @@ from snipper.fix_s import save_s
from snipper.fix_cite import fix_citations
from snipper.fix_bf import fix_f, fix_b
from snipper.fix_o import run_o
from sphinx.ext.autodoc.preserve_defaults import update_defvalue
def rem_nonprintable_ctrl_chars(txt):
......@@ -46,10 +47,15 @@ def censor_file(file, run_files=True, run_out_dirs=None, cut_files=True,
strict=True,
references=None,
license_head=None,
package_base_dir=None):
package_base_dir=None,
update_file=True # Update the file 'file' (i.e., write to it).
):
if str(file).endswith("rst"):
assert not run_files and not cut_files and not censor_files
if censor_files:
assert update_file, "update_file must be true when censor_files is true (otherwise the file will not be censored!)"
if str(file).endswith(".md"):
license_head=None
......@@ -108,6 +114,7 @@ def censor_file(file, run_files=True, run_out_dirs=None, cut_files=True,
if license_head is not None:
s2 = fix_copyright(s2, license_head)
if update_file:
with open(file, 'w', encoding='utf-8') as f:
f.write(s2)
return nB, cut
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment