Skip to content

Commit

Permalink
Fixes issue #587
Browse files Browse the repository at this point in the history
  • Loading branch information
Skylion007 authored and mwouts committed Aug 20, 2020
1 parent b3e3b43 commit 464a2d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion jupytext/magics.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
_MAGIC_FORCE_ESC_RE["csharp"] = re.compile(r"^(// |//)*#![a-zA-Z](.*)//\s*noescape")

# Commands starting with a question or exclamation mark have to be escaped
_PYTHON_HELP_OR_BASH_CMD = re.compile(r"^\s*(# |#)*\s*(\?|!)\s*[A-Za-z]")
_PYTHON_HELP_OR_BASH_CMD = re.compile(r"^\s*(# |#)*\s*(\?|!)\s*[A-Za-z\.\~]")


# A bash command not followed by an equal sign or a parenthesis is a magic command
_PYTHON_MAGIC_CMD = re.compile(
Expand Down
5 changes: 5 additions & 0 deletions tests/test_escape_magics.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ def test_force_comment_using_contents_manager(tmpdir):
"# ls",
"# mv a b",
"! mkdir tmp",
"!./script",
"!./script args",
"!./script.sh args",
"!~/script.sh args",
"!~/script.sh args",
"cat",
"cat ",
"cat hello.txt",
Expand Down

0 comments on commit 464a2d6

Please sign in to comment.