html_tag.go
func newHTMLTag(ln *line, rslt *result, src *source, parent element, opts *Options) (*htmlTag, error) {
	if len(ln.tokens) < 1 {
		return nil, fmt.Errorf("an HTML tag is not specified [file: %s][line: %d]", ln.fileName(), ln.no)
	}

	s := ln.tokens[0]

	tagName := extractTagName(s)

	id, err := extractID(s, ln)
	if err != nil {
		return nil, err
	}

	classes := extractClasses(s)

	e := &htmlTag{
		elementBase:      newElementBase(ln, rslt, src, parent, opts),
		tagName:          tagName,
		id:               id,
		classes:          classes,
		containPlainText: strings.HasSuffix(s, dot),
		insertBr:         strings.HasSuffix(s, doubleDot),
		attributes:       make([]htmlAttribute, 0, 2),
	}

	if err := e.setAttributes(); err != nil {
		return nil, err
	}

	return e, nil
}
func newHTMLTag(ln *line, rslt *result, src *source, parent element, opts *Options) (*htmlTag, error) {
	if len(ln.tokens) < 1 {
		return nil, fmt.Errorf("an HTML tag is not specified [file: %s][line: %d]", ln.fileName(), ln.no)
	}

	s := ln.tokens[0]

	tagName := extractTagName(s)

	id, err := extractID(s, ln)
	if err != nil {
		return nil, err
	}

	classes := extractClasses(s)

	e := &htmlTag{
		elementBase:      newElementBase(ln, rslt, src, parent, opts),
		tagName:          tagName,
		id:               id,
		classes:          classes,
		containPlainText: strings.HasSuffix(s, dot),
		insertBr:         strings.HasSuffix(s, doubleDot),
		attributes:       make([]htmlAttribute, 0, 2),
	}

	if err := e.setAttributes(); err != nil {
		return nil, err
	}

	return e, nil
}
func newHTMLTag ( ln * line , rslt * result , src * source , parent element , opts * Options ) ( * htmlTag , error ) { if len ( ln . tokens ) < 1 { return nil , fmt . Errorf ( " " , ln . fileName ( ) , ln . no ) } s := ln . tokens [ 0 ] tagName := extractTagName ( s ) id , err := extractID ( s , ln ) if err != nil { return nil , err } classes := extractClasses ( s ) e := & htmlTag { elementBase : newElementBase ( ln , rslt , src , parent , opts ) , tagName : tagName , id : id , classes : classes , containPlainText : strings . HasSuffix ( s , dot ) , insertBr : strings . HasSuffix ( s , doubleDot ) , attributes : make ( [ ] htmlAttribute , 0 , 2 ) , } if err := e . setAttributes ( ) ; err != nil { return nil , err } return e , nil }
// newHTMLTag creates and returns an HTML tag.
newHTMLTag creates and returns an HTML tag .