MCPcopy
hub / github.com/pyload/pyload / handle_charref

Method handle_charref

module/lib/feedparser.py:1901–1912  ·  view source on GitHub ↗
(self, ref)

Source from the content-addressed store, hash-verified

1899 self.pieces.append("</%(tag)s>" % locals())
1900
1901 def handle_charref(self, ref):
1902 # called for each character reference, e.g. for '&#160;', ref will be '160'
1903 # Reconstruct the original character reference.
1904 if ref.startswith('x'):
1905 value = unichr(int(ref[1:],16))
1906 else:
1907 value = unichr(int(ref))
1908
1909 if value in _cp1252.keys():
1910 self.pieces.append('&#%s;' % hex(ord(_cp1252[value]))[1:])
1911 else:
1912 self.pieces.append('&#%(ref)s;' % locals())
1913
1914 def handle_entityref(self, ref):
1915 # called for each entity reference, e.g. for '&copy;', ref will be 'copy'

Callers

nothing calls this directly

Calls 2

keysMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected