shortcodes 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -8,20 +8,32 @@ A simple ruby gem that will parse your cms content for wordpress style shortcode
8
8
 
9
9
  Add this line to your application's Gemfile:
10
10
 
11
- gem 'shortcodes'
11
+ ```ruby
12
+ gem 'shortcodes'
13
+ ```
12
14
 
13
- And then execute:
15
+ Then require the shortcodes you intend on using.
14
16
 
15
- $ bundle
17
+ To automatically load all built-in shortcodes use:
16
18
 
17
- Or install it yourself as:
19
+ ```ruby
20
+ # Gemfile
21
+ gem 'shortcodes', require: 'shortcodes/all'
22
+ ```
18
23
 
19
- $ gem install shortcodes
24
+ To only load specified shortcodes do not use `require: 'shortcodes/all'`, and
25
+ instead require only the shortcodes you intend to use. In rails, you can do this
26
+ in an initialize like so:
27
+
28
+ ```ruby
29
+ # config/initializers/shortcodes.rb
30
+ require 'shortcodes/youtube'
31
+ ```
20
32
 
21
33
  ## Usage
22
34
 
23
35
  ```ruby
24
- Shortcodes.shortcode(content)
36
+ Shortcodes.shortcode(content)
25
37
  ```
26
38
 
27
39
  ## Built-in Shortcodes
@@ -49,6 +61,32 @@ Example:
49
61
  [wufoo username="awesome_user" formhash="a04909c" autoresize="true" height="961" header="show" ssl="true"]
50
62
  ```
51
63
 
64
+ ### Custom shortcodes
65
+
66
+ Either create an object that responds to `call`, or subclass `Shortcodes::Handler` and implement
67
+ `render`. Register the shortcode using `Shortcodes.register\_shortcode`. Example:
68
+
69
+ ```ruby
70
+ require 'shortcodes/handler'
71
+
72
+ class MyShortcode < Shortcodes::Handler
73
+ def render
74
+ "Attributes can be accessed with <tt>#attributes</tt>: <pre>#{attributes.inspect}</pre>"
75
+ end
76
+ end
77
+
78
+ Shortcodes.register_shortcode('my-shortcode', MyShortcode)
79
+ ```
80
+
81
+ Also see
82
+ [lib/shortcodes/youtube.rb](https://github.com/carnesmedia/shortcodes/blob/master/lib/shortcodes/youtube.rb)
83
+ for a good real-world example.
84
+
85
+ #### Please PR new shortcodes!
86
+
87
+ If you write a custom that might be useful to other people, please submit
88
+ a pull-request!
89
+
52
90
  ## Contributing
53
91
 
54
92
  1. Fork it
@@ -1,3 +1,3 @@
1
1
  module Shortcodes
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -28,7 +28,7 @@ module Shortcodes
28
28
  end
29
29
 
30
30
  def render
31
- %Q{<iframe width="#{width}" height="#{height}" src="http://www.youtube.com/embed/#{youtube_id}#{time}" frameborder="0" allowfullscreen></iframe>}
31
+ %Q{<iframe width="#{width}" height="#{height}" src="//www.youtube.com/embed/#{youtube_id}#{time}" frameborder="0" allowfullscreen></iframe>}
32
32
  end
33
33
 
34
34
  Shortcodes.register_shortcode('youtube', self)
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shortcodes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Amiel Martin
@@ -9,53 +10,60 @@ authors:
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2013-08-06 00:00:00.000000000 Z
13
+ date: 2014-04-23 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: nokogiri
16
17
  requirement: !ruby/object:Gem::Requirement
18
+ none: false
17
19
  requirements:
18
- - - '>='
20
+ - - ! '>='
19
21
  - !ruby/object:Gem::Version
20
22
  version: '0'
21
23
  type: :runtime
22
24
  prerelease: false
23
25
  version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
24
27
  requirements:
25
- - - '>='
28
+ - - ! '>='
26
29
  - !ruby/object:Gem::Version
27
30
  version: '0'
28
31
  - !ruby/object:Gem::Dependency
29
32
  name: sanitize
30
33
  requirement: !ruby/object:Gem::Requirement
34
+ none: false
31
35
  requirements:
32
- - - '>='
36
+ - - ! '>='
33
37
  - !ruby/object:Gem::Version
34
38
  version: '0'
35
39
  type: :runtime
36
40
  prerelease: false
37
41
  version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
38
43
  requirements:
39
- - - '>='
44
+ - - ! '>='
40
45
  - !ruby/object:Gem::Version
41
46
  version: '0'
42
47
  - !ruby/object:Gem::Dependency
43
48
  name: activesupport
44
49
  requirement: !ruby/object:Gem::Requirement
50
+ none: false
45
51
  requirements:
46
- - - '>='
52
+ - - ! '>='
47
53
  - !ruby/object:Gem::Version
48
54
  version: '0'
49
55
  type: :runtime
50
56
  prerelease: false
51
57
  version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
52
59
  requirements:
53
- - - '>='
60
+ - - ! '>='
54
61
  - !ruby/object:Gem::Version
55
62
  version: '0'
56
63
  - !ruby/object:Gem::Dependency
57
64
  name: bundler
58
65
  requirement: !ruby/object:Gem::Requirement
66
+ none: false
59
67
  requirements:
60
68
  - - ~>
61
69
  - !ruby/object:Gem::Version
@@ -63,6 +71,7 @@ dependencies:
63
71
  type: :development
64
72
  prerelease: false
65
73
  version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
66
75
  requirements:
67
76
  - - ~>
68
77
  - !ruby/object:Gem::Version
@@ -70,15 +79,17 @@ dependencies:
70
79
  - !ruby/object:Gem::Dependency
71
80
  name: rake
72
81
  requirement: !ruby/object:Gem::Requirement
82
+ none: false
73
83
  requirements:
74
- - - '>='
84
+ - - ! '>='
75
85
  - !ruby/object:Gem::Version
76
86
  version: '0'
77
87
  type: :development
78
88
  prerelease: false
79
89
  version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
80
91
  requirements:
81
- - - '>='
92
+ - - ! '>='
82
93
  - !ruby/object:Gem::Version
83
94
  version: '0'
84
95
  description: Wordpress style shortcodes for your Ruby CMS
@@ -102,26 +113,28 @@ files:
102
113
  homepage: https://github.com/carnesmedia/shortcodes
103
114
  licenses:
104
115
  - MIT
105
- metadata: {}
106
116
  post_install_message:
107
117
  rdoc_options: []
108
118
  require_paths:
109
119
  - lib
110
120
  required_ruby_version: !ruby/object:Gem::Requirement
121
+ none: false
111
122
  requirements:
112
- - - '>='
123
+ - - ! '>='
113
124
  - !ruby/object:Gem::Version
114
125
  version: '0'
115
126
  required_rubygems_version: !ruby/object:Gem::Requirement
127
+ none: false
116
128
  requirements:
117
- - - '>='
129
+ - - ! '>='
118
130
  - !ruby/object:Gem::Version
119
131
  version: '0'
120
132
  requirements: []
121
133
  rubyforge_project:
122
- rubygems_version: 2.0.3
134
+ rubygems_version: 1.8.24
123
135
  signing_key:
124
- specification_version: 4
136
+ specification_version: 3
125
137
  summary: Shortcodes is a simple ruby gem that will parse your cms content for wordpress
126
138
  style shortcodes.
127
139
  test_files: []
140
+ has_rdoc:
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: d8f82b3f07bc8293d42800d6f2f476810aa10d44
4
- data.tar.gz: 49688b4b0501a90fca1f0c270d19eafd092e1b25
5
- SHA512:
6
- metadata.gz: 7b4de3826b7eaa68bff95453a3c243faff5e74d138243e75e70f81a38a6caeb6dd601dfb1673e0202e84b8dac8fb38f3e87494832dcfda6f558a05bf0efbe5d2
7
- data.tar.gz: 8beac9f1b0e6bc2f6225eeb581a721ccda606403c11a00d117de9a9501becbcf3c3196f2946ae9419fbfc670def62ee2600697a242f6dd24c5282e363888eab8