schemaorg-examples-go

module
v0.0.0-...-5f7940a Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2025 License: MIT

README

schemaorg-examples-go

Utility for parsing the examples.txt files used by schemaorg.

  • Reference schema.org's examples by identifiers, terms, and snippets.
  • Build direct links to snippet sources with line offset tracking.

Snippet contents are normalized to remove internal commentary and normalize JSON into a valid JSON-LD document.

Usage

Import the module and refer to the code's documentation (pkg.go.dev).

import "github.com/dpb587/schemaorg-examples-go/examplestxt"

Some sample use cases and starter snippets can be found in the examples directory. The examples.txt file (or its siblings) are helpful for testing.

examples$ go run ./print eg-0461 RDFA </tmp/examples.txt
<div vocab="https://schema.org/" typeof="Event">
  <a property="url" href="nba-miami-philidelphia-game3.html">
  NBA Eastern Conference First Round Playoff Tickets:
  <span property="name"> Miami Heat at Philadelphia 76ers - Game 3 (Home Game 1) </span>
  </a>

  <meta property="startDate" content="2016-04-21T20:00">
    Thu, 04/21/16
    8:00 p.m.

  <div property="location" typeof="Place">
    <a property="url" href="wells-fargo-center.html">
    Wells Fargo Center
    </a>
    <div property="address" typeof="PostalAddress">
      <span property="addressLocality">Philadelphia</span>,
      <span property="addressRegion">PA</span>
    </div>
  </div>

  <div property="offers" typeof="AggregateOffer">
    <meta property="priceCurrency" content="USD" />
    Priced from: <span property="lowPrice" content="35">$35</span>
    <span property="offerCount">1938</span> tickets left
  </div>
</div>

License

MIT License

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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