Skip to content

Commit

Permalink
Allow an empty prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts committed Jun 2, 2024
1 parent fd07ae2 commit 57ad343
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/jupytext/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,9 @@ def load_jupytext_configuration_file(config_file, stream=None):
# formats can be a dict prefix => format
if isinstance(config.formats, dict):
config.formats = [
(prefix[:-1] if prefix.endswith("/") else prefix) + "///" + fmt
fmt
if not prefix
else (prefix[:-1] if prefix.endswith("/") else prefix) + "///" + fmt
for prefix, fmt in config.formats.items()
]
config.formats = short_form_multiple_formats(config.formats)
Expand Down
9 changes: 9 additions & 0 deletions tests/functional/config/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,15 @@ def test_load_jupytext_configuration_file(tmpdir, config_file):
""",
"notebooks///ipynb,scripts///py:percent",
),
(
"""# Pair local notebooks to scripts in 'notebooks_py' and md files in 'notebooks_md'
[formats]
"" = "ipynb"
"notebooks_py" = "py:percent"
"notebooks_md" = "md:myst"
""",
"ipynb,notebooks_py///py:percent,notebooks_md///md:myst",
),
],
)
def test_jupytext_formats(tmpdir, content_toml, formats_short_form):
Expand Down

0 comments on commit 57ad343

Please sign in to comment.