Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

different approach to escaping the esc char

  • Loading branch information...
commit aa422c2d8553f62c7cee94eb0a81b864e4e83223 1 parent 6b39487
Edward Betts EdwardBetts authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 openlibrary/catalog/marc/html.py
6 openlibrary/catalog/marc/html.py
View
@@ -1,14 +1,14 @@
from openlibrary.catalog.marc.fast_parse import get_all_tag_lines, translate, split_line
import re
-trans = {'&':'&amp;','<':'&lt;','>':'&gt;','\n':'<br>'}
-re_html_replace = re.compile('([&<>\n])')
+trans = {'&':'&amp;','<':'&lt;','>':'&gt;','\n':'<br>', '\x1b': '<b>[esc]</b>'}
+re_html_replace = re.compile('([&<>\n\x1b])')
def esc(s):
return re_html_replace.sub(lambda m: trans[m.group(1)], s)
def esc_sp(s):
- return esc(s).replace(' ', '&nbsp;').replace('\x1b', '<b>[esc]</b>')
+ return esc(s).replace(' ', '&nbsp;')
class html_record():
def __init__(self, data):
Please sign in to comment.
Something went wrong with that request. Please try again.