def format(self, content: Optional[QqTag],
blanks_to_pars=True,
keep_end_pars=True) -> str:
"""
:param content: could be QqTag or any iterable of QqTags
:param blanks_to_pars: use blanks_to_pars (True or False)
:param keep_end_pars: keep end paragraphs
:return: str: text of tag
"""
if content is None:
return ""
out = []
for child in content:
if isinstance(child, str):
if blanks_to_pars:
out.append(self.blanks_to_pars(html_escape(
child, keep_end_pars)))
else:
out.append(html_escape(child))
else:
out.append(self.handle(child))
return "".join(out)
评论列表
文章目录