Skip to content

Commit

Permalink
Merge pull request #36 from TMueller83/patch-1
Browse files Browse the repository at this point in the history
Improve commented_out check
  • Loading branch information
dimpase authored Sep 5, 2019
2 parents 4f7c26e + 3211cff commit 59307e4
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions scripts.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,13 @@ if sys.argv[1].endswith('.sagetex.sage'):
else:
src = os.path.splitext(sys.argv[1])[0]

commented_out = r'^\s*%'
usepackage = r'\usepackage(\[.*\])?{sagetex}'
uses_sagetex = False

# if it doesn't use sagetex, obviously running sage is unnecessary
with open(src + '.tex') as texf:
for line in texf:
if not re.search(commented_out, line) and re.search(usepackage, line):
if re.search(usepackage, line.replace(r'\%', '').split('%')[0]):
uses_sagetex = True
break

Expand Down

0 comments on commit 59307e4

Please sign in to comment.