anchors 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 36fa178801cdc4671d4dde91e56c3e5752f8c3db
4
- data.tar.gz: e97a470e67454d9e698ef3ed38f5dd4c344c961a
3
+ metadata.gz: 49d66a136f6d898f5091eaf0c03a792cb20839e8
4
+ data.tar.gz: 872634dddccb96495cd7613d077d8caf88046d33
5
5
  SHA512:
6
- metadata.gz: 657c6b529a983ebeec174b7268ef3391c393c86fab6cbb2b3949a952e692041df22f1e2013b6ec053c666f9ef0ab0cacafafe44c61326ca4e3767a33bca9ab1f
7
- data.tar.gz: 1dd0d3a3fd7d2cc75447e4458e71c8c1733818d7e574ce7fbdc4467ba3e057c003fd68a3604aead4d51d1cd45b7b6cd95ab2235bc309c2b3c5a828533a88b858
6
+ metadata.gz: ab0b55b34707741d344b98480b70ee77e6a700dd73d63ff484bac6fe06d22cd3a86d0c02e5022c225560516e85f8881c2236986539a7a689c1e152b1b25fa23b
7
+ data.tar.gz: 6bc51cacae25847e5ea3903f4b8d2dcd368e28f46c0bbb07fab66d68a30559be4f4de29bfb0b30ff1bd56e0155965a77958652f642702ac3a6205a5623e185d0
@@ -2,3 +2,4 @@ language: ruby
2
2
  rvm:
3
3
  - 2.3.0
4
4
  before_install: gem install bundler -v 1.11.2
5
+ script: bundle exec rspec spec
data/README.md CHANGED
@@ -1,6 +1,26 @@
1
1
  # ⚓ Anchors ⚓
2
2
 
3
- This gem will add anchors to all of your websites h1-h6 headers. Its useful for static website generators, like Middleman.
3
+ [![Build Status](https://travis-ci.org/bradgessler/anchors.svg?branch=master)](https://travis-ci.org/bradgessler/anchors)
4
+
5
+ This gem will add anchors to all of your websites h1-h6 headers. Its useful for static website generators, like Middleman. It turns this:
6
+
7
+ ```html
8
+ <body>
9
+ <h1>How are you?</h1>
10
+ <h2>I am fine<img src='hi.gif'/></h2>
11
+ <h3>How are you?</h3>
12
+ </body>
13
+ ```
14
+
15
+ into this:
16
+
17
+ ```html
18
+ <body>
19
+ <h1 id="how_are_you"><a href="#how_are_you">How are you?</a></h1>
20
+ <h2 id="i_am_fine"><a href="#i_am_fine">I am fine<img src="hi.gif"></a></h2>
21
+ <h3 id="how_are_you_2"><a href="#how_are_you_2">How are you?</a></h3>
22
+ </body>
23
+ ```
4
24
 
5
25
  ## Installation
6
26
 
@@ -29,14 +49,14 @@ use Anchors::Middleware
29
49
 
30
50
  and the `body` will automatically have anchors applied to all of the h1-h6 tags.
31
51
 
32
- If you don't want to apply anchors to all of your requests, just pass a CSS selector into the middleware:
52
+ You can even customize it a bit:
33
53
 
34
54
  ```ruby
35
55
  require "anchors"
36
56
  use Anchors::Middleware,
37
57
  css: "section.anchorize", # CSS headers are applied to. Defaults to 'body'
38
- seperator: "-", # Change the seperator in the header. Defaults to _
39
- link: false # Don't convert the headers into links to their own anchors. Defaults to true.
58
+ seperator: "-", # Change the seperator in the header. Defaults to '_'
59
+ link: false # Don't convert the headers into links to their own anchors. Defaults to 'true'.
40
60
  ```
41
61
 
42
62
  ## Development
@@ -28,15 +28,15 @@ module Anchors
28
28
  private
29
29
  # Super lame, but awesome way to get CSS options CSS selector.
30
30
  def css
31
- options[:css] || CSS_SELECTOR
31
+ options.fetch :css, CSS_SELECTOR
32
32
  end
33
33
 
34
34
  def seperator
35
- options[:seperator] || SEPERATOR
35
+ options.fetch :seperator, SEPERATOR
36
36
  end
37
37
 
38
38
  def link?
39
- options[:link] || LINK
39
+ options.fetch :link, LINK
40
40
  end
41
41
 
42
42
  def dom_id(el)
@@ -1,3 +1,3 @@
1
1
  module Anchors
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anchors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brad Gessler