Documentation ¶
Index ¶
- func CreateAnchor(href, text string) *html.Node
- func CreateDiv(id int) *html.Node
- func CreateDivTree() []*html.Node
- func CreateHTML() *html.Node
- func CreateHeading(n int, value string) *html.Node
- func CreateListItem(text string) *html.Node
- func CreateMetaName(name string, content string) *html.Node
- func CreateMetaProperty(property string, content string) *html.Node
- func CreateParagraph(text string) *html.Node
- func CreateSpan(text string) *html.Node
- func CreateTitle(value string) *html.Node
- func GetContentFromTextDocument(doc *webdoc.TextDocument) string
- func GetPrettyHTML(node *html.Node) string
- func NewTextDocumentFromPage(doc *html.Node, wc stringutil.WordCounter, pageURL *url.URL) *webdoc.TextDocument
- func RemoveAllDirAttributes(str string) string
- type FakeWebDocumentBuilder
- func (db *FakeWebDocumentBuilder) AddDataTable(e *html.Node)
- func (db *FakeWebDocumentBuilder) AddEmbed(embed webdoc.Element)
- func (db *FakeWebDocumentBuilder) AddLineBreak(node *html.Node)
- func (db *FakeWebDocumentBuilder) AddTag(tag *webdoc.Tag)
- func (db *FakeWebDocumentBuilder) AddTextNode(textNode *html.Node)
- func (db *FakeWebDocumentBuilder) Build() string
- func (db *FakeWebDocumentBuilder) EndNode()
- func (db *FakeWebDocumentBuilder) SkipNode(e *html.Node)
- func (db *FakeWebDocumentBuilder) StartNode(e *html.Node)
- type PageParamContentInfo
- type PageParamContentType
- type TextBlockBuilder
- type TextBuilder
- type TextDocumentBuilder
- type WebDocumentBuilder
- func (db *WebDocumentBuilder) AddAnchorText(text string) *webdoc.Text
- func (db *WebDocumentBuilder) AddImage() *webdoc.Image
- func (db *WebDocumentBuilder) AddLeadImage() *webdoc.Image
- func (db *WebDocumentBuilder) AddNestedText(text string) *webdoc.Text
- func (db *WebDocumentBuilder) AddTable(innerHTML string) *webdoc.Table
- func (db *WebDocumentBuilder) AddTagEnd(tagName string) *webdoc.Tag
- func (db *WebDocumentBuilder) AddTagStart(tagName string) *webdoc.Tag
- func (db *WebDocumentBuilder) AddText(text string) *webdoc.Text
- func (db *WebDocumentBuilder) Build() *webdoc.Document
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateAnchor ¶
func CreateDivTree ¶
func CreateHTML ¶
CreateHTML returns an <html> that consist of empty <head> and <body>. This is an additional method and doesn't exist in original Java code.
func CreateListItem ¶
func CreateParagraph ¶
func CreateSpan ¶
func CreateTitle ¶
func GetContentFromTextDocument ¶
func GetContentFromTextDocument(doc *webdoc.TextDocument) string
func GetPrettyHTML ¶
GetPrettyHTML returns formatted outer HTML of the node.
func NewTextDocumentFromPage ¶
func NewTextDocumentFromPage(doc *html.Node, wc stringutil.WordCounter, pageURL *url.URL) *webdoc.TextDocument
func RemoveAllDirAttributes ¶
Types ¶
type FakeWebDocumentBuilder ¶
type FakeWebDocumentBuilder struct {
// contains filtered or unexported fields
}
FakeWebDocumentBuilder is a simple builder that just creates an html-like string from the calls. Only used for dom-converter test.
func NewFakeWebDocumentBuilder ¶
func NewFakeWebDocumentBuilder() *FakeWebDocumentBuilder
func (*FakeWebDocumentBuilder) AddDataTable ¶
func (db *FakeWebDocumentBuilder) AddDataTable(e *html.Node)
func (*FakeWebDocumentBuilder) AddEmbed ¶
func (db *FakeWebDocumentBuilder) AddEmbed(embed webdoc.Element)
func (*FakeWebDocumentBuilder) AddLineBreak ¶
func (db *FakeWebDocumentBuilder) AddLineBreak(node *html.Node)
func (*FakeWebDocumentBuilder) AddTag ¶
func (db *FakeWebDocumentBuilder) AddTag(tag *webdoc.Tag)
func (*FakeWebDocumentBuilder) AddTextNode ¶
func (db *FakeWebDocumentBuilder) AddTextNode(textNode *html.Node)
func (*FakeWebDocumentBuilder) Build ¶
func (db *FakeWebDocumentBuilder) Build() string
func (*FakeWebDocumentBuilder) EndNode ¶
func (db *FakeWebDocumentBuilder) EndNode()
func (*FakeWebDocumentBuilder) SkipNode ¶
func (db *FakeWebDocumentBuilder) SkipNode(e *html.Node)
func (*FakeWebDocumentBuilder) StartNode ¶
func (db *FakeWebDocumentBuilder) StartNode(e *html.Node)
type PageParamContentInfo ¶
type PageParamContentInfo struct { Type PageParamContentType TargetURL string Number int }
func PPCINumberInPlainText ¶
func PPCINumberInPlainText(number int) *PageParamContentInfo
func PPCINumericOutlink ¶
func PPCINumericOutlink(targetURL string, number int) *PageParamContentInfo
func PPCIUnrelatedTerms ¶
func PPCIUnrelatedTerms() *PageParamContentInfo
type PageParamContentType ¶
type PageParamContentType uint
const ( NumberInPlainText NumericOutlink )
type TextBlockBuilder ¶
type TextBlockBuilder struct {
// contains filtered or unexported fields
}
func NewTextBlockBuilder ¶
func NewTextBlockBuilder(wc stringutil.WordCounter) *TextBlockBuilder
func (*TextBlockBuilder) CreateForAnchorText ¶
func (tbb *TextBlockBuilder) CreateForAnchorText(text string) *webdoc.TextBlock
func (*TextBlockBuilder) CreateForText ¶
func (tbb *TextBlockBuilder) CreateForText(text string) *webdoc.TextBlock
type TextBuilder ¶
type TextBuilder struct {
// contains filtered or unexported fields
}
func NewTextBuilder ¶
func NewTextBuilder(wc stringutil.WordCounter) *TextBuilder
func (*TextBuilder) CreateForAnchorText ¶
func (tb *TextBuilder) CreateForAnchorText(str string) *webdoc.Text
func (*TextBuilder) CreateForText ¶
func (tb *TextBuilder) CreateForText(str string) *webdoc.Text
func (*TextBuilder) CreateNestedText ¶
func (tb *TextBuilder) CreateNestedText(str string, levels int) *webdoc.Text
type TextDocumentBuilder ¶
type TextDocumentBuilder struct {
// contains filtered or unexported fields
}
func NewTextDocumentBuilder ¶
func NewTextDocumentBuilder(wc stringutil.WordCounter) *TextDocumentBuilder
func (*TextDocumentBuilder) AddContentBlock ¶
func (tdb *TextDocumentBuilder) AddContentBlock(str string, labels ...string) *webdoc.TextBlock
func (*TextDocumentBuilder) AddNonContentBlock ¶
func (tdb *TextDocumentBuilder) AddNonContentBlock(str string, labels ...string) *webdoc.TextBlock
func (*TextDocumentBuilder) Build ¶
func (tdb *TextDocumentBuilder) Build() *webdoc.TextDocument
type WebDocumentBuilder ¶
type WebDocumentBuilder struct {
// contains filtered or unexported fields
}
WebDocumentBuilder is a simple builder for testing.
func NewWebDocumentBuilder ¶
func NewWebDocumentBuilder() *WebDocumentBuilder
func (*WebDocumentBuilder) AddAnchorText ¶
func (db *WebDocumentBuilder) AddAnchorText(text string) *webdoc.Text
func (*WebDocumentBuilder) AddImage ¶
func (db *WebDocumentBuilder) AddImage() *webdoc.Image
func (*WebDocumentBuilder) AddLeadImage ¶
func (db *WebDocumentBuilder) AddLeadImage() *webdoc.Image
func (*WebDocumentBuilder) AddNestedText ¶
func (db *WebDocumentBuilder) AddNestedText(text string) *webdoc.Text
func (*WebDocumentBuilder) AddTable ¶
func (db *WebDocumentBuilder) AddTable(innerHTML string) *webdoc.Table
func (*WebDocumentBuilder) AddTagEnd ¶
func (db *WebDocumentBuilder) AddTagEnd(tagName string) *webdoc.Tag
func (*WebDocumentBuilder) AddTagStart ¶
func (db *WebDocumentBuilder) AddTagStart(tagName string) *webdoc.Tag
func (*WebDocumentBuilder) AddText ¶
func (db *WebDocumentBuilder) AddText(text string) *webdoc.Text
func (*WebDocumentBuilder) Build ¶
func (db *WebDocumentBuilder) Build() *webdoc.Document
Click to show internal directories.
Click to hide internal directories.