togostanza 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/togostanza/application.rb +3 -3
- data/lib/togostanza/cli.rb +0 -1
- data/lib/togostanza/stanza/base.rb +0 -7
- data/lib/togostanza/version.rb +1 -1
- data/lib/togostanza.rb +0 -1
- data/spec/features/help_spec.rb +1 -1
- data/togostanza.gemspec +0 -1
- data/views/help.haml +35 -0
- metadata +3 -19
- data/lib/togostanza/markdown.rb +0 -39
- data/lib/togostanza/stanza/markdown.rb +0 -37
- data/templates/stanza/help.md.erb +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 131870dda2a18def21bb7abe725366739bc7368a
|
4
|
+
data.tar.gz: 92eb70c0d0ac8e68e1b7c4de0ee31cb918545e98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3977125a32659d2df830390255f0230b0a09374209393efb8ed6aa99e6c559051975acd8eb820371e4a8584fc867001e7017193fb1c035db7b692c7d6e65813
|
7
|
+
data.tar.gz: ccbdc5e2f3c163cf793be9151072f4462006aedef737ab3175e2101573cc4be833be181d555b4931b4e2e0942f692f4a0faf14c87e15cccb19a99be29b96fa0d
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'sinatra/base'
|
2
2
|
require 'sinatra/json'
|
3
3
|
require 'sinatra/reloader'
|
4
|
-
require 'haml'
|
4
|
+
require 'tilt/haml'
|
5
5
|
|
6
6
|
module TogoStanza
|
7
7
|
class Application < Sinatra::Base
|
@@ -51,9 +51,9 @@ module TogoStanza
|
|
51
51
|
end
|
52
52
|
|
53
53
|
get '/:id/help' do |id|
|
54
|
-
|
54
|
+
stanza = Stanza.find(id).new
|
55
55
|
|
56
|
-
|
56
|
+
haml :help, locals: {stanza: stanza.metadata}
|
57
57
|
end
|
58
58
|
|
59
59
|
get '/:id/metadata.json' do |id|
|
data/lib/togostanza/cli.rb
CHANGED
@@ -46,7 +46,6 @@ module TogoStanza
|
|
46
46
|
template 'lib.rb.erb', "#{file_name}/lib/#{file_name}.rb"
|
47
47
|
template 'stanza.rb.erb', "#{file_name}/stanza.rb"
|
48
48
|
template 'template.hbs.erb', "#{file_name}/template.hbs"
|
49
|
-
template 'help.md.erb', "#{file_name}/help.md"
|
50
49
|
template 'metadata.json.erb', "#{file_name}/metadata.json"
|
51
50
|
|
52
51
|
create_file "#{file_name}/assets/#{stanza_id}/.keep"
|
@@ -156,7 +156,6 @@ end
|
|
156
156
|
module TogoStanza::Stanza
|
157
157
|
autoload :ExpressionMap, 'togostanza/stanza/expression_map'
|
158
158
|
autoload :Grouping, 'togostanza/stanza/grouping'
|
159
|
-
autoload :Markdown, 'togostanza/stanza/markdown'
|
160
159
|
autoload :Querying, 'togostanza/stanza/querying'
|
161
160
|
|
162
161
|
class Context < Hashie::Mash
|
@@ -214,12 +213,6 @@ module TogoStanza::Stanza
|
|
214
213
|
Tilt.new(path).render(context)
|
215
214
|
end
|
216
215
|
|
217
|
-
def help
|
218
|
-
path = File.join(root, 'help.md')
|
219
|
-
|
220
|
-
TogoStanza::Markdown.render(File.read(path))
|
221
|
-
end
|
222
|
-
|
223
216
|
def metadata
|
224
217
|
path = File.join(root, 'metadata.json')
|
225
218
|
|
data/lib/togostanza/version.rb
CHANGED
data/lib/togostanza.rb
CHANGED
data/spec/features/help_spec.rb
CHANGED
data/togostanza.gemspec
CHANGED
@@ -21,7 +21,6 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_runtime_dependency 'haml'
|
22
22
|
spec.add_runtime_dependency 'hashie'
|
23
23
|
spec.add_runtime_dependency 'parallel'
|
24
|
-
spec.add_runtime_dependency 'redcarpet'
|
25
24
|
spec.add_runtime_dependency 'sinatra'
|
26
25
|
spec.add_runtime_dependency 'sinatra-contrib'
|
27
26
|
spec.add_runtime_dependency 'sparql-client'
|
data/views/help.haml
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
- if stanza
|
2
|
+
%h1= stanza['stanza:label']
|
3
|
+
- if stanza['stanza:context'].present?
|
4
|
+
%span.badge= stanza['stanza:context']
|
5
|
+
- if stanza['stanza:type'].present?
|
6
|
+
%span.badge= stanza['stanza:type']
|
7
|
+
- if stanza['stanza:display'].present?
|
8
|
+
%span.badge= stanza['stanza:display']
|
9
|
+
- if stanza['stanza:license'].present?
|
10
|
+
%span.badge= stanza['stanza:license']
|
11
|
+
%p= stanza['stanza:definition']
|
12
|
+
%h2 Parameters:
|
13
|
+
%p (* = required)
|
14
|
+
%table.table
|
15
|
+
%tbody
|
16
|
+
%tr
|
17
|
+
%th Name
|
18
|
+
%th Description
|
19
|
+
- stanza['stanza:parameter'].each do |stanza_params|
|
20
|
+
%tr
|
21
|
+
%td
|
22
|
+
- if stanza_params["stanza:required"]
|
23
|
+
%span *
|
24
|
+
= stanza_params["stanza:key"]
|
25
|
+
%td
|
26
|
+
#{stanza_params["stanza:description"]} (e.g., #{stanza_params["stanza:example"]})
|
27
|
+
|
28
|
+
%h2 Sample:
|
29
|
+
%pre
|
30
|
+
%code= stanza['stanza:usage']
|
31
|
+
%p
|
32
|
+
The above <code>#{'<div>'}</code> will automatically embed the following Stanza in your HTML page.
|
33
|
+
!= stanza['stanza:usage']
|
34
|
+
- else
|
35
|
+
Work in progress .
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: togostanza
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keita Urashima
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -80,20 +80,6 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: redcarpet
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: sinatra
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -279,12 +265,10 @@ files:
|
|
279
265
|
- lib/togostanza.rb
|
280
266
|
- lib/togostanza/application.rb
|
281
267
|
- lib/togostanza/cli.rb
|
282
|
-
- lib/togostanza/markdown.rb
|
283
268
|
- lib/togostanza/stanza.rb
|
284
269
|
- lib/togostanza/stanza/base.rb
|
285
270
|
- lib/togostanza/stanza/expression_map.rb
|
286
271
|
- lib/togostanza/stanza/grouping.rb
|
287
|
-
- lib/togostanza/stanza/markdown.rb
|
288
272
|
- lib/togostanza/stanza/querying.rb
|
289
273
|
- lib/togostanza/version.rb
|
290
274
|
- spec/dummy/app.rb
|
@@ -314,12 +298,12 @@ files:
|
|
314
298
|
- templates/provider/gitignore.erb
|
315
299
|
- templates/stanza/Gemfile.erb
|
316
300
|
- templates/stanza/gemspec.erb
|
317
|
-
- templates/stanza/help.md.erb
|
318
301
|
- templates/stanza/lib.rb.erb
|
319
302
|
- templates/stanza/metadata.json.erb
|
320
303
|
- templates/stanza/stanza.rb.erb
|
321
304
|
- templates/stanza/template.hbs.erb
|
322
305
|
- togostanza.gemspec
|
306
|
+
- views/help.haml
|
323
307
|
- views/index.haml
|
324
308
|
- views/layout.haml
|
325
309
|
homepage: ''
|
data/lib/togostanza/markdown.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'redcarpet'
|
2
|
-
|
3
|
-
module TogoStanza
|
4
|
-
module Markdown
|
5
|
-
class << self
|
6
|
-
def render(source)
|
7
|
-
INSTANCE.render(source)
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
class Renderer < Redcarpet::Render::HTML
|
12
|
-
def table(header, body)
|
13
|
-
<<-HTML.strip_heredoc
|
14
|
-
<table class="table">
|
15
|
-
#{header}
|
16
|
-
#{body}
|
17
|
-
</table>
|
18
|
-
HTML
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
RENDERER = Renderer.new(
|
23
|
-
hard_wrap: true,
|
24
|
-
safe_links_only: true,
|
25
|
-
with_toc_data: true
|
26
|
-
)
|
27
|
-
|
28
|
-
INSTANCE = Redcarpet::Markdown.new(RENDERER,
|
29
|
-
autolink: true,
|
30
|
-
fenced_code_blocks: true,
|
31
|
-
lax_spacing: true,
|
32
|
-
no_intra_emphasis: true,
|
33
|
-
space_after_headers: true,
|
34
|
-
strikethrough: true,
|
35
|
-
superscript: false,
|
36
|
-
tables: true
|
37
|
-
)
|
38
|
-
end
|
39
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
module TogoStanza::Stanza
|
2
|
-
module Markdown
|
3
|
-
class << self
|
4
|
-
def render(source)
|
5
|
-
INSTANCE.render(source)
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
class Renderer < Redcarpet::Render::HTML
|
10
|
-
def table(header, body)
|
11
|
-
<<-HTML.strip_heredoc
|
12
|
-
<table class="table">
|
13
|
-
#{header}
|
14
|
-
#{body}
|
15
|
-
</table>
|
16
|
-
HTML
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
RENDERER = Renderer.new(
|
21
|
-
hard_wrap: true,
|
22
|
-
safe_links_only: true,
|
23
|
-
with_toc_data: true
|
24
|
-
)
|
25
|
-
|
26
|
-
INSTANCE = Redcarpet::Markdown.new(RENDERER,
|
27
|
-
autolink: true,
|
28
|
-
fenced_code_blocks: true,
|
29
|
-
lax_spacing: true,
|
30
|
-
no_intra_emphasis: true,
|
31
|
-
space_after_headers: true,
|
32
|
-
strikethrough: true,
|
33
|
-
superscript: false,
|
34
|
-
tables: true
|
35
|
-
)
|
36
|
-
end
|
37
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
<%= title %>
|
2
|
-
<%= '=' * title.size %>
|
3
|
-
|
4
|
-
TODO: Write a stanza description
|
5
|
-
|
6
|
-
## Parameters:
|
7
|
-
|
8
|
-
(* = required)
|
9
|
-
|
10
|
-
| Name | Description |
|
11
|
-
|------------------|-------------------------------------|
|
12
|
-
| *data-stanza-foo | TODO: Write a parameter description |
|
13
|
-
|
14
|
-
## Sample:
|
15
|
-
|
16
|
-
```html
|
17
|
-
<div data-stanza="<stanza url>"></div>
|
18
|
-
```
|
19
|
-
|
20
|
-
The above `<div>` will automatically embed the following Stanza in your HTML page.
|
21
|
-
|
22
|
-
<div data-stanza="/stanza/<%= stanza_id %>"></div>
|