{"id":18103141,"url":"https://github.com/microformats/microformats-ruby","last_synced_at":"2025-04-05T14:09:19.659Z","repository":{"id":6819695,"uuid":"8067784","full_name":"microformats/microformats-ruby","owner":"microformats","description":"Ruby gem that parse HTML containing microformats/microformats2 and returns Ruby objects, a Ruby hash or a JSON hash","archived":false,"fork":false,"pushed_at":"2023-02-27T19:59:49.000Z","size":502,"stargazers_count":98,"open_issues_count":8,"forks_count":29,"subscribers_count":15,"default_branch":"main","last_synced_at":"2024-05-30T01:48:13.647Z","etag":null,"topics":["indieweb","microformat","parsing","ruby","rubygems"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/microformats","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/microformats.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2013-02-07T06:28:21.000Z","updated_at":"2024-05-17T16:40:55.000Z","dependencies_parsed_at":"2023-07-14T18:50:34.199Z","dependency_job_id":null,"html_url":"https://github.com/microformats/microformats-ruby","commit_stats":{"total_commits":270,"total_committers":28,"mean_commits":9.642857142857142,"dds":0.7555555555555555,"last_synced_commit":"eff3c4a903ac3b8123cf3ec257e2af5eba5504d9"},"previous_names":["indieweb/microformats2"],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microformats%2Fmicroformats-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microformats%2Fmicroformats-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microformats%2Fmicroformats-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microformats%2Fmicroformats-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microformats","download_url":"https://codeload.github.com/microformats/microformats-ruby/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247345854,"owners_count":20924102,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["indieweb","microformat","parsing","ruby","rubygems"],"created_at":"2024-10-31T22:10:29.037Z","updated_at":"2025-04-05T14:09:19.622Z","avatar_url":"https://github.com/microformats.png","language":"Ruby","readme":"# ![Microformats Logo](https://raw.githubusercontent.com/microformats/microformats-ruby/main/logo.svg?sanitize=true) Microformats Ruby\n\n**A Ruby gem for parsing HTML documents containing microformats.**\n\n[![Gem](https://img.shields.io/gem/v/microformats.svg?style=for-the-badge)](https://rubygems.org/gems/microformats)\n[![Downloads](https://img.shields.io/gem/dt/microformats.svg?style=for-the-badge)](https://rubygems.org/gems/microformats)\n[![Build](https://img.shields.io/github/workflow/status/microformats/microformats-ruby/CI?logo=github\u0026style=for-the-badge)](https://github.com/microformats/microformats-ruby/actions/workflows/ci.yml)\n[![Maintainability](https://img.shields.io/codeclimate/maintainability/microformats/microformats-ruby.svg?style=for-the-badge)](https://codeclimate.com/github/microformats/microformats-ruby)\n[![Coverage](https://img.shields.io/codeclimate/c/microformats/microformats-ruby.svg?style=for-the-badge)](https://codeclimate.com/github/microformats/microformats-ruby/code)\n\n## Key Features\n\n- Compatible with both [classic microformats](http://microformats.org/wiki/Main_Page#Classic_Microformats) and [microformats2](http://microformats.org/wiki/microformats2) syntaxes.\n- Provides a [CLI](https://en.wikipedia.org/wiki/Command-line_interface) for extracting microformats from a URL, file, or string.\n\n## Getting Started\n\nBefore installing and using microformats-ruby, you'll want to have Ruby 2.4.10 (or newer) installed. It's recommended that you use a Ruby version management tool like [rbenv](https://github.com/rbenv/rbenv), [chruby](https://github.com/postmodern/chruby), or [rvm](https://github.com/rvm/rvm).\n\nmicroformats-ruby is developed using Ruby 2.7.1 and is additionally tested against versions 2.4, 2.5, 2.6, 2.7, 3.0, and 3.1 using [github Actions](https://github.com/microformats/microformats-ruby/actions).\n\n## Installation\n\nIf you're using [Bundler](https://bundler.io) to manage gem dependencies, add microformats-ruby to your project's Gemfile:\n\n```ruby\nsource 'https://rubygems.org'\n\ngem 'microformats', '~\u003e 4.0', '\u003e= 4.2.1'\n```\n\n…and then run:\n\n```sh\nbundle install\n```\n\nYou may also install microformats-ruby directly using:\n\n```sh\ngem install microformats\n```\n\n## Usage\n\nAn example working with a basic [h-card](http://microformats.org/wiki/h-card):\n\n```ruby\nsource = '\u003cdiv class=\"h-card\"\u003e\u003cp class=\"p-name\"\u003eJessica Lynn Suttles\u003c/p\u003e\u003c/div\u003e'\ncollection = Microformats.parse(source)\n\n# Get a copy of the canonical microformats hash structure\ncollection.to_hash\n\n# The above as JSON in a string\ncollection.to_json\n\n# Return a string if there is only one item found\ncollection.card.name #=\u003e \"Jessica Lynn Suttles\"\n```\n\nBelow is a more complex markup structure using an [h-entry](http://microformats.org/wiki/h-entry) with a nested h-card:\n\n```ruby\nsource = '\u003carticle class=\"h-entry\"\u003e\n  \u003ch1 class=\"p-name\"\u003eMicroformats 2\u003c/h1\u003e\n  \u003cdiv class=\"h-card p-author\"\u003e\n    \u003cp class=\"p-name\"\u003e\u003cspan class=\"p-first-name\"\u003eJessica\u003c/span\u003e Lynn Suttles\u003c/p\u003e\n  \u003c/div\u003e\n\u003c/article\u003e'\n\ncollection = Microformats.parse(source)\n\ncollection.entry.name.to_s #=\u003e \"Microformats 2\"\n\n# Accessing nested microformats\ncollection.entry.author.name.to_s #=\u003e \"Jessica Lynn Suttles\"\n\n# Accessing nested microformats can use shortcuts or expanded method\ncollection.entry.author.name #=\u003e \"Jessica Lynn Suttles\"\ncollection.entry.properties.author.properties.name.to_s #=\u003e \"Jessica Lynn Suttles\"\n\n# Use `_` instead of `-` to return property values\ncollection.entry.author.first_name #=\u003e \"Jessica\"\ncollection.rel_urls #=\u003e {}\n```\n\nUsing the same markup patterns as above, here's an h-entry with multiple authors, each marked up as h-cards:\n\n```ruby\nsource = '\u003carticle class=\"h-entry\"\u003e\n  \u003ch1 class=\"p-name\"\u003eMicroformats 2\u003c/h1\u003e\n  \u003cdiv class=\"h-card p-author\"\u003e\n    \u003cp class=\"p-name\"\u003e\u003cspan class=\"p-first-name\"\u003eJessica\u003c/span\u003e Lynn Suttles\u003c/p\u003e\n  \u003c/div\u003e\n  \u003cdiv class=\"h-card p-author\"\u003e\n    \u003cp class=\"p-name\"\u003e\u003cspan class=\"p-first-name\"\u003eBrandon\u003c/span\u003e Edens\u003c/p\u003e\n  \u003c/div\u003e\n\u003c/article\u003e'\n\ncollection = Microformats.parse(source)\n\n# Arrays of items will always return the first item by default\ncollection.entry.author.name #=\u003e \"Jessica Lynn Suttles\"\ncollection.entry.author(1).name #=\u003e \"Brandon Edens\"\n\n# Get the actual array of items by using `:all`\ncollection.entry.author(:all).count #=\u003e 2\ncollection.entry.author(:all)[1].name #=\u003e \"Brandon Edens\"\n```\n\n### Command Line Interface\n\nmicroformats-ruby also includes a command like program that will parse HTML and return a JSON representation of the included microformats.\n\n```sh\nmicroformats http://tantek.com\n```\n\nThe program accepts URLs, file paths, or strings of HTML as an argument. Additionally, the script accepts piped input from other programs:\n\n```sh\ncurl http://tantek.com | microformats\n```\n\n## Implementation Status\n\n| Status | Specification or Parsing Rule |\n|:------:|:------------------------------|\n| ✅ | [Parse a document for microformats](http://microformats.org/wiki/microformats2-parsing#parse_a_document_for_microformats) |\n| ✅ | [Parsing a `p-` property](http://microformats.org/wiki/microformats2-parsing#parsing_a_p-_property) |\n| ✅ | [Parsing a `u-` property](http://microformats.org/wiki/microformats2-parsing#parsing_a_u-_property) |\n| ✅ | [Parsing a `dt-` property](http://microformats.org/wiki/microformats2-parsing#parsing_a_dt-_property) |\n| ✅ | [Parsing an `e-` property](http://microformats.org/wiki/microformats2-parsing#parsing_an_e-_property) |\n| ✅ | [Parsing for implied properties](http://microformats.org/wiki/microformats2-parsing#parsing_for_implied_properties) |\n| ✅ | Nested properties |\n| ✅ | Nested microformat with associated property |\n| ✅ | Nested microformat without associated property |\n| ✅ | Recognize dynamically created properties |\n| ✅ | [Support for `rel` attribute values](http://microformats.org/wiki/rel) |\n| ✅ | [Normalizing `u-*` property values](http://microformats.org/wiki/microformats2-parsing-faq#normalizing_u-.2A_property_values) |\n| ✅ | Parse the [value class pattern](http://microformats.org/wiki/value-class-pattern) |\n| ✅ | Recognize [vendor extensions](http://microformats.org/wiki/microformats2#VENDOR_EXTENSIONS) |\n| ✅ | Support for [classic microformats](http://microformats.org/wiki/Main_Page#Classic_Microformats) |\n| ❌ | Recognize the [include pattern](http://microformats.org/wiki/include-pattern)\n\n## Improving microformats-ruby\n\nHave questions about using microformats-ruby? Found a bug? Have ideas for new or improved features? Want to pitch in and write some code?\n\nCheck out [CONTRIBUTING.md](https://github.com/microformats/microformats-ruby/blob/main/CONTRIBUTING.md) for more on how you can help!\n\n## Acknowledgments\n\nThe microformats-ruby logo is derived from the [microformats logo mark](http://microformats.org/wiki/spread-microformats) by [Rémi Prévost](http://microformats.org/wiki/User:Remi).\n\nmicroformats-ruby is written and maintained by:\n\n- Ben Roberts ([@dissolve](https://github.com/dissolve))\n- Jason Garber [(@jgarber623](https://github.com/jgarber623))\n- Jessica Suttles ([@jlsuttles](https://github.com/jlsuttles))\n- Shane Becker ([@veganstraightedge](https://github.com/veganstraightedge))\n- Chris Stringer ([@jcstringer](https://github.com/jcstringer))\n- Michael Mitchell ([@variousred](https://github.com/variousred))\n- Jessica Dillon ([@jessicard](https://github.com/jessicard))\n- Jeena Paradies ([@jeena](https://github.com/jeena))\n- Marty McGuire ([@martymcguire](https://github.com/martymcguire))\n- Tom Morris [(@tommorris](https://github.com/tommorris))\n- Don Peterson [(@dpetersen](https://github.com/dpetersen))\n- Matt Bohme [(@quady](https://github.com/quady))\n- Brian Miller [(@BRIMIL01](https://github.com/BRIMIL01))\n- Christian Weiske [(@cweiske](https://github.com/cweiske))\n- Christian Kruse [(@ckruse](https://github.com/ckruse))\n- Barnaby Walters [(@barnabywalters](https://github.com/barnabywalters))\n- Jeremy Keith [(@adactio](https://github.com/adactio))\n\n## License\n\nmicroformats-ruby is dedicated to the public domain using the [Creative Commons CC0 1.0 Universal license](https://creativecommons.org/publicdomain/zero/1.0/).\n\nThe authors waive all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, and distribute the work, even for commercial purposes, all without asking permission.\n\nSee [LICENSE](https://github.com/microformats/microformats-ruby/blob/main/LICENSE) for more details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicroformats%2Fmicroformats-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicroformats%2Fmicroformats-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicroformats%2Fmicroformats-ruby/lists"}