diff --git a/src/pkg/html/Makefile b/src/pkg/html/Makefile index 3c3de8ee31..da5c3f2a3e 100644 --- a/src/pkg/html/Makefile +++ b/src/pkg/html/Makefile @@ -11,6 +11,7 @@ GOFILES=\ doctype.go\ entity.go\ escape.go\ + foreign.go\ node.go\ parse.go\ render.go\ diff --git a/src/pkg/html/foreign.go b/src/pkg/html/foreign.go new file mode 100644 index 0000000000..0f9b4ad560 --- /dev/null +++ b/src/pkg/html/foreign.go @@ -0,0 +1,56 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package html + +// Section 12.2.5.5. +var breakout = map[string]bool{ + "b": true, + "big": true, + "blockquote": true, + "body": true, + "br": true, + "center": true, + "code": true, + "dd": true, + "div": true, + "dl": true, + "dt": true, + "em": true, + "embed": true, + "font": true, + "h1": true, + "h2": true, + "h3": true, + "h4": true, + "h5": true, + "h6": true, + "head": true, + "hr": true, + "i": true, + "img": true, + "li": true, + "listing": true, + "menu": true, + "meta": true, + "nobr": true, + "ol": true, + "p": true, + "pre": true, + "ruby": true, + "s": true, + "small": true, + "span": true, + "strong": true, + "strike": true, + "sub": true, + "sup": true, + "table": true, + "tt": true, + "u": true, + "ul": true, + "var": true, +} + +// TODO: add look-up tables for MathML and SVG adjustments. diff --git a/src/pkg/html/node.go b/src/pkg/html/node.go index 5ca6035c11..b0d42cece0 100644 --- a/src/pkg/html/node.go +++ b/src/pkg/html/node.go @@ -24,14 +24,15 @@ var scopeMarker = Node{Type: scopeMarkerNode} // A Node consists of a NodeType and some Data (tag name for element nodes, // content for text) and are part of a tree of Nodes. Element nodes may also -// contain a slice of Attributes. Data is unescaped, so that it looks like -// "a", n.Data) + if n.Namespace != "" { + fmt.Fprintf(w, "<%s %s>", n.Namespace, n.Data) + } else { + fmt.Fprintf(w, "<%s>", n.Data) + } for _, a := range n.Attr { io.WriteString(w, "\n") dumpIndent(w, level+1) @@ -161,6 +165,7 @@ func TestParser(t *testing.T) { n int }{ // TODO(nigeltao): Process all the test cases from all the .dat files. + {"adoption01.dat", -1}, {"doctype01.dat", -1}, {"tests1.dat", -1}, {"tests2.dat", -1},