def _filter_doc_html(request, doc, doc_html, rendering_params):
 if rendering_params['summary']:
  return doc.get_summary_html()
 if (not (rendering_params['section'] or rendering_params['raw'] or rendering_params['edit_links'] or rendering_params['include'])):
  return doc_html
 tool = kuma.wiki.content.parse(doc_html)
 if rendering_params['raw']:
  tool.injectSectionIDs()
  tool.filterEditorSafety()
 if rendering_params['section']:
  tool.extractSection(rendering_params['section'])
 if ((rendering_params['edit_links'] or (not rendering_params['raw'])) and request.user.is_authenticated() and doc.allows_revision_by(request.user)):
  tool.injectSectionEditingLinks(doc.slug, doc.locale)
 doc_html = tool.serialize()
 if rendering_params['include']:
  doc_html = kuma.wiki.content.filter_out_noinclude(doc_html)
 return doc_html

def _filter_doc_html ( request , doc , doc_html , rendering_params ) : if rendering_params [ 'summary' ] : return doc . get_summary_html ( ) if ( not ( rendering_params [ 'section' ] or rendering_params [ 'raw' ] or rendering_params [ 'edit_links' ] or rendering_params [ 'include' ] ) ) : return doc_html tool = kuma . wiki . content . parse ( doc_html ) if rendering_params [ 'raw' ] : tool . injectSectionIDs ( ) tool . filterEditorSafety ( ) if rendering_params [ 'section' ] : tool . extractSection ( rendering_params [ 'section' ] ) if ( ( rendering_params [ 'edit_links' ] or ( not rendering_params [ 'raw' ] ) ) and request . user . is_authenticated ( ) and doc . allows_revision_by ( request . user ) ) : tool . injectSectionEditingLinks ( doc . slug , doc . locale ) doc_html = tool . serialize ( ) if rendering_params [ 'include' ] : doc_html = kuma . wiki . content . filter_out_noinclude ( doc_html ) return doc_html
apply needed filtering/annotating operations to a documents html .