formdown 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1549297498d9dce25034c8514c18eb75b7cd378a
4
+ data.tar.gz: b312a44329b33023ce71768e3a26cdaa6ce1e6a2
5
+ SHA512:
6
+ metadata.gz: 76585ef8f072bbc83129be9b46d8ba43d98a440779ef82ecb196fda46148c646dace2010dcc522bc5b33cf84d0c83331f6e81346b5f974fc511a9706037dc7af
7
+ data.tar.gz: df513b223b78e76083003b933e4209dc23b4cfe2cb8e0b5d14cadbb10434cc4d8ed85641ffce69f9950331ea40d3ea8b64ec62a685ce3cb73480e0b15e2f4fcb
data/README.md CHANGED
@@ -39,31 +39,57 @@ Generates the following HTML:
39
39
 
40
40
  A more extensive reference of Formdown in action may be found in the [kitchen sink](./spec/fixtures/kitchen_sink.fmd) fmd file. As this gem matures more extensive syntax documentation will be created for version 1.0.
41
41
 
42
- ## Installation
42
+ ## Installation & Usage
43
43
 
44
- Add this line to your application's Gemfile:
44
+ Formdown works in most popular Ruby web frameworks, the command lin, and of course plain 'ol Ruby.
45
+
46
+ ### Rails
47
+
48
+ In the rails Gemfile, include the formdown gem via:
45
49
 
46
50
  ```ruby
47
- gem 'formdown'
51
+ gem "formdown", require: "formdown/rails"
48
52
  ```
49
53
 
50
- or for Rails:
54
+ Rails will pick up files with the extension `.fmd` and render them as HTML. For example, `app/views/user/my_form.html.fmd` would render the formdown document.
55
+
56
+ Its recommended to use a layout around the Formdown file to handle the form submission action and surrounding HTML content.
57
+
58
+ **Note**: There's currently no simple way of mapping Formdown fields to ActiveRecord model attributes.
59
+
60
+ ### Sinatra
61
+
62
+ In the Gemfile, include the formdown gem via:
51
63
 
52
64
  ```ruby
53
- gem 'formdown', require: 'formdown/rails'
65
+ gem "formdown", require: "sinatra/formdown"
54
66
  ```
55
67
 
56
- And then execute:
68
+ Place your Formdown file in the [Sinatra](http://www.sinatrarb.com/) `./views` directory (e.g. `views/my_form.html.fmd`), then add the following route to your Sinatra app:
57
69
 
58
- $ bundle
70
+ ```ruby
71
+ get '/my_form' do
72
+ formdown :my_form
73
+ end
74
+ ```
59
75
 
60
- Or install it yourself as:
76
+ and the form will render at `/my_form`.
61
77
 
62
- $ gem install formdown
78
+ ### Middleman
79
+
80
+ In the Gemfile, include the formdown gem via:
81
+
82
+ ```ruby
83
+ gem "formdown", require: "middleman/formdown"
84
+ ```
85
+
86
+ Place your Formdown file in the [Middleman](http://middlemanapp.com/) `./source` directory and the form will render (e.g. `source/my_form.html.fmd` will render the form at `/my_form.html`)
63
87
 
64
- ## Usage
88
+ ### Command line
65
89
 
66
- ### CLI
90
+ Install the gem:
91
+
92
+ $ gem install formdown
67
93
 
68
94
  The quickest way to render Formdown is via the command line. Just cat your file into the render and you'll get HTML:
69
95
 
@@ -75,36 +101,24 @@ Now open `my_form.html` and enjoy all of that HTML goodness.
75
101
 
76
102
  ### Ruby
77
103
 
78
- ```ruby
79
- text = "What is your email address? _________@(Email)"
80
- formdown = Formdown::Renderer.new(text)
81
- formdown.to_html # => "<p>What is your email address? <input type=\"email\" placeholder=\"Email\" name=\"Email\" size=\"9\"></input>\n</p>\n"
82
- ```
83
-
84
- ### Rails
85
-
86
- In the rails Gemfile, include the formdown gem via:
104
+ Add this line to your application's Gemfile:
87
105
 
88
106
  ```ruby
89
- gem "formdown", require: "formdown/rails"
107
+ gem 'formdown'
90
108
  ```
91
109
 
92
- Rails will pick up files with the extension `.fmd` and render them as HTML. For example, `app/views/user/my_form.html.fmd` would render the formdown document.
93
-
94
- Its recommended to use a layout around the Formdown file to handle the form submission action and surrounding HTML content.
95
-
96
- **Note**: There's currently no simple way of mapping Formdown fields to ActiveRecord model attributes.
110
+ And then execute:
97
111
 
98
- ### Middleman
112
+ $ bundle
99
113
 
100
- In the Gemfile, include the formdown gem via:
114
+ Write the following code in your Ruby application to compile the Formdown:
101
115
 
102
116
  ```ruby
103
- gem "formdown", require: "formdown/tilt"
117
+ text = "What is your email address? _________@(Email)"
118
+ formdown = Formdown::Renderer.new(text)
119
+ formdown.to_html # => "<p>What is your email address? <input type=\"email\" placeholder=\"Email\" name=\"Email\" size=\"9\"></input>\n</p>\n"
104
120
  ```
105
121
 
106
- Place your Formdown file in the [Middleman](http://middlemanapp.com/) source directory and the form will render (e.g. `source/my_form.html.fmd` will render the form at `/my_form.html`)
107
-
108
122
  ## Contributing
109
123
 
110
124
  1. Fork it ( https://github.com/bradgessler/formdown/fork )
@@ -10,4 +10,9 @@ class Formdown::CLI < Thor
10
10
  puts Formdown::Renderer.new($stdin.read).to_html
11
11
  end
12
12
  end
13
+
14
+ desc "version", "Print the version of formdown"
15
+ def version
16
+ puts Formdown::VERSION
17
+ end
13
18
  end
@@ -1,3 +1,3 @@
1
1
  module Formdown
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -0,0 +1,3 @@
1
+ # We only need to initialize Tilt::FormdownTemplate
2
+ # to work with Middleman.
3
+ require 'tilt/formdown'
@@ -0,0 +1,18 @@
1
+ require 'sinatra/base'
2
+ require 'tilt/formdown'
3
+
4
+ module Sinatra
5
+ module Formdown
6
+ module Helpers
7
+ def formdown(template, options = {}, locals = {}, &block)
8
+ render(:formdown, template, options, locals, &block)
9
+ end
10
+ end
11
+
12
+ def self.registered(app)
13
+ app.helpers Formdown::Helpers
14
+ end
15
+ end
16
+
17
+ register Formdown
18
+ end
@@ -28,4 +28,8 @@ module Tilt
28
28
  false
29
29
  end
30
30
  end
31
- end
31
+ end
32
+
33
+ # TODO - Support lazy registration when Middleman supports Tilt 2.x.
34
+ # Tilt.register_lazy :FormdownTemplate, 'tilt/formdown', 'formdown', 'fmd'
35
+ Tilt.register Tilt::FormdownTemplate, *Formdown::FILE_EXTENSIONS
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
- prerelease:
4
+ version: 0.0.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Brad Gessler
@@ -14,81 +13,71 @@ dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: kramdown
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.4'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '1.4'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: thor
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: bundler
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ~>
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
47
  version: '1.6'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ~>
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
54
  version: '1.6'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rake
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ~>
59
+ - - "~>"
68
60
  - !ruby/object:Gem::Version
69
61
  version: '10.0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ~>
66
+ - - "~>"
76
67
  - !ruby/object:Gem::Version
77
68
  version: '10.0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rspec
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ~>
73
+ - - "~>"
84
74
  - !ruby/object:Gem::Version
85
75
  version: '3.0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ~>
80
+ - - "~>"
92
81
  - !ruby/object:Gem::Version
93
82
  version: '3.0'
94
83
  description:
@@ -99,9 +88,9 @@ executables:
99
88
  extensions: []
100
89
  extra_rdoc_files: []
101
90
  files:
102
- - .gitignore
103
- - .rspec
104
- - .travis.yml
91
+ - ".gitignore"
92
+ - ".rspec"
93
+ - ".travis.yml"
105
94
  - Gemfile
106
95
  - LICENSE.txt
107
96
  - README.md
@@ -112,9 +101,10 @@ files:
112
101
  - lib/formdown/cli.rb
113
102
  - lib/formdown/rails.rb
114
103
  - lib/formdown/renderer.rb
115
- - lib/formdown/tilt.rb
116
104
  - lib/formdown/version.rb
117
105
  - lib/kramdown/parser/formdown.rb
106
+ - lib/middleman/formdown.rb
107
+ - lib/sinatra/formdown.rb
118
108
  - lib/tilt/formdown.rb
119
109
  - spec/fixtures/kitchen_sink.fmd
120
110
  - spec/formdown_spec.rb
@@ -122,30 +112,28 @@ files:
122
112
  homepage: ''
123
113
  licenses:
124
114
  - MIT
115
+ metadata: {}
125
116
  post_install_message:
126
117
  rdoc_options: []
127
118
  require_paths:
128
119
  - lib
129
120
  required_ruby_version: !ruby/object:Gem::Requirement
130
- none: false
131
121
  requirements:
132
- - - ! '>='
122
+ - - ">="
133
123
  - !ruby/object:Gem::Version
134
124
  version: '0'
135
125
  required_rubygems_version: !ruby/object:Gem::Requirement
136
- none: false
137
126
  requirements:
138
- - - ! '>='
127
+ - - ">="
139
128
  - !ruby/object:Gem::Version
140
129
  version: '0'
141
130
  requirements: []
142
131
  rubyforge_project:
143
- rubygems_version: 1.8.23
132
+ rubygems_version: 2.2.2
144
133
  signing_key:
145
- specification_version: 3
134
+ specification_version: 4
146
135
  summary: A Markdown-like syntax for web forms.
147
136
  test_files:
148
137
  - spec/fixtures/kitchen_sink.fmd
149
138
  - spec/formdown_spec.rb
150
139
  - spec/spec_helper.rb
151
- has_rdoc:
@@ -1,6 +0,0 @@
1
- require 'tilt'
2
- require 'tilt/formdown'
3
-
4
- # TODO - Support lazy registration when Middleman supports Tilt 2.x.
5
- # Tilt.register_lazy :FormdownTemplate, 'tilt/formdown', 'formdown', 'fmd'
6
- Tilt.register Tilt::FormdownTemplate, *Formdown::FILE_EXTENSIONS