Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/anthonybishopric/schema.org

Apply schema.org microdata to your erb files
https://github.com/anthonybishopric/schema.org

Last synced: 3 months ago
JSON representation

Apply schema.org microdata to your erb files

Awesome Lists containing this project

README

        

:::INSTALLATION:::

--
cd vendor/plugins
git clone git://github.com/anthonybishopric/schema.org.git schemaorg
--

::USAGE::

# Let's say you have a Bird model

class Bird < ActiveRecord::Base

validates_presence_of :name, :birth

microdata_item :thing # the name of the schema
microdata_attributes :birth => :birthDate # explicit mapping of attribute if necessary

def birth # works with both ActiveModel::Attributes and regular methods
DateTime.now
end

end

# here's an instance of it we make available in a controller
# @bird{
# name: 'Foo',
# birth: '2011-06-05'
# }

---------------------

<%= micro @bird do |metabird|%>

Name:
<%= metabird.name %>

Born:


<%= metabird.birth.strftime("%B %d, %Y")%>

<%end%>




Name:
Foo<b>foo</b>

Born:




::TODO::

* Regression tests
* Convert to Gem
* Better association handling
* Schema validation