No commit activity in last 3 years
No release in over 3 years
An extension for middleman to render twittr oembed status
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.6
~> 1.7
~> 1.3
~> 10.0

Runtime

>= 3.2
 Project Readme

Gem Version Build Status Coverage Status Code Climate

Middleman::TwitterOembed

An extension to render and/or convert twitter stauts id into o-Embed status. see https://dev.twitter.com/rest/reference/get/statuses/oembed for detail of twitter o-Embed.

Installation

Add this line to your application's Gemfile:

gem 'middleman-twitter-oembed'

And then execute:

$ bundle

Or install it yourself as:

$ gem install middleman-twitter-oembed

Usage

in config.rb:

activate :twitter_oembed

convert before rendering

on default, twitter url(like 'http://twitter.com/foo/status/123456789') will be converted to twitter box before rendering.

You can change the regex to match:

activate :twitter_oembed do |twitter|
  twitter.convert_regex = %r{\[\[twitter: *(\d+)\]\]}
end

If you don't want to convert, set false for enable_convert option:

activate :twitter_oembed do |twitter|
  twitter.enable_convert = false
end

helper

in *.erb:

<%= twitter_oembed('123456789') %>

or

<%= twitter_oembed_by_url('http://twitter.com/foo/status/123456789') %>

caching

in default, the result of oEmbed will be cached.

activate :twitter_oembed do |twitter|
  twitter.use_cache = true
  twitter.cache_dir = ".caches/twitter-oembed"
end

Development

After checking out the repo, run bin/setup to install dependencies. Then, run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release to create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

  1. Fork it ( https://github.com/atarukodaka/middleman-twitter-oembed/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request