Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
Christian Kruse cd2b3ad5e4 deps.update --all 3 anos atrás
config initial commit 4 anos atrás
lib fix: typos 3 anos atrás
test fix: tests 4 anos atrás
.gitignore initial commit 4 anos atrás
LICENSE Initial commit 4 anos atrás
README.md version push 4 anos atrás
mix.exs deps.update --all 3 anos atrás
mix.lock deps.update --all 3 anos atrás

README.md

Microformats2

A Microformats2 parser for Elixir.

Installation

This parser is available in Hex:

  1. Add microformats2 to your list of dependencies in mix.exs:

    def deps do [{:microformats2, “~> 0.0.5”}] end

Usage

Give the parser an HTML string:

Microformats2.parse("""<div class="h-card">
  <img class="u-photo" alt="photo of Mitchell"
       src="https://webfwd.org/content/about-experts/300.mitchellbaker/mentor_mbaker.jpg"/>
  <a class="p-name u-url"
     href="http://blog.lizardwrangler.com/">Mitchell Baker</a>
  (<a class="u-url" href="https://twitter.com/MitchellBaker">@MitchellBaker</a>)
  <span class="p-org">Mozilla Foundation</span>
  <p class="p-note">
    Mitchell is responsible for setting the direction and scope of the Mozilla Foundation and its activities.
  </p>
  <span class="p-category">Strategy</span>
  <span class="p-category">Leadership</span>
</div>
""")

It will parse the object to a structure like that:

%{rels: [],
  rel_urls: [],
  items: [%{type: ["h-card"],
            properties: %{photo: ["https://webfwd.org/content/about-experts/300.mitchellbaker/mentor_mbaker.jpg"],
                          name: ["Mitchell Baker"],
                          url: ["http://blog.lizardwrangler.com/",
                                "https://twitter.com/MitchellBaker"],
                          org: ["Mozilla Foundation"],
                          note: ["Mitchell is responsible for setting the direction and scope of the Mozilla Foundation and its activities."],
                          category: ["Strategy",
                                     "Leadership"]}}]}

Dependencies

We need Floki for HTML parsing and HTTPotion for parsing URLs.

Features

Implemented:

Not implemented:

License

This software is licensed under the AGPL3.