parser

package module
v0.0.0-...-318855b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WHITESPACE            = " \t\r\n\f"
	LIMIT_REPORT_LINES    = 50
	TWO_KEYS_MERGE_FORMAT = "%s||%s"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CaniuseDB

type CaniuseDB struct {
	HtmlTags            map[string]map[string]interface{} `json:"html_tags"`
	HtmlAttributes      map[string]map[string]interface{} `json:"html_attributes"`
	CssProperties       map[string]map[string]interface{} `json:"css_properties"`
	AtRuleCssStatements map[string]map[string]interface{} `json:"at_rule_css_statements"`
	CssSelectorTypes    map[string]interface{}            `json:"css_selector_types"`
	CssDimentions       map[string]interface{}            `json:"css_dimentions"`
	CssFunctions        map[string]interface{}            `json:"css_functions"`
	CssPseudoSelectors  map[string]interface{}            `json:"css_pseudo_selectors"`
	ImgFormats          map[string]interface{}            `json:"img_formats"`
	LinkTypes           map[string]interface{}            `json:"link_types"`
	CssVariables        interface{}                       `json:"css_variables"`
	CssImportant        interface{}                       `json:"css_important"`
	Html5Doctype        interface{}                       `json:"html5_doctype"`
}

type CssSelectorType

type CssSelectorType int

css selectors

const (
	ADJACENT_SIBLING_COMBINATOR_TYPE CssSelectorType = iota // The adjacent sibling combinator (`h1 + p`) allows to target an element that is directly after another.
	ATTRIBUTE_SELECTOR_TYPE                                 // The attribute selector (`[attr]`) targets elements with this specific attribute.
	CHAINING_SELECTORS_TYPE                                 // Chaining selectors (`.foo.bar`) allows to apply styles to elements matching all the corresponding selectors.
	CHILD_COMBINATOR_TYPE                                   // The child combinator is represented by a superior sign (`>`) between two selectors and matches the second selector if it is a direct child of the first selector.
	CLASS_SELECTOR_TYPE                                     // The class selector (`.className`) allows to apply styles to a group of elements with the corresponding `class` attribute.
	DESCENDANT_COMBINATOR_TYPE                              // The descendant combinator is represented by a space (` `) between two selectors and matches the second selector if it has ancestor matching the first selector.
	GENERAL_SIBLING_COMBINATOR_TYPE                         // The general sibling combinator (`img ~ p`) allows to target any element that after another (directly or indirectly).
	GROUPING_SELECTORS_TYPE                                 // Grouping selectors (`.foo, .bar`) allows to apply the same styles to the different corresponding elements.
	ID_SELECTOR_TYPE                                        // The ID selector (`#id`) allows to apply styles to an element with the corresponding `id` attribute.
	TYPE_SELECTOR_TYPE                                      // Type selector or element selectors allow to apply styles by HTML element names.
	UNIVERSAL_SELECTOR_STAR_TYPE                            // The universal selector (`*`) allows to apply styles to every elements.
)

func (CssSelectorType) String

func (d CssSelectorType) String() string

type ParseReport

type ParseReport struct {
	HtmlTags            map[string]map[string]ReportContainer `json:"html_tags"`
	HtmlAttributes      map[string]map[string]ReportContainer `json:"html_attributes"`
	CssProperties       map[string]map[string]ReportContainer `json:"css_properties"`
	AtRuleCssStatements map[string]map[string]ReportContainer `json:"at_rule_css_statements"`
	CssSelectorTypes    map[string]ReportContainer            `json:"css_selector_types"`
	CssDimentions       map[string]ReportContainer            `json:"css_dimentions"`
	CssFunctions        map[string]ReportContainer            `json:"css_functions"`
	CssPseudoSelectors  map[string]ReportContainer            `json:"css_pseudo_selectors"`
	ImgFormats          map[string]ReportContainer            `json:"img_formats"`
	LinkTypes           map[string]ReportContainer            `json:"link_types"`
	CssVariables        ReportContainer                       `json:"css_variables"`
	CssImportant        ReportContainer                       `json:"css_important"`
	Html5Doctype        ReportContainer                       `json:"html5_doctype"`
}

func ReportFromHTML

func ReportFromHTML(document []byte) (*ParseReport, error)

type ParserEngine

type ParserEngine struct {
	// contains filtered or unexported fields
}

func InitParser

func InitParser() *ParserEngine

func (*ParserEngine) Report

func (prs *ParserEngine) Report(document []byte) (*ParseReport, error)

type ReportContainer

type ReportContainer struct {
	Rules     interface{}  `json:"rules"`
	Lines     map[int]bool `json:"lines"`
	MoreLines bool         `json:"more_lines"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL