Mercurial > repos > jankanis > blast2html
comparison blast2html.py @ 72:6ecbfebb9dd9
doc changes
author | Jan Kanis <jan.code@jankanis.nl> |
---|---|
date | Wed, 18 Jun 2014 14:33:12 +0200 |
parents | 371cd585e459 |
children | 67b1a319c6dc |
comparison
equal
deleted
inserted
replaced
71:371cd585e459 | 72:6ecbfebb9dd9 |
---|---|
1 #!/usr/bin/env python3 | 1 #!/usr/bin/env python3 |
2 # -*- coding: utf-8 -*- | 2 # -*- coding: utf-8 -*- |
3 | 3 |
4 # Copyright The Hyve B.V. 2014 | 4 # Copyright The Hyve B.V. 2014 |
5 # License: GPL version 3 or higher | 5 # License: GPL version 3 or (at your option) any higher version |
6 | 6 |
7 from __future__ import unicode_literals | 7 from __future__ import unicode_literals |
8 | 8 |
9 import sys | 9 import sys |
10 import math | 10 import math |
190 _js_escapes = (_base_js_escapes + | 190 _js_escapes = (_base_js_escapes + |
191 tuple(('%c' % z, '\\u%04X' % z) for z in range(32))) | 191 tuple(('%c' % z, '\\u%04X' % z) for z in range(32))) |
192 | 192 |
193 @filter | 193 @filter |
194 def js_string_escape(value): | 194 def js_string_escape(value): |
195 """Escape javascript string literal escapes. Note that this only works | 195 """ |
196 within javascript string literals, not in general javascript | 196 Javascript string literal escape. Note that this only escapes data |
197 snippets.""" | 197 for embedding within javascript string literals, not in general |
198 javascript snippets. | |
199 """ | |
198 | 200 |
199 value = str(value) | 201 value = str(value) |
200 | 202 |
201 for bad, good in _js_escapes: | 203 for bad, good in _js_escapes: |
202 value = value.replace(bad, good) | 204 value = value.replace(bad, good) |