AdvancedHTMLParser.utils
index

# Copyright (c) 2015 Tim Savannah  under terms of LGPLv3

 
Modules
       
re

 
Functions
       
addStartTag(contents, startTag)
addStartTag - Safetly add a start tag to the document, taking into account the DOCTYPE
 
@param contents <str> - Contents
@param startTag <str> - Fully formed tag, i.e. <html>
stripIEConditionals(contents, addHtmlIfMissing=True)
stripIEConditionals - Strips Internet Explorer conditional statements.
 
@param contents <str> - Contents String
@param addHtmlIfMissing <bool> - Since these normally encompass the "html" element, optionally add it back if missing.

 
Data
        DOCTYPE_MATCH = re.compile('[\n]*[ \t]*(?P<tag><[!][ \t]*[dD][oO][cC][tT][yY][pP][eE].*[>])')
END_HTML = re.compile('.*</[ \t\r\n]*[hH][tT][mM][lL][ \t\r\n]*>.*', re.DOTALL)
IE_CONDITIONAL_PATTERN = re.compile('[<][!][-][-][ \t\r\n]*[\\[][ \t\r\n]*if.*-->', re.MULTILINE)
START_HTML = re.compile('.*<[ \t\r\n]*[hH][tT][mM][lL][ \t\r\n]*>.*', re.DOTALL)