Skip to content

Commit

Permalink
fix escapes
Browse files Browse the repository at this point in the history
  • Loading branch information
bamos committed Apr 17, 2024
1 parent ef13abd commit 3aaa121
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def load_and_replace(bibtex_file):

if group_by_year:
for pub in pubs:
m = re.search('(\d{4})', pub['year'])
m = re.search(r'(\d{4})', pub['year'])
assert m is not None
pub['year_int'] = int(m.group(1))

Expand Down Expand Up @@ -266,12 +266,12 @@ def _format_author_list(immut_author_list):
if len(k) > 0:
assert len(k) == 1, k
url = author_urls[k[0]]
new_auth = f"\href{{{url}}}{{{new_auth}}}"
new_auth = fr"\href{{{url}}}{{{new_auth}}}"

if config['name'] in new_auth:
new_auth = r"\textbf{" + new_auth + r"}"
new_auth = new_auth.replace('. ', '.~')
new_auth = '\mbox{' + new_auth + '}'
new_auth = r'\mbox{' + new_auth + '}'
formatted_authors.append(new_auth)
return formatted_authors

Expand Down Expand Up @@ -302,7 +302,7 @@ def _get_pub_str(pub, prefix, gidx):
links = ' '.join(links)

highlight = 'selected' in pub and pub['selected'].lower() == 'true'
highlight_color = '\cellcolor{tab_highlight}' if highlight else ''
highlight_color = r'\cellcolor{tab_highlight}' if highlight else ''
if '_note' in pub:
# note_str = r'{} && \textbf{{{}}} \\'.format(
note_str = f"({pub['_note']})"
Expand Down Expand Up @@ -340,7 +340,7 @@ def load_and_replace(bibtex_file):

if group_by_year:
for pub in pubs:
m = re.search('(\d{4})', pub['year'])
m = re.search(r'(\d{4})', pub['year'])
assert m is not None
pub['year_int'] = int(m.group(1))

Expand Down Expand Up @@ -402,7 +402,7 @@ def add_repo_data(context, config, in_tex):
assert 'year' in item
assert 'github' in item['repo_url']

short_name = re.search('.*github\.com/(.*)', item['repo_url'])[1]
short_name = re.search(r'.*github\.com/(.*)', item['repo_url'])[1]
if 'name' not in item:
item['name'] = short_name.replace('_', '\\_') if in_tex else short_name

Expand Down Expand Up @@ -602,7 +602,7 @@ def write_to_outfile(self, output_data):
(r'\\ ', ' '), # spaces
(r'\\&', '&'), # unescape &
(r'\\_', '_'), # unescape _
(r'\\\$', '\$'), # unescape $
(r'\\\$', r'\$'), # unescape $
(r'\\%', '%'), # unescape %
(r'\\textbf{(.*?)}', r'<b>\1</b>'), # bold text
(r'\{ *\\bf *(.*?)\}', r'<b>\1</b>'),
Expand Down

0 comments on commit 3aaa121

Please sign in to comment.