MCPcopy Index your code
hub / github.com/clips/pattern / enc

Function enc

pattern/web/pdf/utils.py:161–164  ·  view source on GitHub ↗

Encodes a string for SGML/XML/HTML

(x, codec='ascii')

Source from the content-addressed store, hash-verified

159
160# enc
161def enc(x, codec='ascii'):
162 """Encodes a string for SGML/XML/HTML"""
163 x = x.replace('&','&amp;').replace('>','&gt;').replace('<','&lt;').replace('"','&quot;')
164 return x.encode(codec, 'xmlcharrefreplace')
165
166def bbox2str((x0,y0,x1,y1)):
167 return '%.3f,%.3f,%.3f,%.3f' % (x0, y0, x1, y1)

Callers 7

write_textMethod · 0.90
place_imageMethod · 0.90
write_textMethod · 0.90
renderMethod · 0.90
render_stringMethod · 0.90
begin_tagMethod · 0.90
end_tagMethod · 0.90

Calls 1

encodeMethod · 0.45

Tested by

no test coverage detected