Skip to content

Commit

Permalink
[MNT] update pre-commit config and apply (#1329)
Browse files Browse the repository at this point in the history
* update precommit config and apply

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix import

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Apply suggestions from code review

Co-authored-by: Chris Markiewicz <effigies@gmail.com>

* Update pdf_build_src/process_markdowns.py

Co-authored-by: Chris Markiewicz <effigies@gmail.com>

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Chris Markiewicz <markiewicz@stanford.edu>
Co-authored-by: Chris Markiewicz <effigies@gmail.com>
  • Loading branch information
4 people authored Oct 23, 2022
1 parent 567e5be commit 341a944
Show file tree
Hide file tree
Showing 11 changed files with 173 additions and 116 deletions.
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,27 @@ repos:
- id: check-ast
- id: check-added-large-files
- id: check-case-conflict
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
files: tools/schemacode
args: [--verbose]
- repo: https://github.com/pyCQA/isort
rev: 5.10.1
hooks:
- id: isort
files: tools/
- repo: https://github.com/pyCQA/flake8
rev: 5.0.4
hooks:
- id: flake8
args: [--config=tools/schemacode/setup.cfg]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.2
hooks:
- id: prettier
files: src/schema/.*/.*\.yaml
- repo: https://github.com/codespell-project/codespell
rev: v2.2.2
hooks:
Expand Down
22 changes: 11 additions & 11 deletions pdf_build_src/pandoc_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,25 @@ def build_pdf(filename="bids-spec.pdf", logfile="bids-spec_pandoc_log.json"):

# Get all input files
markdown_list = []
for root, dirs, files in os.walk('.'):
for root, dirs, files in os.walk("."):
for file in files:
fpath = os.path.join(root, file)
if fpath.endswith(".md") and fpath not in EXCLUDE:
markdown_list.append(fpath)
elif fpath.endswith('index.md'):
elif fpath.endswith("index.md"):
# Special role for index.md
index_page = fpath

# Prepare the command options
cmd = [
'pandoc',
'--from=markdown_github+yaml_metadata_block',
'--include-before-body=./cover.tex',
'--include-in-header=./header.tex',
'--include-in-header=./header_setup.tex',
'--pdf-engine=xelatex',
f'--log={logfile}',
f'--output={filename}',
"pandoc",
"--from=markdown_github+yaml_metadata_block",
"--include-before-body=./cover.tex",
"--include-in-header=./header.tex",
"--include-in-header=./header_setup.tex",
"--pdf-engine=xelatex",
f"--log={logfile}",
f"--output={filename}",
]

# location of this file: This is also the working directory when
Expand All @@ -62,7 +62,7 @@ def build_pdf(filename="bids-spec.pdf", logfile="bids-spec_pandoc_log.json"):
cmd += [str(root / i) for i in ["../../metadata.yml"] + sorted(markdown_list)]

# print and run
print('running: \n\n' + '\n'.join(cmd))
print("running: \n\n" + "\n".join(cmd))
subprocess.run(cmd)


Expand Down
Loading

0 comments on commit 341a944

Please sign in to comment.