Skip to content

Commit

Permalink
Fix dollar escapes at beginning of line
Browse files Browse the repository at this point in the history
If the escaped dollar is at the beginning of the line, it does not get
replaced with the previous code, because it requires a preceding space.
  • Loading branch information
matthew-brett committed Oct 20, 2018
1 parent d211233 commit 9d5b0cc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scripts/generate_textbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ def _clean_lines(lines, filepath):
for char in inline_replace_chars:
line = line.replace('\\{}'.format(char), '\\\\{}'.format(char))
line = line.replace(' \\$', ' \\\\$')
# Escaped dollar could be at beginning of line
if line.startswith('\\$'):
line = '\\' + line
lines[ii] = line
return lines

Expand Down

0 comments on commit 9d5b0cc

Please sign in to comment.