Project

micromicro

0.0
There's a lot of open issues
Extract microformats2-encoded data from HTML documents.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

MicroMicro

A Ruby gem for extracting microformats2-encoded data from HTML documents.

Gem Downloads Build

Key Features

Note: MicroMicro does not parse Classic Microformats (referred to in the parsing specification as "backcompat root classes" and "backcompat properties" and in vocabulary specifications in the "Parser Compatibility" sections [e.g. h-entry]). To parse documents marked up with Classic Microformats, consider using the official microformats-ruby parser.

¹ …with some exceptions until this pull request is merged.

Installation

Before installing and using MicroMicro, you'll want to have Ruby 3.0 (or newer) installed. If you're using Bundler to manage gem dependencies, add MicroMicro to your project's Gemfile:

gem 'micromicro'

…and run bundle install in your shell.

To install the gem manually, run the following in your shell:

gem install micromicro

Usage

MicroMicro's parse method accepts two arguments: a String of markup and a String representing the URL associated with that markup. The resulting MicroMicro::Document may be converted to a Hash which may be further manipulated using conventional Ruby tooling.

require 'micromicro'

doc = MicroMicro.parse('<div class="h-card">Jason Garber</div>', 'https://sixtwothree.org')
#=> #<MicroMicro::Document items: #<MicroMicro::Collections::ItemsCollection count: 1, members: [#<MicroMicro::Item types: ["h-card"], properties: 1, children: 0>]>, relationships: #<MicroMicro::Collections::RelationshipsCollection count: 0, members: []>>

doc.to_h
#=> { :items => [{ :type => ["h-card"], :properties => { :name => ["Jason Garber"] } }], :rels => {}, :"rel-urls" => {} }

See USAGE.md for detailed examples of MicroMicro's features. Additional structured documentation is available on RubyDoc.info.

Acknowledgments

MicroMicro wouldn't exist without the hard work of everyone involved in the microformats community. Additionally, the comprehensive microformats test suite was invaluable in the development of this Ruby gem.

MicroMicro is written and maintained by Jason Garber.

License

MicroMicro is freely available under the MIT License. Use it, learn from it, fork it, improve it, change it, tailor it to your needs.