-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix regex escaping #88
Fix regex escaping #88
Conversation
this uses raw string formatting an prevents the loss of too many backslashes and also updated the configuration for the documentation
Thanks for this patch! @chrisjsewell do you think you could double-check that this looks correct? My regex skills are very poor 😬 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep mainly good thanks, I just think we can probably remove the "old style"
doc/index.rst
Outdated
|
||
.. code-block:: restructuredtext | ||
|
||
Old style: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we actually need this old and new style? Was old style actually ever a thing (i.e. was it used in old versions of ipython) or can we just remove it (the examples and in the regex) and keep only the "new" style
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also wasn't sure if the "old style" was ever like this, ipython console
, jupyter console
and qt-console
use the "new style".
But I thought "there had to be a reason why [1]
was used" (that's why I came up with the "old" and "new"). So If you can't think of an "old" use case, I will remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, whlie derping around with ipython
, jupyter console
and jupyter qtconsole
I found differences with line continuation:
ipython
and jupyter qtconsole
:
In [1]: def test():
...: return 1
jupyter console
:
In [1]: def test():
: return 1
So the regexes should be r"\s \.\.\.: "
and r"\s : "
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about replacing:
- "Old style" with "
ipython
andqtconsole
style" - "New style" with "
jupyter console
style"
Also using the regexes r" {2,5}\.\.\.: "
and r" {5,8}: "
would support continuations for In []:
up to In [999]
, an be more robust against false positive matches than my proposed version with \s
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didn't even know there was a jupyter console lol, but yeh sounds good to me if you want to have the two examples, or just use ipython
Yep we should release this as 0.3.0 |
Well, as for SemVer that would be a |
Yeh it's a bit of a cheat, but for versioning < 1.0.0, I generally treat MINOR version changes as also being backwards-incompatible, and PATCH for anything else. I think that's reasonable, since below 1.0 you're generally in "beta" mode where users should not yet expect the code to be completely "stable" anyway |
Yep I'm in the same boat - IMO pre |
Yeah, fair enough, versions below |
Well I don't know it there can be a completely programmatic identifier of back-compatability breaking. |
In my TypeScript projects with template typescript-library-starter I use git-cz, which basically wrappes git commits in a CLI dialog and adds keywords which get picked up further down the line. But 'completely programmatic identifier of back-compatability breaking' might be a dream.. enough off topic xD |
Yeh interesting cheers, there's a few different categories, but quite similar. I guess there's no convention that can cover all eventualities, but its better to have a convention than none at all.
The only problem with any locally installed "commit tool" is that actually you're mainly writing the commit message directly here in the GitHub PR interface |
thanks @s-weigand! |
thanks for the patch @s-weigand !! |
As concluded in #86, this fixes the way that
copybutton_prompt_text
is injected intocopybutton.js_t
.And updates the docs on how to use the regex feature.
I left the old tests in there, since I kind like those oddities if you know them. But if that is too much clutter for you I can remove them.
Not sure how much you value SemVer but this is a breaking change, since it will break functionality for people that already use the regex feature.
fixes #86
Note: I left #84 (besides) untouched, since IMHO this should configurable i.e. by a variable
copy_blank_lines
. I just can see someone complaining around the corner, even so 'copy as is' is the most natural thing and should be default 😒