Microdata v0.0.1 Microdata View Source
Microdata is an Elixir library for parsing microdata from a provided document.
Caveats:
itemref
lookups are not yet supported- Only supports HTML parsing, ie no JSON or RDFa support
If you need any of the above, contribs adding this support are most welcome!
Credits
We are building a conversational cooking assistant that uses Alexa & Google Home to answer questions like “what am I supposed to be doing?” and “what’s next for the lasagna?” while you’re in the kitchen, so you don’t risk getting raw chicken juice or sticky sauces on your fancy cookbooks and expensive electronics.
We wrote this lib for recipe parsing—ie so users can import recipes from all around the internet—and wanted to share it back with the community, as there are loads of ways you might use microdata in your own projects. Hope you enjoy!
If you’d like to join our private beta, please send an email to hi [AT] cookformom [DOT] com, letting us know A) which voice assistant you use; B) your favourite meal; and C) what you want to learn to cook next.
Have a nice day :)
Link to this section Summary
Functions
Parses Microdata from a given document, and returns a %Microdata.Document{} struct
Link to this section Functions
parse([{:file, String.t()}]) :: Microdata.Document.t()
parse([{:url, String.t()}]) :: Microdata.Document.t()
parse(String.t()) :: Microdata.Document.t()
Parses Microdata from a given document, and returns a %Microdata.Document{} struct.
Examples (n.b. tested manually; not a doctest!)
iex> Microdata.parse("<html itemscope itemtype='foo'><body><p itemprop='bar'>baz</p></body></html>")
%Microdata.Document{
items: [
%Microdata.Item{
types: ["foo"],
properties: [
%Microdata.Property{
id: nil,
properties: [
%Microdata.Property{
names: ["bar"],
value: "baz"
}
],
}
],
types: ["foo"]
}
]
}
iex> Microdata.parse(file: "path/to/file.html")
%Microdata.Document{...}
iex> Microdata.parse(url: "https://website.com/path/to/page")
%Microdata.Document{...}