Documentation
¶
Overview ¶
Package structured provides typed schema.org parsing from JSON-LD and HTML Microdata.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Article ¶
type Article struct {
Headline *string
Author *string
Description *string
DatePublished *string
Image *string
}
Article represents a schema.org Article/NewsArticle.
type Data ¶
type Data struct {
// contains filtered or unexported fields
}
Data wraps parsed microdata with typed accessors.
func ParseNode ¶ added in v1.29.0
ParseNode extracts JSON-LD and Microdata from an ALREADY-PARSED HTML node tree, mirroring Parse but skipping its reader/html.Parse step. For a caller that already holds a parsed tree — e.g. extract.schemaPlaceCandidates, which reuses a *goquery.Document's own root node — this avoids a redundant serialize-back-to-string-then-reparse round trip over the same page. astappiev/microdata's own ParseHTML does exactly this internally (html.Parse then ParseNode), so this is the same walk, just fed a tree the caller already has.
func (*Data) FirstArticle ¶
FirstArticle finds the first Article-like item.
func (*Data) FirstOrganization ¶
func (d *Data) FirstOrganization() *Organization
FirstOrganization finds the first Organization item.
func (*Data) FirstPlace ¶
FirstPlace finds the first Place-like item.
type Organization ¶
type Organization struct {
Name *string
URL *string
Phone *string
Address *string
Hours *string
// LegalName is the schema.org legalName property when present — its presence
// is itself a strong signal the Org block describes a registered legal entity.
LegalName *string
// HasLegalID reports whether a Russian legal-entity identifier
// (ИНН/ОГРН/ОГРНИП/КПП) or its schema.org analogue (taxID/vatID) appears
// anywhere in the Organization item -- as a property key, a property value, or
// inside any nested item. Presence corroborates that the Org address is the
// registered/legal seat.
HasLegalID bool
}
Organization represents a schema.org Organization.
LegalName and HasLegalID are corroborant signals for the legal-address PROVENANCE arm (see extract.applyOrgFacts). An Organization itemtype CAN be the registered legal entity, but a bare Organization block whose streetAddress is in fact the venue's visiting address (no separate Place block, no legal identifiers) must NOT have that address demoted out of the map slot. These fields let the extract layer require a corroborating legal signal before treating the Org streetAddress as legal-by-provenance.