def test_escape_html_nosub2(self): substart = "<sub>" subend = "</sub>" teststring = "<escape & skip sub tags>" resstring = xml_util.escape_html_nosub(substart + teststring + subend) goalstring = substart + html_escape(teststring) + subend self.assertTrue(resstring == goalstring, "{0}\nshould be\n{1}".format(resstring, goalstring))
def test_escape_html_nosub2(self): substart = "<sub>" subend = "</sub>" teststring = "<escape & skip sub tags>" resstring = xml_util.escape_html_nosub(substart + teststring + subend) goalstring = substart + html_escape(teststring) + subend self.assertTrue(resstring == goalstring, \ "{0}\nshould be\n{1}".format(resstring,goalstring))
def _cit_list(self): res = [] citations = self.xml.references_cited.citation for citation in citations: cit_data = citation.contents_of('category') if citation.patcit: for tag in ['country','doc_number','date','kind','name']: contents = citation.contents_of(tag) if isinstance(contents, list) and contents: cit_data.append(contents[0]) else: cit_data.append(contents if xml_util.has_content(contents) else '') cit_data.append('') if citation.othercit: contents = citation.contents_of('othercit') for chunk in contents: cit_data.extend(['','','','','']) if isinstance(chunk,list): cit_data.append(''.join([xml_util.escape_html_nosub(x) for x in chunk]).upper()) else: cit_data.append(xml_util.escape_html_nosub(chunk)) res.append(cit_data) return res
def test_escape_html_nosub(self): teststring = "<tag1> ampersand here: & </tag1>" resstring = xml_util.escape_html_nosub(teststring) goalstring = html_escape(teststring) self.assertTrue(resstring == goalstring, \ "{0}\nshould be\n{1}".format(resstring,goalstring))
def test_escape_html_nosub(self): teststring = "<tag1> ampersand here: & </tag1>" resstring = xml_util.escape_html_nosub(teststring) goalstring = html_escape(teststring) self.assertTrue(resstring == goalstring, "{0}\nshould be\n{1}".format(resstring, goalstring))