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 in MOOSEDocs package extension #12611
Conversation
Job Documentation on 4f3bd78 wanted to post the following: View the site here This comment will be updated on new commits. |
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.
👍
@@ -115,7 +115,7 @@ def defaultSettings(): | |||
|
|||
def createToken(self, parent, info, page): | |||
content = info['inline'] if 'inline' in info else info['block'] | |||
content = re.sub(r'__(?P<package>[A-Z]+)__', self.subFunction, content, flags=re.UNICODE) | |||
content = re.sub(r'__(?P<package>[A-Z\_]+)__', self.subFunction, content, flags=re.UNICODE) |
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.
You don't have to escape characters in character classes. In fact this might be slightly incorrect now because I believe it'll match A-Z and underscore and a backslash.
@@ -115,7 +115,7 @@ def defaultSettings(): | |||
|
|||
def createToken(self, parent, info, page): | |||
content = info['inline'] if 'inline' in info else info['block'] | |||
content = re.sub(r'__(?P<package>[A-Z]+)__', self.subFunction, content, flags=re.UNICODE) | |||
content = re.sub(r'__(?P<package>[A-Z\_]+)__', self.subFunction, content, flags=re.UNICODE) |
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.
You don't have to escape characters in character classes. In fact this might be slightly incorrect now because I believe it'll match A-Z and underscore and a backslash.
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 don't know why I "escaped" the underscore, I don't think it is ever needed.
(refs #12528)