File tree 4 files changed +14
-6
lines changed
4 files changed +14
-6
lines changed Original file line number Diff line number Diff line change 8
8
[ ![ GitHub stars] ( https://img.shields.io/github/stars/nschloe/blacktex.svg?style=flat-square&logo=github&label=Stars&logoColor=white )] ( https://github.com/nschloe/blacktex )
9
9
[ ![ PyPi downloads] ( https://img.shields.io/pypi/dm/blacktex.svg?style=flat-square )] ( https://pypistats.org/packages/blacktex )
10
10
11
- [ ![ Discord] ( https://img.shields.io/static/v1?logo=discord&label=chat&message=on%20discord&color=7289da&style=flat-square )] ( https://discord.gg/hnTJ5MRX2Y )
12
-
13
11
[ ![ gh-actions] ( https://img.shields.io/github/workflow/status/nschloe/blacktex/ci?style=flat-square )] ( https://github.com/nschloe/blacktex/actions?query=workflow%3Aci )
14
12
[ ![ codecov] ( https://img.shields.io/codecov/c/github/nschloe/blacktex.svg?style=flat-square )] ( https://codecov.io/gh/nschloe/blacktex )
15
13
[ ![ LGTM] ( https://img.shields.io/lgtm/grade/python/github/nschloe/blacktex.svg?style=flat-square )] ( https://lgtm.com/projects/g/nschloe/blacktex )
Original file line number Diff line number Diff line change @@ -16,9 +16,10 @@ def _remove_comments(string):
16
16
string = "\n " .join ([lines [k ] for k in range (len (lines )) if k not in comment_lines ])
17
17
18
18
# https://stackoverflow.com/a/2319116/353337
19
- string = re .sub ("[ \t ]*%.+\n " , "\n " , string )
19
+ # https://stackoverflow.com/a/24209736/353337
20
+ string = re .sub ("[ \t ]*(?<!\\ \\ )%.+\n " , "\n " , string )
20
21
# same with EOF
21
- string = re .sub ("[ \t ]*%.+$" , "" , string )
22
+ string = re .sub ("[ \t ]*(?<! \\ \\ ) %.+$" , "" , string )
22
23
return string
23
24
24
25
Original file line number Diff line number Diff line change 1
1
[metadata]
2
2
name = blacktex
3
- version = 0.3.3
3
+ version = 0.3.4
4
4
author = Nico Schlömer
5
5
6
6
description = Cleans up your LaTeX files
@@ -12,7 +12,6 @@ project_urls =
12
12
long_description = file: README.md
13
13
long_description_content_type = text/markdown
14
14
license = GPL-3.0-or-later
15
- license_file = LICENSE
16
15
classifiers =
17
16
Development Status :: 4 - Beta
18
17
License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Original file line number Diff line number Diff line change @@ -40,6 +40,10 @@ def test_comments():
40
40
out = blacktex .clean (input_string )
41
41
assert out == "A\n sit amet"
42
42
43
+ input_string = "{equation}%comment"
44
+ out = blacktex .clean (input_string )
45
+ assert out == "{equation}"
46
+
43
47
44
48
def test_multiple_comment_lines ():
45
49
input_string = "A\n %\n %\n B"
@@ -54,6 +58,12 @@ def test_comment_last():
54
58
assert out == ref , f"{ repr (out )} != { repr (ref )} "
55
59
56
60
61
+ def test_escapted_percentage_sign ():
62
+ input_string = "25\\ % gain"
63
+ out = blacktex .clean (input_string )
64
+ assert out == "25\\ % gain"
65
+
66
+
57
67
def test_trailing_whitespace ():
58
68
input_string = "lorem \n sit amet"
59
69
out = blacktex .clean (input_string )
You can’t perform that action at this time.
0 commit comments