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

Method renderContents

pattern/web/soup/BeautifulSoup.py:801–820  ·  view source on GitHub ↗

Renders the contents of this tag as a string in the given encoding. If encoding is None, returns a Unicode string..

(self, encoding=DEFAULT_OUTPUT_ENCODING,
                       prettyPrint=False, indentLevel=0)

Source from the content-addressed store, hash-verified

799 return self.__str__(encoding, True)
800
801 def renderContents(self, encoding=DEFAULT_OUTPUT_ENCODING,
802 prettyPrint=False, indentLevel=0):
803 """Renders the contents of this tag as a string in the given
804 encoding. If encoding is None, returns a Unicode string.."""
805 s=[]
806 for c in self:
807 text = None
808 if isinstance(c, NavigableString):
809 text = c.__str__(encoding)
810 elif isinstance(c, Tag):
811 s.append(c.__str__(encoding, prettyPrint, indentLevel))
812 if text and prettyPrint:
813 text = text.strip()
814 if text:
815 if prettyPrint:
816 s.append(" " * (indentLevel-1))
817 s.append(text)
818 if prettyPrint:
819 s.append("\n")
820 return ''.join(s)
821
822 #Soup methods
823

Callers 6

__str__Method · 0.95
getPropertyValueMethod · 0.80
testModifyAttributesMethod · 0.80
testRewrittenMetaTagMethod · 0.80

Calls 3

stripMethod · 0.80
__str__Method · 0.45
appendMethod · 0.45

Tested by 4

testModifyAttributesMethod · 0.64
testRewrittenMetaTagMethod · 0.64