Пример #1
0
func parseHTML(html string) model.FormattedText {
	node, err := utils.ParseHTML(strings.NewReader(html))
	if err != nil {
		return nil
	}
	return model.HTML{Root: node}
}
Пример #2
0
func processHTML(text string, images model.ImagesDict) model.FormattedText {
	node, err := utils.ParseHTML(strings.NewReader(text))
	if err != nil {
		return model.RawText(text)
	}
	processHTMLNode(node, images)
	return model.HTML{Root: node}
}
Пример #3
0
func parseSGML(textNode *SGMLNode) model.FormattedText {
	if textNode == nil {
		return nil
	}
	node, err := utils.ParseHTML(strings.NewReader(textNode.Text))
	if err != nil {
		return nil
	}
	transformSGML(node)
	return SGML{HTML: model.HTML{Root: node}}
}