Repository is archived
No commit activity in last 3 years
No release in over 3 years
Integrate geo_pattern-gem into middleman
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 10.0

Runtime

~> 1.4.0
 Project Readme

middleman-geo_pattern

Gem Version Build Status Coverage Status Inline docs

This gem integrates the geo_pattern-gem into middleman.

Installation

Add this line to your application's Gemfile:

gem 'middleman-geo_pattern'

And then execute:

$ bundle

Or install it yourself as:

$ gem install middleman-geo_pattern

Usage

Activate extension

Activate the extension in your config.rb:

activate :geo_pattern

Use helper in view

erb

<%= geo_pattern 'Mastering Markdown' %>

haml

= geo_pattern 'Mastering Markdown'

Define patterns

To configure the patterns which should be used by default, use the .patterns-option - see the README for a list of available patterns.

activate :geo_pattern do |g|
  g.patterns = [:xes]
end

To define them only per invocation, use the patterns-option.

geo_pattern 'Mastering Markdown', patterns: [:xes]

Define color

To configure a default color, use the .color-option.

activate :geo_pattern do |g|
  g.color = '#123455'
end

To set it once only, use the color-option.

geo_pattern 'Mastering Markdown', color: '#123456'

Define base color

To configure a default base color, use the .base_color-option.

activate :geo_pattern do |g|
  g.base_color = '#123455'
end

To set it once only, use the base_color-option.

geo_pattern 'Mastering Markdown', base_color: '#123456'

Define css class

To configure a css class color, use the .css_class-option.

activate :geo_pattern do |g|
  g.css_class = 'gp-content'
end

To set it once only, use the css_class-option.

geo_pattern 'Mastering Markdown', css_class: 'gp-content'

Use different html tag

By default the helper will generate a <div></div>-tag. If you would like to change it, please use the .html_tag-option.

activate :geo_pattern do |g|
  g.html_tag = 'span'
end

To set it once only, use the html_tag-option.

geo_pattern 'Mastering Markdown', html_tag: 'span'

Create non-content html tags

You would like to use a html tag like <img>, you need to set the is_content_tag-option to false.

Change the default:

activate :geo_pattern do |g|
  g.html_tag       = 'span'
  g.is_content_tag = false
end

Change it only once

geo_pattern 'Mastering Markdown', html_tag: 'img', is_content_tag: false

Pass other options to tag helper

Unknown options will be passed on to the tag helper.

geo_pattern 'Mastering Markdown', role: main

Pass a block to the helper

You can also pass a block to geo pattern, to embed some other code within it:

erb

Please mind the missing = in <% geo....

<% geo_pattern('Mastering Markdown') do %>
  <%= content_tag :h1, 'Mastering Markdown' %>
<% end %>

haml

= geo_pattern('Mastering Markdown') do
  = content_tag :h1, 'Mastering Markdown'

Contributing

See CONTRIBUTING.md

Copyright

(c) 2015, Max Meyer

See LICENSE.txt