// Structs for handling text nodes
package main
import (
"encoding/xml"
)
// Text nodes are either a paragraph or a blockquote.
type TextNode interface {
Order() int
}
// A paragraph contains character data and other text-oriented tags, such as
// b or strong. This data should be retained as raw XML.
type Paragraph struct {
XMLName xml.Name `xml:"p"`
Text string `xml:",innerxml"`
order int `xml:"-"`
}
func (p Paragraph) Order() int {
return p.order
}
// A blockquote contains paragraphs. Unlike divisions, the blockquote structure
// must be maintained in order to format the paragraphs correctly.
type BlockQuote struct {
XMLName xml.Name `xml:"blockquote"`
Paragraphs []Paragraph `xml:"p"`
order int `xml:"-"`
}
func (b BlockQuote) Order() int {
return b.order
}