sculptor 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +95 -8
- data/features/create.feature +4 -0
- data/lib/sculptor/cli/create.rb +6 -1
- data/lib/sculptor/extensions/model.rb +92 -22
- data/lib/sculptor/extensions/resource_helpers.rb +3 -2
- data/lib/sculptor/templates/glyptotheque/config.tt +5 -4
- data/lib/sculptor/templates/glyptotheque/source/assets/js/glyptotheque.js +10 -0
- data/lib/sculptor/templates/glyptotheque/source/assets/styles/glyptotheque/_model.scss +17 -6
- data/lib/sculptor/templates/glyptotheque/source/assets/styles/main.scss +1 -1
- data/lib/sculptor/templates/glyptotheque/source/layouts/layout.slim +3 -2
- data/lib/sculptor/templates/glyptotheque/source/layouts/standalone.slim +22 -0
- data/lib/sculptor/templates/glyptotheque/source/partials/glyptotheque/_model-index.slim +9 -6
- data/lib/sculptor/templates/glyptotheque/source/partials/glyptotheque/_model.slim +23 -19
- data/lib/sculptor/templates/model/template.tt +15 -18
- data/lib/sculptor/version.rb +1 -1
- data/sculptor.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3b5bb332b14e11ff38c18e9a9ee530360edc3eb
|
4
|
+
data.tar.gz: da50068e1234a39d1d885ef1347d1e8a35afc7e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b77001619758502baff4d35b4bb52468df23a57a70f36054d411becbc58c577f3278570a25ea6a31727db5581b2040275e69dfe584d8eb8f0066178b13e03779
|
7
|
+
data.tar.gz: ac245d0271ccf2d7bf639f55c7fc0e682bd3b0bdf0f21e8d1b2aab043844b4a32aa7810176c2468a10f1c450f64cd73f43b5c152bcfeac4b1bbee35f784b9ff8
|
data/README.md
CHANGED
@@ -4,21 +4,108 @@ Tool to create style guides and prototype web apps.
|
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
|
7
|
+
```
|
8
|
+
$ gem install sculptor
|
9
|
+
```
|
8
10
|
|
9
|
-
|
11
|
+
## Usage
|
10
12
|
|
11
|
-
|
13
|
+
Sculptor extends Middleman so all Middleman commands can also be used.
|
12
14
|
|
13
|
-
|
15
|
+
### Initiate new project
|
14
16
|
|
15
|
-
|
17
|
+
Fetches and installs dependencies and creates project skeleton.
|
16
18
|
|
17
|
-
|
19
|
+
```
|
20
|
+
sculptor init project-name
|
21
|
+
```
|
18
22
|
|
19
|
-
|
23
|
+
Aliases: `i`, `new`, `n`.
|
24
|
+
|
25
|
+
When finished run `bower install` (`npm install -g bower` if bower is not installed) in project directory to install client-side dependencies.
|
26
|
+
|
27
|
+
### Create new model
|
28
|
+
|
29
|
+
In project root directory run:
|
30
|
+
|
31
|
+
```
|
32
|
+
sculptor create model-name
|
33
|
+
```
|
34
|
+
|
35
|
+
Alias `c`.
|
36
|
+
|
37
|
+
Models are sub-project which are contained in directories.
|
38
|
+
Several similar modules can be created in one directory:
|
39
|
+
|
40
|
+
```
|
41
|
+
sculptor c model-name/variant
|
42
|
+
```
|
43
|
+
|
44
|
+
If no variant is specified the initial variant is created with the same name as directory
|
45
|
+
|
46
|
+
An index file is generated for ech directory.
|
47
|
+
|
48
|
+
When createing a new model its path is shown and the following questions asked:
|
49
|
+
|
50
|
+
- **Title:** (optional)- title for the model created
|
51
|
+
- **Description:** (optional) - model description
|
52
|
+
- **Stylesheet:** (optional) - stylesheet file name, created in the model directory and automatically included in the model
|
53
|
+
- **Use iframe?** (`y`/`n` default `n`) - whether to encapsulate the model in iframe or render directly on page (to prevent style leaking)
|
54
|
+
- **Include data?** (`y`/`n` default `n`) - whether to include YAML file for model mock data
|
55
|
+
|
56
|
+
### Running test server
|
57
|
+
|
58
|
+
Runs development server with LiveReload.
|
59
|
+
|
60
|
+
```
|
61
|
+
sculptor server
|
62
|
+
```
|
63
|
+
|
64
|
+
Running `sculptor` without any parameters is aliased to `sculptor server`.
|
65
|
+
|
66
|
+
### Building the gallery
|
67
|
+
|
68
|
+
Generates static version of project in `build` directory.
|
69
|
+
|
70
|
+
```
|
71
|
+
sculptor build
|
72
|
+
```
|
73
|
+
|
74
|
+
The build can be distributed/viewed in standalone mode.
|
75
|
+
|
76
|
+
On OSX running `build/launch.command` afterwards will run Python's SimpleHTTPServer on port 8000 and open browser with project.
|
77
|
+
|
78
|
+
|
79
|
+
## Sculptor template helpers
|
80
|
+
|
81
|
+
Sculptor is using Slim templates internally but should work with other templates supported by Middleman in projects.
|
82
|
+
|
83
|
+
### Model helpers
|
84
|
+
|
85
|
+
* `model`
|
86
|
+
- `title`
|
87
|
+
- `description`
|
88
|
+
- `pretty` {boolean}
|
89
|
+
whether to try to reformat the HTML (e.g. if remote HTML is minified)
|
90
|
+
- `css` - CSS selector to extract from the remote page. If specific element is required it can be selected by providing `#<0-based index>` at the end of selector separated by space. e.g. `img #0` will select the first image.
|
91
|
+
- `data` - local data that can be injected in a local component (partial with `.component.slim` extension)
|
92
|
+
- `source_type` {string} default `html`
|
93
|
+
type of source code used for code highlighting
|
94
|
+
* `model_iframe`
|
95
|
+
* `model_source`
|
96
|
+
|
97
|
+
### Resource helpers
|
98
|
+
* `include_stylesheets`
|
99
|
+
* `include_stylesheet`
|
100
|
+
* `include_javascripts`
|
101
|
+
* `relative_dir`
|
102
|
+
* `resource_file`
|
103
|
+
* `resource_dir`
|
104
|
+
* `subpages_for`
|
105
|
+
* `append_class`
|
20
106
|
|
21
|
-
|
107
|
+
### Data helpers
|
108
|
+
* `load_data`
|
22
109
|
|
23
110
|
## Contributing
|
24
111
|
|
data/features/create.feature
CHANGED
@@ -10,6 +10,8 @@ Feature: Run `create` command
|
|
10
10
|
Then I hit enter
|
11
11
|
And I wait for output to contain "Stylesheet"
|
12
12
|
Then I hit enter
|
13
|
+
And I wait for output to contain "Use iframe?"
|
14
|
+
Then I type "n"
|
13
15
|
And I wait for output to contain "Include data?"
|
14
16
|
Then I type "n"
|
15
17
|
And the exit status should be 0
|
@@ -24,6 +26,8 @@ Feature: Run `create` command
|
|
24
26
|
Then I type "My model description"
|
25
27
|
And I wait for output to contain "Stylesheet"
|
26
28
|
Then I type "styles"
|
29
|
+
And I wait for output to contain "Use iframe?"
|
30
|
+
Then I type "n"
|
27
31
|
And I wait for output to contain "Include data?"
|
28
32
|
Then I type "y"
|
29
33
|
And the exit status should be 0
|
data/lib/sculptor/cli/create.rb
CHANGED
@@ -16,7 +16,10 @@ module Sculptor::CLI
|
|
16
16
|
|
17
17
|
desc 'create NAME', 'Create new model NAME'
|
18
18
|
def create(name)
|
19
|
-
|
19
|
+
|
20
|
+
dir = Dir.pwd.match(/\/source$/) ? "." : "source"
|
21
|
+
|
22
|
+
model_path = "#{dir}/#{name}"
|
20
23
|
|
21
24
|
say(set_color("Creating model: ", :yellow) + set_color(model_path, :white, :bold))
|
22
25
|
|
@@ -27,6 +30,8 @@ module Sculptor::CLI
|
|
27
30
|
@title = options[:title] || ask('Title: ')
|
28
31
|
@description = options[:desc] || ask('Description: ')
|
29
32
|
@stylesheet = ask('Stylesheet: ')
|
33
|
+
@iframe = yes?('Use iframe?')
|
34
|
+
|
30
35
|
@dir = is_subdir ? name.split('/')[0..-2].join('/') : name
|
31
36
|
|
32
37
|
@has_data = if yes?('Include data?')
|
@@ -7,48 +7,118 @@ class Middleman::Extensions::Model < ::Middleman::Extension
|
|
7
7
|
end
|
8
8
|
|
9
9
|
helpers do
|
10
|
-
# Requires
|
11
|
-
#
|
10
|
+
# Requires either `&block` or `location`
|
11
|
+
# `location` - string with remote location to fetch the HTML from.
|
12
|
+
# Options:
|
12
13
|
# * `title` (optional) - Model title
|
13
14
|
# * `description` (optional) - Model description
|
14
|
-
# * `
|
15
|
-
#
|
15
|
+
# * `css` (optional, defaults to `body`) - element(s) with CSS selector
|
16
|
+
# to extract from the page. If a particular element is required it can
|
17
|
+
# be requested by providing 0-based index of the list of matches.
|
18
|
+
# e.g. `img #0`
|
16
19
|
# * `&block` (optional)
|
17
|
-
def model(options={}, &block)
|
18
|
-
[:title, :description].each { |k| options[k] ||= nil }
|
19
|
-
|
20
|
+
def model(location=nil, options={}, &block)
|
20
21
|
if block_given?
|
21
22
|
html = capture_html(&block)
|
22
23
|
metadata = options
|
23
|
-
elsif
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
24
|
+
elsif location
|
25
|
+
# Remote location
|
26
|
+
if location.start_with?('http')
|
27
|
+
result = grab_remote(location, options[:css], options)
|
28
|
+
metadata = options
|
29
|
+
html = result.to_html
|
30
|
+
# Assume local path
|
31
|
+
else
|
32
|
+
resource = sitemap.find_resource_by_path(relative_dir(current_page.path, location).to_s)
|
33
|
+
raise "Included model at `#{location}` was not found" unless resource
|
34
|
+
metadata = resource.metadata.page
|
35
|
+
|
36
|
+
# Hack: inject local data that can be provided as parameter
|
37
|
+
# Provided under `data.page` in partials (.component)
|
38
|
+
resource.add_metadata({ page: options[:data] })
|
39
|
+
|
40
|
+
html = resource.render
|
34
41
|
end
|
35
|
-
html = result.to_xml
|
36
42
|
else
|
37
|
-
raise "Model `#{options[:title]}`:
|
43
|
+
raise "Model `#{options[:title]}`: `url` or HTML block is missing"
|
38
44
|
end
|
39
45
|
|
40
46
|
options.reverse_merge!(metadata.symbolize_keys!)
|
41
|
-
options[:html] = html
|
42
47
|
|
43
|
-
options[:
|
48
|
+
options[:title] = options[:title] || data.page.title
|
49
|
+
options[:description] = options[:description] || data.page.description
|
50
|
+
|
51
|
+
current_page.add_metadata({ page: { iframe: options[:iframe] || false }})
|
52
|
+
|
53
|
+
options[:html] = html
|
54
|
+
options[:source_code] = html
|
44
55
|
options[:source_type] ||= 'html'
|
45
56
|
|
46
57
|
partial('partials/glyptotheque/model', locals: options)
|
47
58
|
end
|
48
59
|
|
60
|
+
def model_iframe(location=nil, options={}, &block)
|
61
|
+
options[:iframe] = true
|
62
|
+
model(location, options, &block)
|
63
|
+
end
|
64
|
+
|
49
65
|
def model_source(type, &block)
|
50
66
|
source_code = capture_html(&block)
|
51
67
|
partial('partials/glyptotheque/model-source', locals: { source_type: type, source_code: source_code })
|
52
68
|
end
|
69
|
+
|
70
|
+
private
|
71
|
+
|
72
|
+
def grab_remote(url, css, options)
|
73
|
+
puts "Fetching from #{url}"
|
74
|
+
|
75
|
+
css ||= 'body'
|
76
|
+
|
77
|
+
selector_index_pair = css.split(/\s+#(\d+)$/)
|
78
|
+
|
79
|
+
if options[:pretty] == true
|
80
|
+
doc = Nokogiri::XML(open(url), &:noblanks)
|
81
|
+
else
|
82
|
+
doc = Nokogiri::HTML(open(url), &:noblanks)
|
83
|
+
end
|
84
|
+
|
85
|
+
result = doc.css(selector_index_pair[0])
|
86
|
+
puts "Matching CSS: `#{selector_index_pair[0]}` (found #{pluralize(result.count, 'element')})"
|
87
|
+
|
88
|
+
# Select element with specified index e.g. `.selector #1`
|
89
|
+
if selector_index_pair[1]
|
90
|
+
puts "Select index #{selector_index_pair[1].to_i} from the list"
|
91
|
+
result = result[selector_index_pair[1].to_i]
|
92
|
+
end
|
93
|
+
|
94
|
+
@root_url = "#{URI(url).scheme}://#{URI(url).host}/"
|
95
|
+
|
96
|
+
if result.class == Nokogiri::XML::NodeSet
|
97
|
+
result.css('[src]').map do |e|
|
98
|
+
e.set_attribute('src', parse_relative_url(url, e.attr('src')))
|
99
|
+
end
|
100
|
+
elsif result.class == Nokogiri::XML::Element
|
101
|
+
result.set_attribute('src', parse_relative_url(url, result.attr('src'))) if result.attr('src')
|
102
|
+
end
|
103
|
+
|
104
|
+
if !result || result.is_a?(Array) && result.empty?
|
105
|
+
raise "Selector `#{selector_index_pair[0]}`#{selector_index_pair[1] ? '(index: ' + selector_index_pair[1] + ')': ''} not found at remote location`#{url}`"
|
106
|
+
end
|
107
|
+
|
108
|
+
return result
|
109
|
+
end
|
110
|
+
|
111
|
+
def parse_relative_url(url, path)
|
112
|
+
is_root = path.match(/^\/[^\/].*/)
|
113
|
+
if is_root
|
114
|
+
path.sub(/^\/(.*)/, @root_url + $1)
|
115
|
+
elsif path.match(/^\.{1,2}\//)
|
116
|
+
relative_dir(url, path).to_s
|
117
|
+
elsif path.match(/^\/\//)
|
118
|
+
"#{URI(url).scheme}:#{path}"
|
119
|
+
else
|
120
|
+
path
|
121
|
+
end
|
122
|
+
end
|
53
123
|
end
|
54
124
|
end
|
@@ -9,7 +9,8 @@ class Middleman::Extensions::ResourceHelpers < ::Middleman::Extension
|
|
9
9
|
|
10
10
|
def include_stylesheet(stylesheet)
|
11
11
|
return if stylesheet.empty?
|
12
|
-
|
12
|
+
path = stylesheet.start_with?('http') ? '' : current_page.path
|
13
|
+
stylesheet_link_tag(relative_dir(path, stylesheet)) + "\n"
|
13
14
|
end
|
14
15
|
|
15
16
|
def include_javascripts(javascripts)
|
@@ -46,7 +47,7 @@ class Middleman::Extensions::ResourceHelpers < ::Middleman::Extension
|
|
46
47
|
resources = resources.reject {|r| r.directory_index? } # Exclude all directory indexes
|
47
48
|
end
|
48
49
|
|
49
|
-
resources.reject {|r| r.path.end_with? ("-
|
50
|
+
resources.reject {|r| r.path.end_with? ("-standalone#{r.ext}")} # Ignore proxied '-standalone' mode pages
|
50
51
|
end
|
51
52
|
|
52
53
|
# Use in layouts, in templates either Frontmatter or this method can be used
|
@@ -4,9 +4,9 @@
|
|
4
4
|
|
5
5
|
# With alternative layout
|
6
6
|
page '/**', :layout => 'glyptotheque'
|
7
|
-
page '/*-
|
7
|
+
page '/*-standalone.html', :layout => 'standalone'
|
8
8
|
# With no layout
|
9
|
-
page "
|
9
|
+
page "*.component", :layout => false
|
10
10
|
page "/partials/*", :layout => false
|
11
11
|
page '*.css', :layout => false
|
12
12
|
page '*.js', :layout => false
|
@@ -21,7 +21,7 @@ page '*.js', :layout => false
|
|
21
21
|
|
22
22
|
ready do
|
23
23
|
subpages_for('/', exclude_indexes: true).each do |r|
|
24
|
-
proxy "#{r.path.sub(r.ext, '')}-
|
24
|
+
proxy "#{r.path.sub(r.ext, '')}-standalone.html", r.path
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -82,10 +82,11 @@ activate :data_loaders
|
|
82
82
|
activate :resource_helpers
|
83
83
|
activate :syntax, css_class: 'codehilite'
|
84
84
|
|
85
|
+
Slim::Engine.set_default_options :pretty => true
|
86
|
+
|
85
87
|
# Development-secific configuration
|
86
88
|
configure :development do
|
87
89
|
activate :livereload
|
88
|
-
Slim::Engine.set_default_options :pretty => true
|
89
90
|
end
|
90
91
|
|
91
92
|
# Build-specific configuration
|
@@ -1,3 +1,13 @@
|
|
1
1
|
//= require_tree ./glyptotheque
|
2
2
|
|
3
3
|
angular.module('glyptotheque', ['directives', 'controllers']);
|
4
|
+
|
5
|
+
function resizeIframe(obj) {
|
6
|
+
var doc = obj.contentDocument
|
7
|
+
var height = Math.max(
|
8
|
+
doc.body.scrollHeight, doc.documentElement.scrollHeight,
|
9
|
+
doc.body.offsetHeight, doc.documentElement.offsetHeight,
|
10
|
+
doc.body.clientHeight, doc.documentElement.clientHeight
|
11
|
+
)
|
12
|
+
obj.style.height = height + 'px';
|
13
|
+
}
|
@@ -13,6 +13,7 @@
|
|
13
13
|
position: relative;
|
14
14
|
padding: 10px 20px;
|
15
15
|
margin-bottom: 2px;
|
16
|
+
min-height: 40px;
|
16
17
|
|
17
18
|
h3 {
|
18
19
|
font-weight: 400;
|
@@ -49,14 +50,21 @@
|
|
49
50
|
|
50
51
|
> .glypto-model-stage {
|
51
52
|
background: lighten($light-grey, 9);
|
52
|
-
padding:
|
53
|
+
padding: 10px;
|
53
54
|
|
54
|
-
> figure
|
55
|
+
> figure,
|
56
|
+
> iframe {
|
57
|
+
@include box-sizing(content-box);
|
55
58
|
margin: 0;
|
56
|
-
padding: 5px;
|
57
59
|
border-radius: 3px;
|
58
60
|
border: 1px dotted rgba(0,0,0,.13);
|
59
61
|
background: white;
|
62
|
+
display: block;
|
63
|
+
}
|
64
|
+
|
65
|
+
> figure {
|
66
|
+
@include clearfix;
|
67
|
+
padding: 5px;
|
60
68
|
}
|
61
69
|
|
62
70
|
._component {
|
@@ -87,8 +95,7 @@
|
|
87
95
|
box-shadow: inset 0 1px darken($light-grey, 5);
|
88
96
|
|
89
97
|
> header {
|
90
|
-
padding: 8px
|
91
|
-
margin: 0 20px;
|
98
|
+
padding: 8px 20px;
|
92
99
|
}
|
93
100
|
|
94
101
|
._toggle {
|
@@ -130,13 +137,17 @@
|
|
130
137
|
}
|
131
138
|
|
132
139
|
pre {
|
133
|
-
border-top: 1px solid darken($light-grey, 3);
|
134
140
|
font: 12px/1.4 Menlo, monospace;
|
135
141
|
padding: 10px 20px;
|
136
142
|
margin: 0;
|
143
|
+
white-space: pre-wrap;
|
137
144
|
}
|
138
145
|
|
139
146
|
&.__expanded {
|
147
|
+
> header {
|
148
|
+
border-bottom: 1px solid darken($light-grey, 3);
|
149
|
+
}
|
150
|
+
|
140
151
|
> ._container {
|
141
152
|
max-height: 20rem;
|
142
153
|
}
|
@@ -7,8 +7,9 @@ html ng-app=(yield_content(:ng_app))
|
|
7
7
|
= stylesheet_link_tag 'main'
|
8
8
|
= stylesheet_link_tag '//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css'
|
9
9
|
= yield_content :styles
|
10
|
-
|
11
|
-
|
10
|
+
- unless current_page.metadata.page[:iframe]
|
11
|
+
= include_stylesheets(current_page.data.stylesheets) if current_page.data.stylesheets
|
12
|
+
= include_stylesheet(current_page.data.stylesheet) if current_page.data.stylesheet
|
12
13
|
|
13
14
|
body class="#{yield_content(:body_class)}"
|
14
15
|
= yield
|
@@ -0,0 +1,22 @@
|
|
1
|
+
doctype html
|
2
|
+
html
|
3
|
+
head
|
4
|
+
meta charset='utf-8'
|
5
|
+
title = current_page.data.title || yield_content(:page_title) || resource_file(current_page)
|
6
|
+
meta name='viewport' content='width=device-width'
|
7
|
+
= yield_content :styles
|
8
|
+
= include_stylesheets(current_page.data.stylesheets) if current_page.data.stylesheets
|
9
|
+
= include_stylesheet(current_page.data.stylesheet) if current_page.data.stylesheet
|
10
|
+
css:
|
11
|
+
body {
|
12
|
+
padding: 5px;
|
13
|
+
margin: 0;
|
14
|
+
}
|
15
|
+
|
16
|
+
|
17
|
+
body class="#{yield_content(:body_class)}"
|
18
|
+
= yield
|
19
|
+
|
20
|
+
= yield_content :javascripts
|
21
|
+
= include_javascripts current_page.data.javascripts if current_page.data.javascripts
|
22
|
+
= yield_content :post_body
|
@@ -1,11 +1,14 @@
|
|
1
|
-
- subpages_for(
|
1
|
+
- subpages_for(current_page.url, exclude_indexes: true).each do |r|
|
2
2
|
|
3
|
-
-
|
4
|
-
|
5
|
-
-
|
6
|
-
-
|
3
|
+
- current_page.add_metadata({ page: { title: r.data.title, local_url: r.url, iframe: r.metadata.page[:iframe] } })
|
4
|
+
|
5
|
+
- unless current_page.metadata.page[:iframe]
|
6
|
+
- if r.data.stylesheet
|
7
|
+
- content_for :styles, include_stylesheet(r.data.stylesheet)
|
8
|
+
- elsif r.data.stylesheets
|
9
|
+
- content_for :styles, include_stylesheets(r.data.stylesheets)
|
7
10
|
|
8
11
|
- if r.data.javascripts
|
9
12
|
- content_for :javascripts, include_javascripts(r.data.javascripts)
|
10
13
|
|
11
|
-
= partial r.url
|
14
|
+
= partial r.url
|
@@ -1,24 +1,28 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
section.glypto-model-stage.m-standalone
|
4
|
-
= html
|
5
|
-
- else
|
6
|
-
- if locals[:title] || locals[:description]
|
7
|
-
header
|
8
|
-
- if locals[:title]
|
9
|
-
h3._title
|
10
|
-
- if locals[:url]
|
11
|
-
= link_to title, url
|
12
|
-
- else
|
13
|
-
= title
|
14
|
-
- if locals[:description]
|
15
|
-
p._description = description
|
1
|
+
- local_url = current_page.metadata.page[:local_url]
|
2
|
+
- title = current_page.metadata.page[:title] || locals[:title]
|
16
3
|
|
17
|
-
|
18
|
-
|
19
|
-
|
4
|
+
- if resource_file(current_page).match(/-standalone$/)
|
5
|
+
= html
|
6
|
+
- else
|
7
|
+
article.glypto-model
|
8
|
+
header
|
9
|
+
- if locals[:title]
|
10
|
+
h3._title
|
11
|
+
- if local_url
|
12
|
+
= link_to title, local_url
|
13
|
+
- else
|
14
|
+
= title
|
15
|
+
- if locals[:description]
|
16
|
+
p._description = description
|
17
|
+
|
18
|
+
- url = local_url || current_page.url
|
19
|
+
._standalone = link_to url.sub('.html', '-standalone.html'), target: '_blank' do
|
20
|
+
i.fa.fa-external-link title="Standalone version"
|
20
21
|
|
21
22
|
section.glypto-model-stage
|
22
|
-
|
23
|
+
- if current_page.metadata.page.iframe
|
24
|
+
iframe src="#{url.sub('.html', '-standalone.html')}" height="0" width="100%" frameborder="0" scrolling="no" onload='javascript:resizeIframe(this);'
|
25
|
+
- else
|
26
|
+
figure = html
|
23
27
|
|
24
28
|
= model_source(source_type) { source_code }
|
@@ -1,7 +1,6 @@
|
|
1
1
|
---
|
2
2
|
<%- unless @title.empty? -%>
|
3
|
-
title:
|
4
|
-
<%= @title %>
|
3
|
+
title: <%= @title %>
|
5
4
|
<%- end -%>
|
6
5
|
<%- unless @description.empty? -%>
|
7
6
|
description: >
|
@@ -12,23 +11,21 @@ stylesheet: <%= @stylesheet %>
|
|
12
11
|
<%- end -%>
|
13
12
|
---
|
14
13
|
|
15
|
-
- title ||= current_page.data.title
|
16
|
-
- description ||= current_page.data.description
|
17
|
-
|
18
14
|
<%- if @has_data -%>
|
19
15
|
- data = load_data('<%= @model_name %>.yaml')
|
20
16
|
<%- end -%>
|
21
17
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
18
|
+
<%- if @iframe -%>
|
19
|
+
= model_iframe
|
20
|
+
<%- else -%>
|
21
|
+
= model
|
22
|
+
<%- end -%>
|
23
|
+
<%- if @has_data -%>
|
24
|
+
table
|
25
|
+
- data.keys.each do |k|
|
26
|
+
tr
|
27
|
+
th = k
|
28
|
+
td = data[k]
|
29
|
+
<%- else -%>
|
30
|
+
p Component HTML code here
|
31
|
+
<%- end -%>
|
data/lib/sculptor/version.rb
CHANGED
data/sculptor.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_development_dependency "fivemat", "1.2.1"
|
28
28
|
spec.add_development_dependency "guard-rspec"
|
29
29
|
spec.add_development_dependency "guard-cucumber"
|
30
|
-
spec.add_development_dependency "pry
|
30
|
+
spec.add_development_dependency "pry"
|
31
31
|
|
32
32
|
spec.add_dependency "middleman-core", [">= 3.3", "< 4.0"]
|
33
33
|
spec.add_dependency "thor", [">= 0.15.2", "< 2.0"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sculptor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyom Semonov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -137,7 +137,7 @@ dependencies:
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name: pry
|
140
|
+
name: pry
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - '>='
|
@@ -267,6 +267,7 @@ files:
|
|
267
267
|
- lib/sculptor/templates/glyptotheque/source/index.html.slim
|
268
268
|
- lib/sculptor/templates/glyptotheque/source/layouts/glyptotheque.slim
|
269
269
|
- lib/sculptor/templates/glyptotheque/source/layouts/layout.slim
|
270
|
+
- lib/sculptor/templates/glyptotheque/source/layouts/standalone.slim
|
270
271
|
- lib/sculptor/templates/glyptotheque/source/partials/glyptotheque/_model-index.slim
|
271
272
|
- lib/sculptor/templates/glyptotheque/source/partials/glyptotheque/_model-source.slim
|
272
273
|
- lib/sculptor/templates/glyptotheque/source/partials/glyptotheque/_model.slim
|
@@ -305,4 +306,3 @@ test_files:
|
|
305
306
|
- features/create.feature
|
306
307
|
- features/step_definitions/custom.rb
|
307
308
|
- features/support/setup.rb
|
308
|
-
has_rdoc:
|