format.HtmlPrettyPrinter Extends
This class formats HTML to be more human-readable. TODO(user): Add hierarchical indentation.

Inheritance

Constructor

goog.format.HtmlPrettyPrinter(opt_timeOutMillis)

Parameters

opt_timeOutMillis : number=
Max # milliseconds to spend on #format. If this time is exceeded, return partially formatted. 0 or negative number indicates no timeout.

Instance Methods

Public Protected Private
format(html) string
Breaks up HTML so it's easily readable by the user.
Arguments:
html : string
The HTML text to pretty print.
Returns: string  Formatted result.
code »

Instance Properties

timeOutMillis_ :
Max # milliseconds to spend on #format.
Code »

Static Methods

goog.format.HtmlPrettyPrinter.format(html) string
Static utility function. See prototype #format.
Arguments:
html : string
The HTML text to pretty print.
Returns: string  Formatted result.
code »
goog.format.HtmlPrettyPrinter.getInstance_() !goog.format.HtmlPrettyPrinter
Singleton lazy initializer.
Returns: !goog.format.HtmlPrettyPrinter  Singleton.
code »

Static Properties

goog.format.HtmlPrettyPrinter.BLOCK_TAGS_ :
'Block' tags. We should add newlines before and after these tags during pretty printing. Tags drawn mostly from HTML4 definitions for block and other non-online tags, excepting the ones in #goog.format.HtmlPrettyPrinter.NON_PRETTY_PRINTED_TAGS_.
Code »
goog.format.HtmlPrettyPrinter.BREAKS_FLOW_TAGS_ :
Non-block tags that break flow. We insert a line break after, but not before these. Tags drawn from HTML4 definitions.
Code »
goog.format.HtmlPrettyPrinter.EMPTY_TAGS_ :
Empty tags. These are treated as both start and end tags.
Code »
goog.format.HtmlPrettyPrinter.NON_PRETTY_PRINTED_TAGS_ :
Tags whose contents we don't want pretty printed.
Code »
goog.format.HtmlPrettyPrinter.TOKEN_REGEX_ :
List of patterns used to tokenize HTML for pretty printing. Cache subexpression for tag name. comment|meta-tag|tag|text|other-less-than-characters
Code »
goog.format.HtmlPrettyPrinter.instance_ : goog.format.HtmlPrettyPrinter
Singleton.
Code »

Package format

Package Reference