Documentation ¶
Overview ¶
package 'html' offers means to reduce the size of a given html-document it's similar naive and simplistic as 'css' but it yields good-enough results to be usable.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddExtraNewlines ¶
func AddExtraNewlines(z *tokenizer) error
config-option: add a newline after certain html-tags to keep some readability in the reduced document. newlines are added after <!doctype html>, <html>,</html>, <head>,</head>, </title>, </script>, </style>, <link>, <body>,</body>
func AllowCDATA ¶
func AllowCDATA(z *tokenizer) error
see http://godoc.org/golang.org/x/net/html#Tokenizer.AllowCDATA
func DontStripComments ¶
func DontStripComments(z *tokenizer) error
func Reduce ¶
reads html-document from 'reader' and writes the reduced form of the document to 'writer'. example:
ReduceFile(os.Stdout, "index.html", AddExtraNewlines)
'Reduce' tries to not change any semantics of the given document. eg, it lets <script>, <style> and <pre> tokens "mostly" unaltered (no wspace changes, just some html-escaping inside <pre>)