kramdown-service 0.3.0 → 1.0.0

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: 41dd07d48ed67c255c39b46e71c8493186055b4b
4
- data.tar.gz: e65a3defc5c2df215b1c07bff78eb9171bbafe09
3
+ metadata.gz: 9e0132054c804d4302684707104a417da80cccf5
4
+ data.tar.gz: b0d33ac970fe13591dbe65ae753751a13423b8fe
5
5
  SHA512:
6
- metadata.gz: c5888bbad01662d9f78c436a2fa16910954871b3dcf0dbf730e337df0a8e3bc5f10154f327098c0b9500f804841c450b18725d237c2bf81ca8a210ae3fdbba8d
7
- data.tar.gz: 4f34a2085f07012be2e28fa916cd9d943fd8fc6d362f7fcf015d91ccce4e097ca7d4b12c8303b7b4d9db832d204e25ae412609ca4cd0fd1b19ee401f2d3d7360
6
+ metadata.gz: 2548f9ebdf54a9bcfbfdef0b93faf1ac8cea0efaf258d91386ef0f4a3ae0b65b5c0f8332db4abc7a9829f61bea3c307468f5aa2189cd78ee3d2469f6b7dafb16
7
+ data.tar.gz: '0559a085bba42d688c2a06dfa65f9b2be42fdc46c5fbea5f17f52427cae76b5f4d2b2b51b2c200e64ec006bd27e5f6467a8d00e9fc2301ea3a876ef76e3824c5'
data/README.md CHANGED
@@ -12,7 +12,9 @@ Try the `markdown` HTTP (JSON) API running
12
12
  on Heroku [`trykramdown.herokuapp.com`](http://trykramdown.herokuapp.com).
13
13
 
14
14
  Note: If you see an Application Error on Heroku. Sorry. It means "**Free app running time quota exhausted**".
15
- Please, check back in a day (or use `$ kramup` to run the service on your local machine). Thanks.
15
+ Please, check back and retry the first day of the next upcoming month (that starts a new dyna hours quota) or use `$ kramup` to run the service on your local machine). Thanks.
16
+
17
+
16
18
 
17
19
 
18
20
  ## Start Your Own Local Version / Service
@@ -26,10 +28,10 @@ Step 0 - Install the gem e.g.
26
28
  Step 1 - Start the server / service e.g.
27
29
 
28
30
  $ kramup
29
-
31
+
30
32
  Step 2 - Open up the editor page in your browser e.g. use `http://localhost:4567`.
31
33
 
32
- That's it.
34
+ That's it.
33
35
 
34
36
 
35
37
  ## Usage - Web Service / HTTP (JSON) API - `GET /markdown`
@@ -38,14 +40,14 @@ That's it.
38
40
  Example 1 - Converting to Hypertext (HTML):
39
41
 
40
42
  GET /markdown?text=Hello+World!
41
-
43
+
42
44
  <p>Hello World!</p>
43
45
 
44
46
 
45
47
  Example 2 - Converting to LaTeX:
46
48
 
47
49
  GET /markdown?text=Hello+World!&to=latex
48
-
50
+
49
51
  Hello World!
50
52
 
51
53
 
@@ -62,4 +64,3 @@ Use it as you please with no restrictions whatsoever.
62
64
  Send them along to the
63
65
  [wwwmake forum/mailing list](http://groups.google.com/group/wwwmake).
64
66
  Thanks!
65
-
data/Rakefile CHANGED
@@ -12,13 +12,13 @@ Hoe.spec 'kramdown-service' do
12
12
 
13
13
  self.author = 'Gerald Bauer'
14
14
  self.email = 'wwwmake@googlegroups.com'
15
-
15
+
16
16
  self.extra_deps = [
17
- ['kramdown'], ## markdown converter
17
+ ['kramdown', '>=1.17.0'], ## markdown converter
18
18
  ['rouge'], ## syntax highlighter
19
- ['sinatra'],
19
+ ['sinatra', '>=2.0.4'],
20
20
  ]
21
-
21
+
22
22
  # switch extension to .markdown for gihub formatting
23
23
  self.readme_file = 'README.md'
24
24
  self.history_file = 'HISTORY.md'
@@ -26,7 +26,7 @@ Hoe.spec 'kramdown-service' do
26
26
  self.licenses = ['Public Domain']
27
27
 
28
28
  self.spec_extras = {
29
- required_ruby_version: '>= 1.9.2'
29
+ required_ruby_version: '>= 2.2.2'
30
30
  }
31
31
 
32
32
  end
@@ -25,7 +25,7 @@ require 'kramdown/service/version' # let version always go first
25
25
 
26
26
 
27
27
  module Kramdown
28
-
28
+
29
29
  class Service < Sinatra::Base
30
30
 
31
31
  PUBLIC_FOLDER = "#{KramdownService.root}/lib/kramdown/service/public"
@@ -34,7 +34,7 @@ class Service < Sinatra::Base
34
34
  puts "[boot] kramdown-service - setting public folder to: #{PUBLIC_FOLDER}"
35
35
  puts "[boot] kramdown-service - setting views folder to: #{VIEWS_FOLDER}"
36
36
 
37
- set :public_folder, PUBLIC_FOLDER # set up the static dir (with images/js/css inside)
37
+ set :public_folder, PUBLIC_FOLDER # set up the static dir (with images/js/css inside)
38
38
  set :views, VIEWS_FOLDER # set up the views dir
39
39
 
40
40
  set :static, true # set up static file routing
@@ -44,12 +44,12 @@ class Service < Sinatra::Base
44
44
  # Controllers / Routing / Request Handlers
45
45
 
46
46
 
47
- get %r{/(service|services|srv|s)$} do
47
+ get %r{/(service|services|srv|s)} do
48
48
  ## just a "live" docu page
49
49
  erb :service
50
50
  end
51
51
 
52
- get %r{/(editor|edit|ed|e)$} do
52
+ get %r{/(editor|edit|ed|e)} do
53
53
  # note: allow optional params e.g. text and opts
54
54
  ## note: for now only html supported on get form/url params
55
55
  text = params.delete('text') || welcome_markdown
@@ -76,12 +76,12 @@ class Service < Sinatra::Base
76
76
  end
77
77
 
78
78
  # return hypertext (html) ## allow /markdown or /m
79
- get %r{/(markdown|m)$} do
79
+ get %r{/(markdown|m)} do
80
80
 
81
81
  text = params.delete('text') || '' ## if no text param supplied, use empty/blank string
82
82
  to = params.delete('to') || 'html' ## optional - default to html
83
83
  opts = params_to_opts( params )
84
-
84
+
85
85
  if ['latex','l','tex'].include?( to.downcase )
86
86
  content_type 'text/latex' ### todo: check if latex content_type exists?
87
87
  text_to_latex( text, opts )
@@ -89,7 +89,7 @@ class Service < Sinatra::Base
89
89
  content_type 'text/html'
90
90
  text_to_html( text, opts )
91
91
  end
92
-
92
+
93
93
  end
94
94
 
95
95
 
@@ -99,20 +99,20 @@ class Service < Sinatra::Base
99
99
  # note: only supports html for now (e.g. does NOT support to=html|latex option etc.)
100
100
  get '/babelmark' do
101
101
  text = params.delete('text') || '' ## if no text param supplied, use empty/blank string
102
-
102
+
103
103
  data = {
104
104
  name: 'kramdown',
105
105
  html: Kramdown::Document.new( text, input: 'GFM' ).to_html,
106
106
  version: Kramdown::VERSION
107
107
  }
108
-
108
+
109
109
  json_or_jsonp( data.to_json )
110
110
  end
111
111
 
112
112
 
113
- get %r{/(options|opts|o)$} do ## for debugging/testing "dump" options
113
+ get %r{/(options|opts|o)} do ## for debugging/testing "dump" options
114
114
  content_type 'text/plain'
115
-
115
+
116
116
  opts = preprocess_opts( params_to_opts( params ))
117
117
  doc = Kramdown::Document.new( '', opts )
118
118
  doc.options.inspect
@@ -135,29 +135,29 @@ private
135
135
 
136
136
  def params_to_opts( params )
137
137
  ## convert (web form) params to kramdown (ruby) opts
138
-
138
+
139
139
  puts "params : #{params.class.name}:"
140
140
  pp params
141
-
141
+
142
142
  opts = {}
143
-
143
+
144
144
  ## map true/false strings to boolean
145
145
  params.each do |k,v|
146
146
  puts " k: >#{k}< : #{k.class.name}, v: >#{v}< : #{v.class.name}"
147
-
147
+
148
148
  ## skip "built-in" sinatra "internal" params
149
149
  ## - todo - use splice and whitelist instead - why? why not?
150
150
  next if ['splat', 'captures'].include?( k )
151
-
152
- if v.is_a?( String ) && ['t', 'true'].include?( v.downcase )
151
+
152
+ if v.is_a?( String ) && ['t', 'true'].include?( v.downcase )
153
153
  opts[ k ] = true
154
154
  elsif v.is_a?( String ) && ['f', 'false'].include?( v.downcase )
155
155
  opts[ k ] = false
156
156
  else
157
157
  opts[ k ] = v
158
158
  end
159
- end
160
-
159
+ end
160
+
161
161
  opts
162
162
  end
163
163
 
@@ -165,7 +165,7 @@ private
165
165
  def preprocess_opts( opts )
166
166
  ### special case for input opt
167
167
  ## always default to gfm (github-flavored markdown) for now
168
-
168
+
169
169
  input = opts.delete( 'input' ) || 'GFM'
170
170
 
171
171
  if ['classic', 'std', 'standard', 'kramdown' ].include?( input.downcase )
@@ -177,7 +177,7 @@ private
177
177
  opts['hard_wrap'] = false if opts['hard_wrap'].nil?
178
178
  else
179
179
  opts[ 'input' ] = input
180
- end
180
+ end
181
181
 
182
182
  puts "opts (preprocessed/effective):"
183
183
  pp opts
@@ -219,7 +219,7 @@ def json_or_jsonp( json )
219
219
  content_type :json
220
220
  response = json
221
221
  end
222
-
222
+
223
223
  response
224
224
  end
225
225
 
@@ -230,4 +230,3 @@ end # module Kramdown
230
230
 
231
231
  # say hello
232
232
  puts KramdownService.banner
233
-
@@ -2,11 +2,12 @@
2
2
 
3
3
  module KramdownService
4
4
 
5
- MAJOR = 0
6
- MINOR = 3
5
+ MAJOR = 1
6
+ MINOR = 0
7
7
  PATCH = 0
8
8
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
9
 
10
+
10
11
  def self.version
11
12
  VERSION
12
13
  end
@@ -22,4 +23,3 @@ module KramdownService
22
23
  end
23
24
 
24
25
  end # module KramdownService
25
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kramdown-service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-19 00:00:00.000000000 Z
11
+ date: 2018-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kramdown
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 1.17.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 1.17.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rouge
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: 2.0.4
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: 2.0.4
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rdoc
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '3.14'
75
+ version: '3.16'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '3.14'
82
+ version: '3.16'
83
83
  description: kramdown-service gem - kramdown HTTP JSON API service (convert markdown
84
84
  to HTML or LaTeX)
85
85
  email: wwwmake@googlegroups.com
@@ -136,7 +136,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - ">="
138
138
  - !ruby/object:Gem::Version
139
- version: 1.9.2
139
+ version: 2.2.2
140
140
  required_rubygems_version: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - ">="
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  version: '0'
145
145
  requirements: []
146
146
  rubyforge_project:
147
- rubygems_version: 2.2.3
147
+ rubygems_version: 2.5.2
148
148
  signing_key:
149
149
  specification_version: 4
150
150
  summary: kramdown-service gem - kramdown HTTP JSON API service (convert markdown to