Skip to content

Commit 748e319

Browse files
authored
Merge pull request #20 from nschloe/keep-comments
Keep comments
2 parents edafee6 + 021448a commit 748e319

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ default:
55

66
# https://packaging.python.org/distributing/#id72
77
upload: clean
8-
# Make sure we're on the master branch
9-
@if [ "$(shell git rev-parse --abbrev-ref HEAD)" != "master" ]; then exit 1; fi
8+
# Make sure we're on the main branch
9+
@if [ "$(shell git rev-parse --abbrev-ref HEAD)" != "main" ]; then exit 1; fi
1010
rm -f dist/*
1111
python3 -m build --sdist --wheel .
1212
twine upload dist/*
1313

1414
tag:
15-
@if [ "$(shell git rev-parse --abbrev-ref HEAD)" != "master" ]; then exit 1; fi
15+
@if [ "$(shell git rev-parse --abbrev-ref HEAD)" != "main" ]; then exit 1; fi
1616
curl -H "Authorization: token `cat $(HOME)/.github-access-token`" -d '{"tag_name": "v$(VERSION)"}' https://api.github.com/repos/nschloe/blacktex/releases
1717

1818
publish: tag upload

blacktex/cli.py

+4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ def _get_parser():
4040
"-i", "--in-place", action="store_true", help="modify infile in place"
4141
)
4242

43+
parser.add_argument(
44+
"-k", "--keep-comments", action="store_true", help="keep comments"
45+
)
46+
4347
version_text = "blacktex {}, Python {}.{}.{}".format(
4448
blacktex.__version__,
4549
sys.version_info.major,

blacktex/main.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,11 @@ def _add_spaces_around_equality_sign(string):
307307
return string
308308

309309

310-
def clean(string):
310+
def clean(string, keep_comments=False):
311311
out = string
312312
out = _remove_trailing_whitespace(out)
313-
out = _remove_comments(out)
313+
if not keep_comments:
314+
out = _remove_comments(out)
314315
out = _replace_dollar_dollar(out)
315316
out = _replace_obsolete_text_mods(out)
316317
out = _remove_whitespace_around_brackets(out)

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = blacktex
3-
version = 0.3.2
3+
version = 0.3.3
44
author = Nico Schlömer
55
author_email = [email protected]
66
description = Cleans up your LaTeX files

0 commit comments

Comments
 (0)