htab = []byte{'\t'};
htabs = [...]byte{'\t', '\t', '\t', '\t', '\t', '\t', '\t', '\t'};
newlines = [...]byte{'\n', '\n', '\n', '\n', '\n', '\n', '\n', '\n'}; // more than maxNewlines
+ formfeeds = [...]byte{'\f', '\f', '\f', '\f', '\f', '\f', '\f', '\f'}; // more than maxNewlines
esc_quot = strings.Bytes("""); // shorter than """
esc_apos = strings.Bytes("'"); // shorter than "'"
}
+func (p *printer) writeFormfeeds(n int) {
+ if n > 0 {
+ if n > maxNewlines {
+ n = maxNewlines;
+ }
+ p.write(formfeeds[0:n]);
+ }
+}
+
+
func (p *printer) writeTaggedItem(data []byte, tag HtmlTag) {
// write start tag, if any
// (no html-escaping and no p.pos update for tags - use write0)
}
p.writeWhitespace(j);
}
- p.writeNewlines(pos.Line - p.last.Line);
+ // use formfeeds to break columns before a comment;
+ // this is analogous to using formfeeds to separate
+ // individual lines of /*-style comments
+ p.writeFormfeeds(pos.Line - p.last.Line);
}
}
// write comment lines, separated by formfeed,
// without a line break after the last line
- linebreak := []byte{byte(formfeed)};
+ linebreak := formfeeds[0:1];
pos := comment.Pos();
for i, line := range lines {
if i > 0 {