Skip to content

Commit

Permalink
fixed catastrophic backtracking in LaTeX math regex (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
gpoore committed Jun 1, 2020
1 parent d6ce2a0 commit cd663c7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Change Log


## v0.4.0 (dev)

* Fixed catastrophic backtracking in LaTeX math regex (#11).



## v0.3.0 (2020-05-26)

* Added support for multiple-answers questions.
Expand Down
2 changes: 1 addition & 1 deletion text2qti/markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ def sub_siunitx_to_plain_latex(self, string: str, in_math: bool=False) -> str:

html_comment_pattern = r'(?P<html_comment><!--.*?-->)'
inline_code_pattern = r'(?P<code>(?<!`)(?P<code_delim>`+)(?!`).+?(?<!`)(?P=code_delim)(?!`))'
inline_math_pattern = r'(?<!\$)\$(?!\$)(?P<math>[^ \t\n](?:[^$\n]+|\n[ \t]*[^$\n]+)*)(?<![ \t\n])\$(?!\$)'
inline_math_pattern = r'(?<!\$)\$(?!\$)(?P<math>[^ \t\n](?:[^$\n]|\n[ \t]*[^ \t$\n])*)(?<![ \t\n])\$(?!\$)'
html_comment_or_inline_code_math_siunitx_re = re.compile('|'.join([html_comment_pattern,
inline_code_pattern,
inline_math_pattern,
Expand Down
2 changes: 1 addition & 1 deletion text2qti/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-

from .fmtversion import get_version_plus_info
__version__, __version_info__ = get_version_plus_info(0, 3, 0, 'final', 0)
__version__, __version_info__ = get_version_plus_info(0, 4, 0, 'dev', 1)

0 comments on commit cd663c7

Please sign in to comment.