parser

package module
v0.0.0-...-c15794f Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

This section is empty.

Types

type AtRuleCssStatementsReport

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

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"`
	CssVariables        interface{}                       `json:"css_variables"`
}

type CssDimentionsReport

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

type CssFunctionsReport

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

type CssPropertyReport

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

type CssPseudoSelectorsReport

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

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 CssSelectorTypeReport

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

type CssVariablesReport

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

type HTMLTagReport

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

type HtmlAttributesReport

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

type ImgFormatsReport

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

type ParseReport

type ParseReport struct {
	HtmlTags            map[string]map[string]HTMLTagReport             `json:"html_tags"`
	HtmlAttributes      map[string]map[string]HtmlAttributesReport      `json:"html_attributes"`
	CssProperties       map[string]map[string]CssPropertyReport         `json:"css_properties"`
	AtRuleCssStatements map[string]map[string]AtRuleCssStatementsReport `json:"at_rule_css_statements"`
	CssSelectorTypes    map[string]CssSelectorTypeReport                `json:"css_selector_types"`
	CssDimentions       map[string]CssDimentionsReport                  `json:"css_dimentions"`
	CssFunctions        map[string]CssFunctionsReport                   `json:"css_functions"`
	CssPseudoSelectors  map[string]CssPseudoSelectorsReport             `json:"css_pseudo_selectors"`
	ImgFormats          map[string]ImgFormatsReport                     `json:"img_formats"`
	CssVariables        CssVariablesReport                              `json:"css_variables"`
}

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)

Jump to

Keyboard shortcuts

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