middleman-tansu 0.0.2 → 0.0.3
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 +3 -0
- data/features/helpers.feature +156 -2
- data/features/template_cli.feature +35 -0
- data/fixtures/breadcrumbs-has-title-app/config.rb +1 -0
- data/fixtures/breadcrumbs-has-title-app/source/dir/index.html.erb +4 -0
- data/fixtures/breadcrumbs-has-title-app/source/dir/sub_dir/page.md +3 -0
- data/fixtures/breadcrumbs-has-title-app/source/images/.gitkeep +0 -0
- data/fixtures/breadcrumbs-has-title-app/source/index.html.erb +4 -0
- data/fixtures/breadcrumbs-has-title-app/source/javascripts/.gitkeep +0 -0
- data/fixtures/breadcrumbs-has-title-app/source/layouts/layout.erb +13 -0
- data/fixtures/breadcrumbs-has-title-app/source/stylesheets/all.css +0 -0
- data/fixtures/breadcrumbs-has-title-app/source/templates/index.html.erb +1 -0
- data/fixtures/index-app/config.rb +1 -0
- data/fixtures/index-app/source/dir/page.md +0 -0
- data/fixtures/index-app/source/images/.gitkeep +0 -0
- data/fixtures/index-app/source/javascripts/.gitkeep +0 -0
- data/fixtures/index-app/source/layouts/layout.erb +17 -0
- data/fixtures/index-app/source/stylesheets/all.css +0 -0
- data/fixtures/index-app/source/templates/index.html.erb +1 -0
- data/fixtures/title-app/config.rb +1 -0
- data/fixtures/title-app/source/dir/sub_dir/page.md +3 -0
- data/fixtures/title-app/source/images/.gitkeep +0 -0
- data/fixtures/title-app/source/javascripts/.gitkeep +0 -0
- data/fixtures/title-app/source/layouts/layout.erb +10 -0
- data/fixtures/title-app/source/stylesheets/all.css +0 -0
- data/fixtures/title-app/source/templates/index.html.erb +1 -0
- data/fixtures/title-has-title-app/config.rb +1 -0
- data/fixtures/title-has-title-app/source/dir/index.html.erb +3 -0
- data/fixtures/title-has-title-app/source/dir/sub_dir/page.md +0 -0
- data/fixtures/title-has-title-app/source/images/.gitkeep +0 -0
- data/fixtures/title-has-title-app/source/index.html.erb +3 -0
- data/fixtures/title-has-title-app/source/javascripts/.gitkeep +0 -0
- data/fixtures/title-has-title-app/source/layouts/layout.erb +11 -0
- data/fixtures/title-has-title-app/source/stylesheets/all.css +0 -0
- data/fixtures/title-has-title-app/source/templates/index.html.erb +1 -0
- data/lib/middleman-tansu/helpers.rb +46 -2
- data/lib/middleman-tansu/template/shared/config.tt +1 -0
- data/lib/middleman-tansu/template/source/layouts/layout.slim +18 -28
- data/lib/middleman-tansu/template/source/sample.html.md +6 -5
- data/lib/middleman-tansu/template/source/sitemap.xml.builder +16 -0
- data/lib/middleman-tansu/template.rb +2 -4
- data/lib/middleman-tansu/version.rb +1 -1
- data/middleman-tansu.gemspec +4 -3
- metadata +73 -26
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6f81c9bc1a8df9d9ee97dd9d2f6d21a025b4846f
|
|
4
|
+
data.tar.gz: 7b125b5379c5cb0b57596f6b3bcc2e42d8bae8d0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3b3ed8a4afef1d52bb030f60e4524a5d81c0209f0a4637cc8e2b92f08ed5a48f75c96206bd9814426598cbb733d99cf55a4ecf52a6e7f396b6cc5d18598df6f1
|
|
7
|
+
data.tar.gz: ff7af4caa6f8bc2048509295177220ab40f5ebdcc04079a1b28704f258a7eda4a72cdcb44bdaf5e7a355e37abb5cbc858b86905a688dbc46c30aafa3f9a26fa9
|
data/README.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# Middleman::Tansu
|
|
2
2
|
|
|
3
|
+
[](http://badge.fury.io/rb/middleman-tansu)
|
|
4
|
+
[](https://travis-ci.org/yterajima/middleman-tansu)
|
|
5
|
+
|
|
3
6
|
TODO: Write a gem description
|
|
4
7
|
|
|
5
8
|
## Installation
|
data/features/helpers.feature
CHANGED
|
@@ -37,6 +37,24 @@ Feature: Helpers
|
|
|
37
37
|
And the helper result "build/index.html" should contain '<ul class="bread-links">'
|
|
38
38
|
And the helper result "build/index.html" should contain '<li class="root"><a href="/">Home</a></li>'
|
|
39
39
|
|
|
40
|
+
Scenario: `breadcrumbs` helper with index page that has title Frontmatter
|
|
41
|
+
Given a fixture app "breadcrumbs-has-title-app"
|
|
42
|
+
When I run `middleman build --verbose`
|
|
43
|
+
Then the exit status should be 0
|
|
44
|
+
|
|
45
|
+
# /index.html
|
|
46
|
+
And the helper result "build/index.html" should contain '<ul class="breadcrumbs">'
|
|
47
|
+
And the helper result "build/index.html" should contain '<li class="root"><a href="/">Root Page</a></li>'
|
|
48
|
+
|
|
49
|
+
# /dir/page.html
|
|
50
|
+
And the helper result "build/dir/sub_dir/page.html" should contain:
|
|
51
|
+
"""
|
|
52
|
+
<li class="root"><a href="/">Root Page</a></li>
|
|
53
|
+
<li><a href="/dir/">Dir/Index Title</a></li>
|
|
54
|
+
<li><a href="/dir/sub_dir/">sub_dir</a></li>
|
|
55
|
+
<li class="current">Dir/Page Title</li>
|
|
56
|
+
"""
|
|
57
|
+
|
|
40
58
|
Scenario: `children_pages` helper
|
|
41
59
|
Given a fixture app "children-pages-app"
|
|
42
60
|
And a file named "source/templates/index.html.erb" with:
|
|
@@ -98,7 +116,7 @@ Feature: Helpers
|
|
|
98
116
|
And a file named "source/templates/index.html.erb" with:
|
|
99
117
|
"""
|
|
100
118
|
<ul>
|
|
101
|
-
|
|
119
|
+
<% children_pages(:category).each do |page| %>
|
|
102
120
|
<li><%= link_to(page_name(page), page_url(page)) %></li>
|
|
103
121
|
<% end %>
|
|
104
122
|
</ul>
|
|
@@ -120,7 +138,7 @@ Feature: Helpers
|
|
|
120
138
|
And a file named "source/templates/index.html.erb" with:
|
|
121
139
|
"""
|
|
122
140
|
<ul>
|
|
123
|
-
|
|
141
|
+
<% children_pages(:category, :desc).each do |page| %>
|
|
124
142
|
<li><%= link_to(page_name(page), page_url(page)) %></li>
|
|
125
143
|
<% end %>
|
|
126
144
|
</ul>
|
|
@@ -136,3 +154,139 @@ Feature: Helpers
|
|
|
136
154
|
<li><a href="/dir1/page2.html">dir1/Page2 Title</a></li>
|
|
137
155
|
<li><a href="/dir1/page1.html">dir1/Page1 Title</a></li>
|
|
138
156
|
"""
|
|
157
|
+
|
|
158
|
+
Scenario: `title` helper
|
|
159
|
+
Given a fixture app "title-app"
|
|
160
|
+
When I run `middleman build --verbose`
|
|
161
|
+
Then the exit status should be 0
|
|
162
|
+
And the helper result "build/index.html" should contain:
|
|
163
|
+
"""
|
|
164
|
+
<title>Middleman-Tansu</title>
|
|
165
|
+
"""
|
|
166
|
+
And the helper result "build/dir/index.html" should contain:
|
|
167
|
+
"""
|
|
168
|
+
<title>dir/ - Middleman-Tansu</title>
|
|
169
|
+
"""
|
|
170
|
+
And the helper result "build/dir/sub_dir/index.html" should contain:
|
|
171
|
+
"""
|
|
172
|
+
<title>dir/sub_dir/ - Middleman-Tansu</title>
|
|
173
|
+
"""
|
|
174
|
+
And the helper result "build/dir/sub_dir/page.html" should contain:
|
|
175
|
+
"""
|
|
176
|
+
<title>Page Title - Middleman-Tansu</title>
|
|
177
|
+
"""
|
|
178
|
+
|
|
179
|
+
Scenario: `title` helper with app.config.site_title option
|
|
180
|
+
Given a fixture app "title-app"
|
|
181
|
+
And a file named "config.rb" with:
|
|
182
|
+
"""
|
|
183
|
+
set :site_title, "TANSU"
|
|
184
|
+
activate :tansu
|
|
185
|
+
"""
|
|
186
|
+
When I run `middleman build --verbose`
|
|
187
|
+
Then the exit status should be 0
|
|
188
|
+
And the helper result "build/index.html" should contain:
|
|
189
|
+
"""
|
|
190
|
+
<title>TANSU</title>
|
|
191
|
+
"""
|
|
192
|
+
And the helper result "build/dir/index.html" should contain:
|
|
193
|
+
"""
|
|
194
|
+
<title>dir/ - TANSU</title>
|
|
195
|
+
"""
|
|
196
|
+
And the helper result "build/dir/sub_dir/page.html" should contain:
|
|
197
|
+
"""
|
|
198
|
+
<title>Page Title - TANSU</title>
|
|
199
|
+
"""
|
|
200
|
+
|
|
201
|
+
Scenario: `title` helper
|
|
202
|
+
Given a fixture app "title-has-title-app"
|
|
203
|
+
When I run `middleman build --verbose`
|
|
204
|
+
Then the exit status should be 0
|
|
205
|
+
And the helper result "build/index.html" should contain:
|
|
206
|
+
"""
|
|
207
|
+
<title>Root Page - Middleman-Tansu</title>
|
|
208
|
+
"""
|
|
209
|
+
And the helper result "build/dir/index.html" should contain:
|
|
210
|
+
"""
|
|
211
|
+
<title>Dir/Index Title - Middleman-Tansu</title>
|
|
212
|
+
"""
|
|
213
|
+
And the helper result "build/dir/sub_dir/page.html" should contain:
|
|
214
|
+
"""
|
|
215
|
+
<title>dir/sub_dir/page - Middleman-Tansu</title>
|
|
216
|
+
"""
|
|
217
|
+
|
|
218
|
+
Scenario: `heading` helper
|
|
219
|
+
Given a fixture app "title-app"
|
|
220
|
+
When I run `middleman build --verbose`
|
|
221
|
+
Then the exit status should be 0
|
|
222
|
+
And the helper result "build/index.html" should contain:
|
|
223
|
+
"""
|
|
224
|
+
<h1>Middleman-Tansu</h1>
|
|
225
|
+
"""
|
|
226
|
+
And the helper result "build/dir/index.html" should contain:
|
|
227
|
+
"""
|
|
228
|
+
<h1>dir/</h1>
|
|
229
|
+
"""
|
|
230
|
+
And the helper result "build/dir/sub_dir/index.html" should contain:
|
|
231
|
+
"""
|
|
232
|
+
<h1>dir/sub_dir/</h1>
|
|
233
|
+
"""
|
|
234
|
+
And the helper result "build/dir/sub_dir/page.html" should contain:
|
|
235
|
+
"""
|
|
236
|
+
<h1>Page Title</h1>
|
|
237
|
+
"""
|
|
238
|
+
|
|
239
|
+
Scenario: `heading` helper with app.config.site_title option
|
|
240
|
+
Given a fixture app "title-app"
|
|
241
|
+
And a file named "config.rb" with:
|
|
242
|
+
"""
|
|
243
|
+
set :site_title, "TANSU"
|
|
244
|
+
activate :tansu
|
|
245
|
+
"""
|
|
246
|
+
When I run `middleman build --verbose`
|
|
247
|
+
Then the exit status should be 0
|
|
248
|
+
And the helper result "build/index.html" should contain:
|
|
249
|
+
"""
|
|
250
|
+
<h1>TANSU</h1>
|
|
251
|
+
"""
|
|
252
|
+
And the helper result "build/dir/index.html" should contain:
|
|
253
|
+
"""
|
|
254
|
+
<h1>dir/</h1>
|
|
255
|
+
"""
|
|
256
|
+
And the helper result "build/dir/sub_dir/page.html" should contain:
|
|
257
|
+
"""
|
|
258
|
+
<h1>Page Title</h1>
|
|
259
|
+
"""
|
|
260
|
+
|
|
261
|
+
Scenario: `heading` helper
|
|
262
|
+
Given a fixture app "title-has-title-app"
|
|
263
|
+
When I run `middleman build --verbose`
|
|
264
|
+
Then the exit status should be 0
|
|
265
|
+
And the helper result "build/index.html" should contain:
|
|
266
|
+
"""
|
|
267
|
+
<h1>Root Page</h1>
|
|
268
|
+
"""
|
|
269
|
+
And the helper result "build/dir/index.html" should contain:
|
|
270
|
+
"""
|
|
271
|
+
<h1>Dir/Index Title</h1>
|
|
272
|
+
"""
|
|
273
|
+
And the helper result "build/dir/sub_dir/page.html" should contain:
|
|
274
|
+
"""
|
|
275
|
+
<h1>dir/sub_dir/page</h1>
|
|
276
|
+
"""
|
|
277
|
+
Scenario: `index?` helper
|
|
278
|
+
Given a fixture app "index-app"
|
|
279
|
+
When I run `middleman build --verbose`
|
|
280
|
+
Then the exit status should be 0
|
|
281
|
+
And the helper result "build/index.html" should contain:
|
|
282
|
+
"""
|
|
283
|
+
<h2>Index</h2>
|
|
284
|
+
"""
|
|
285
|
+
And the helper result "build/dir/index.html" should contain:
|
|
286
|
+
"""
|
|
287
|
+
<h2>Index</h2>
|
|
288
|
+
"""
|
|
289
|
+
And the helper result "build/dir/page.html" should contain:
|
|
290
|
+
"""
|
|
291
|
+
<h2>Page</h2>
|
|
292
|
+
"""
|
|
@@ -9,6 +9,7 @@ Feature: Template CLI
|
|
|
9
9
|
| .gitignore |
|
|
10
10
|
| config.rb |
|
|
11
11
|
| source/sample.html.md |
|
|
12
|
+
| source/sitemap.xml.builder |
|
|
12
13
|
| source/layouts/layout.slim |
|
|
13
14
|
| source/stylesheets/all.css.sass |
|
|
14
15
|
| source/stylesheets/github-markdown.css |
|
|
@@ -22,6 +23,40 @@ Feature: Template CLI
|
|
|
22
23
|
And the following files should exist:
|
|
23
24
|
| build/index.html |
|
|
24
25
|
| build/sample.html |
|
|
26
|
+
| build/sitemap.xml |
|
|
25
27
|
| build/stylesheets/all.css |
|
|
26
28
|
And the file "build/index.html" should contain "middleman-tansu の簡単な紹介"
|
|
29
|
+
And the helper result "build/sample.html" should contain:
|
|
30
|
+
"""
|
|
31
|
+
<li class="current">middleman-tansu の簡単な紹介</li>
|
|
32
|
+
"""
|
|
33
|
+
And the helper result "build/sitemap.xml" should contain:
|
|
34
|
+
"""
|
|
35
|
+
<loc>http://localhost:4567/index.html</loc>
|
|
36
|
+
"""
|
|
27
37
|
|
|
38
|
+
Scenario: Build a new project with app.config.sitemap_url
|
|
39
|
+
Given I run `middleman init MY_PROJECT --template tansu`
|
|
40
|
+
And a file named "MY_PROJECT/config.rb" with:
|
|
41
|
+
"""
|
|
42
|
+
require "slim"
|
|
43
|
+
require "builder"
|
|
44
|
+
set :site_title, "Middleman-Tansu"
|
|
45
|
+
set :sitemap_url, "http://middlemanapp.com"
|
|
46
|
+
activate :tansu
|
|
47
|
+
set :markdown_engine, :redcarpet
|
|
48
|
+
set :markdown, :fenced_code_blocks => true, :smartypants => true, :with_toc_data => true
|
|
49
|
+
activate :syntax, :inline_theme => 'github'
|
|
50
|
+
"""
|
|
51
|
+
And I cd to "MY_PROJECT"
|
|
52
|
+
When I run `middleman build`
|
|
53
|
+
Then the exit status should be 0
|
|
54
|
+
And the following files should exist:
|
|
55
|
+
| build/index.html |
|
|
56
|
+
| build/sample.html |
|
|
57
|
+
| build/sitemap.xml |
|
|
58
|
+
| build/stylesheets/all.css |
|
|
59
|
+
And the helper result "build/sitemap.xml" should contain:
|
|
60
|
+
"""
|
|
61
|
+
<loc>http://middlemanapp.com/index.html</loc>
|
|
62
|
+
"""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
activate :tansu
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p>Proxy Page</p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
activate :tansu
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p>Proxy Page</p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
activate :tansu
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p>Proxy Page</p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
activate :tansu
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p>Proxy Page</p>
|
|
@@ -15,19 +15,63 @@ module Middleman
|
|
|
15
15
|
|
|
16
16
|
def breadcrumbs(klass = 'breadcrumbs', root = "Top")
|
|
17
17
|
li = []
|
|
18
|
+
root = page_title("/") || root
|
|
18
19
|
li.push("<li class=\"root\">#{link_to(root, "/")}</li>")
|
|
19
20
|
|
|
20
21
|
paths = path_list(current_resource.path)
|
|
21
22
|
paths.each do |path|
|
|
23
|
+
name = page_title(path[:path]) || path[:name]
|
|
22
24
|
if path == paths.last
|
|
23
|
-
li.push("<li class=\"current\">#{
|
|
25
|
+
li.push("<li class=\"current\">#{h(name)}</li>")
|
|
24
26
|
else
|
|
25
|
-
li.push("<li>#{link_to(
|
|
27
|
+
li.push("<li>#{link_to(name, path[:path])}</li>")
|
|
26
28
|
end
|
|
27
29
|
end
|
|
28
30
|
"<ul class=\"#{klass}\">\n#{li.join("\n")}\n</ul>"
|
|
29
31
|
end
|
|
30
32
|
|
|
33
|
+
def page_title(path)
|
|
34
|
+
if /\.html$/ !~ path
|
|
35
|
+
path = File.join(path, config.tansu[:default_document])
|
|
36
|
+
end
|
|
37
|
+
sitemap.find_resource_by_path(path).data.title
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def page_title_or_path(path)
|
|
41
|
+
page_title(path) || path.gsub(/(index)?\.html$/, "")
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def title(splitter = ' - ')
|
|
45
|
+
base_title = base_title()
|
|
46
|
+
page_title = page_title_or_path(current_resource.path)
|
|
47
|
+
|
|
48
|
+
if !page_title.empty?
|
|
49
|
+
"#{page_title}#{splitter}#{base_title}"
|
|
50
|
+
else
|
|
51
|
+
base_title
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def heading
|
|
56
|
+
base_title = base_title()
|
|
57
|
+
page_title = page_title_or_path(current_resource.path)
|
|
58
|
+
|
|
59
|
+
if !page_title.empty?
|
|
60
|
+
page_title
|
|
61
|
+
else
|
|
62
|
+
base_title
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def base_title
|
|
67
|
+
config[:site_title] || "Middleman-Tansu"
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def index?
|
|
71
|
+
regex = Regexp.new("#{config.tansu[:default_document]}$")
|
|
72
|
+
regex =~ current_resource.path || "/" == current_resource.path
|
|
73
|
+
end
|
|
74
|
+
|
|
31
75
|
def children_pages(key = :date, order_by = :asc)
|
|
32
76
|
dirs = []
|
|
33
77
|
pages = []
|
|
@@ -9,12 +9,7 @@ html
|
|
|
9
9
|
meta name="viewport" content="width=device-width,user-scalable=no,maximum-scale=1"
|
|
10
10
|
|
|
11
11
|
title
|
|
12
|
-
|
|
13
|
-
= config.site_title
|
|
14
|
-
- elsif data.page.title
|
|
15
|
-
= "#{data.page.title} - #{config.site_title}"
|
|
16
|
-
- else
|
|
17
|
-
= "#{current_resource.path.gsub(/index\.html$/, "")} - #{config.site_title}"
|
|
12
|
+
= title
|
|
18
13
|
|
|
19
14
|
== stylesheet_link_tag "all"
|
|
20
15
|
|
|
@@ -25,30 +20,25 @@ html
|
|
|
25
20
|
== breadcrumbs
|
|
26
21
|
|
|
27
22
|
h1
|
|
28
|
-
|
|
29
|
-
= config.site_title
|
|
30
|
-
- elsif data.page.title
|
|
31
|
-
= data.page.title
|
|
32
|
-
- else
|
|
33
|
-
= current_resource.path.gsub(/index\.html$/, "")
|
|
23
|
+
= heading
|
|
34
24
|
|
|
35
25
|
article.markdown-body
|
|
36
|
-
- if
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
26
|
+
- if !index?
|
|
27
|
+
div.metadata
|
|
28
|
+
- if data.page.author
|
|
29
|
+
dl
|
|
30
|
+
dt author
|
|
31
|
+
dd
|
|
32
|
+
- if data.page.author.instance_of?(Array)
|
|
33
|
+
= data.page.author.join(", ")
|
|
34
|
+
- else
|
|
35
|
+
= data.page.author
|
|
36
|
+
|
|
37
|
+
- if data.page.date
|
|
38
|
+
dl
|
|
39
|
+
dt date
|
|
40
|
+
dd
|
|
41
|
+
= data.page.date
|
|
52
42
|
|
|
53
43
|
== yield
|
|
54
44
|
|
|
@@ -4,7 +4,7 @@ author: yterajima
|
|
|
4
4
|
date: 2014-01-25 23:32:00 +0900
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
[middleman-tansu](https://github.com/yterajima/middleman-tansu) は Markdown
|
|
7
|
+
[middleman-tansu](https://github.com/yterajima/middleman-tansu) は Markdown ファイルをディレクトリを使って分類管理するために開発されているテンプレートです。例えるなら静的な wiki のようなものを目指しています。バラバラに管理される Markdown を tansu (箪笥) に入れてまとめて管理できるように工夫されています。
|
|
8
8
|
|
|
9
9
|
## middleman-tansu が提供する機能
|
|
10
10
|
|
|
@@ -59,17 +59,18 @@ __NOTICE__: `index.html` として出力されるファイルが存在する場
|
|
|
59
59
|
- children_pages
|
|
60
60
|
- 現在のページがあるディレクトリ中のファイル/ディレクトリ一覧
|
|
61
61
|
- この Helper は `index.html` になるファイルの中で使われます
|
|
62
|
-
|
|
62
|
+
- title
|
|
63
|
+
- title タグ中に表示すべき文字列を返す
|
|
64
|
+
- heading
|
|
65
|
+
- h1 タグ中に表示すべき文字列を返す
|
|
63
66
|
|
|
64
67
|
### 4.プロジェクトテンプレート
|
|
65
68
|
|
|
66
69
|
middleman-tansu は拡張機能と同時にプロジェクトテンプレートを提供しています。次のコマンドで初期化できます。
|
|
67
70
|
|
|
68
71
|
```sh
|
|
69
|
-
$ middleman
|
|
72
|
+
$ middleman init PROJECT_NAME --template tansu
|
|
70
73
|
```
|
|
71
74
|
|
|
72
75
|
このまま `$ middleman server` すると基本的な機能が用意されたテンプレートを使うことができます。このテンプレートは github-flavored-markdown を使用することができます。もちろんコードの構文ハイライトも対応します。
|
|
73
76
|
|
|
74
|
-
|
|
75
|
-
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: false
|
|
3
|
+
---
|
|
4
|
+
site_url = config[:sitemap_url] || "http://localhost:4567/"
|
|
5
|
+
xml.instruct!
|
|
6
|
+
xml.urlset 'xmlns' => "http://www.sitemaps.org/schemas/sitemap/0.9" do
|
|
7
|
+
sitemap.resources.select { |page| page.destination_path =~ /\.html/ }.each do |page|
|
|
8
|
+
xml.url do
|
|
9
|
+
xml.loc File.join(site_url, page.destination_path)
|
|
10
|
+
xml.lastmod Time.now.iso8601
|
|
11
|
+
xml.changefreq page.data.changefreq || "weekly"
|
|
12
|
+
xml.priority page.data.priority || "0.5"
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
@@ -29,13 +29,11 @@ module Middleman
|
|
|
29
29
|
empty_directory File.join(location, 'source', 'layouts')
|
|
30
30
|
|
|
31
31
|
copy_file 'source/sample.html.md', File.join(location, 'source/sample.html.md')
|
|
32
|
-
|
|
32
|
+
copy_file 'source/sitemap.xml.builder', File.join(location, 'source/sitemap.xml.builder')
|
|
33
33
|
copy_file 'source/layouts/layout.slim', File.join(location, 'source/layouts/layout.slim')
|
|
34
|
-
|
|
34
|
+
copy_file 'source/templates/index.html.slim', File.join(location, 'source/templates/index.html.slim')
|
|
35
35
|
copy_file 'source/stylesheets/all.css.sass', File.join(location, 'source', options[:css_dir], 'all.css.sass')
|
|
36
36
|
copy_file 'source/stylesheets/github-markdown.css', File.join(location, 'source', options[:css_dir], 'github-markdown.css')
|
|
37
|
-
|
|
38
|
-
copy_file 'source/templates/index.html.slim', File.join(location, 'source', 'templates', 'index.html.slim')
|
|
39
37
|
end
|
|
40
38
|
end
|
|
41
39
|
end
|
data/middleman-tansu.gemspec
CHANGED
|
@@ -21,12 +21,13 @@ Gem::Specification.new do |spec|
|
|
|
21
21
|
spec.required_ruby_version = '>= 1.9.3'
|
|
22
22
|
|
|
23
23
|
spec.add_runtime_dependency "middleman", "~>3.3"
|
|
24
|
+
spec.add_runtime_dependency "middleman-syntax", "~> 2.0"
|
|
25
|
+
spec.add_runtime_dependency "slim", "~> 3.0"
|
|
26
|
+
spec.add_runtime_dependency "redcarpet", "~> 3.2"
|
|
27
|
+
spec.add_runtime_dependency "builder", "~> 3.2"
|
|
24
28
|
|
|
25
29
|
spec.add_development_dependency "cucumber", "~> 1.3"
|
|
26
30
|
spec.add_development_dependency "aruba", "~> 0.6"
|
|
27
31
|
spec.add_development_dependency "bundler", "~> 1.5"
|
|
28
32
|
spec.add_development_dependency "rake", "~> 10"
|
|
29
|
-
spec.add_development_dependency "slim", "~> 3.0"
|
|
30
|
-
spec.add_development_dependency "redcarpet", "~> 3.2"
|
|
31
|
-
spec.add_development_dependency "middleman-syntax", "~> 2.0"
|
|
32
33
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: middleman-tansu
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yuya Terajima
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-01-
|
|
11
|
+
date: 2015-01-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: middleman
|
|
@@ -25,103 +25,117 @@ dependencies:
|
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '3.3'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
28
|
+
name: middleman-syntax
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
34
|
-
type: :
|
|
33
|
+
version: '2.0'
|
|
34
|
+
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
40
|
+
version: '2.0'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
42
|
+
name: slim
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '0
|
|
48
|
-
type: :
|
|
47
|
+
version: '3.0'
|
|
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: '3.0'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name:
|
|
56
|
+
name: redcarpet
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
59
|
- - "~>"
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '
|
|
62
|
-
type: :
|
|
61
|
+
version: '3.2'
|
|
62
|
+
type: :runtime
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
66
|
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '
|
|
68
|
+
version: '3.2'
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
|
-
name:
|
|
70
|
+
name: builder
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
72
72
|
requirements:
|
|
73
73
|
- - "~>"
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '
|
|
75
|
+
version: '3.2'
|
|
76
|
+
type: :runtime
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '3.2'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: cucumber
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '1.3'
|
|
76
90
|
type: :development
|
|
77
91
|
prerelease: false
|
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
93
|
requirements:
|
|
80
94
|
- - "~>"
|
|
81
95
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: '
|
|
96
|
+
version: '1.3'
|
|
83
97
|
- !ruby/object:Gem::Dependency
|
|
84
|
-
name:
|
|
98
|
+
name: aruba
|
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
|
86
100
|
requirements:
|
|
87
101
|
- - "~>"
|
|
88
102
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: '
|
|
103
|
+
version: '0.6'
|
|
90
104
|
type: :development
|
|
91
105
|
prerelease: false
|
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
107
|
requirements:
|
|
94
108
|
- - "~>"
|
|
95
109
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: '
|
|
110
|
+
version: '0.6'
|
|
97
111
|
- !ruby/object:Gem::Dependency
|
|
98
|
-
name:
|
|
112
|
+
name: bundler
|
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
|
100
114
|
requirements:
|
|
101
115
|
- - "~>"
|
|
102
116
|
- !ruby/object:Gem::Version
|
|
103
|
-
version: '
|
|
117
|
+
version: '1.5'
|
|
104
118
|
type: :development
|
|
105
119
|
prerelease: false
|
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
121
|
requirements:
|
|
108
122
|
- - "~>"
|
|
109
123
|
- !ruby/object:Gem::Version
|
|
110
|
-
version: '
|
|
124
|
+
version: '1.5'
|
|
111
125
|
- !ruby/object:Gem::Dependency
|
|
112
|
-
name:
|
|
126
|
+
name: rake
|
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
|
114
128
|
requirements:
|
|
115
129
|
- - "~>"
|
|
116
130
|
- !ruby/object:Gem::Version
|
|
117
|
-
version: '
|
|
131
|
+
version: '10'
|
|
118
132
|
type: :development
|
|
119
133
|
prerelease: false
|
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
135
|
requirements:
|
|
122
136
|
- - "~>"
|
|
123
137
|
- !ruby/object:Gem::Version
|
|
124
|
-
version: '
|
|
138
|
+
version: '10'
|
|
125
139
|
description: A Template of Middleman.
|
|
126
140
|
email:
|
|
127
141
|
- terra@e2esound.com
|
|
@@ -149,6 +163,15 @@ files:
|
|
|
149
163
|
- fixtures/breadcrumbs-app/source/layouts/layout.erb
|
|
150
164
|
- fixtures/breadcrumbs-app/source/stylesheets/all.css
|
|
151
165
|
- fixtures/breadcrumbs-app/source/templates/index.html.erb
|
|
166
|
+
- fixtures/breadcrumbs-has-title-app/config.rb
|
|
167
|
+
- fixtures/breadcrumbs-has-title-app/source/dir/index.html.erb
|
|
168
|
+
- fixtures/breadcrumbs-has-title-app/source/dir/sub_dir/page.md
|
|
169
|
+
- fixtures/breadcrumbs-has-title-app/source/images/.gitkeep
|
|
170
|
+
- fixtures/breadcrumbs-has-title-app/source/index.html.erb
|
|
171
|
+
- fixtures/breadcrumbs-has-title-app/source/javascripts/.gitkeep
|
|
172
|
+
- fixtures/breadcrumbs-has-title-app/source/layouts/layout.erb
|
|
173
|
+
- fixtures/breadcrumbs-has-title-app/source/stylesheets/all.css
|
|
174
|
+
- fixtures/breadcrumbs-has-title-app/source/templates/index.html.erb
|
|
152
175
|
- fixtures/breadcrumbs-params-app/config.rb
|
|
153
176
|
- fixtures/breadcrumbs-params-app/source/dir/page.md
|
|
154
177
|
- fixtures/breadcrumbs-params-app/source/images/.gitkeep
|
|
@@ -203,6 +226,13 @@ files:
|
|
|
203
226
|
- fixtures/drawer-app/source/stylesheets/all.css
|
|
204
227
|
- fixtures/drawer-app/source/templates/index.html.erb
|
|
205
228
|
- fixtures/empty-app/source/.gitkeep
|
|
229
|
+
- fixtures/index-app/config.rb
|
|
230
|
+
- fixtures/index-app/source/dir/page.md
|
|
231
|
+
- fixtures/index-app/source/images/.gitkeep
|
|
232
|
+
- fixtures/index-app/source/javascripts/.gitkeep
|
|
233
|
+
- fixtures/index-app/source/layouts/layout.erb
|
|
234
|
+
- fixtures/index-app/source/stylesheets/all.css
|
|
235
|
+
- fixtures/index-app/source/templates/index.html.erb
|
|
206
236
|
- fixtures/path-list-app/config.rb
|
|
207
237
|
- fixtures/path-list-app/source/images/.gitkeep
|
|
208
238
|
- fixtures/path-list-app/source/javascripts/.gitkeep
|
|
@@ -210,6 +240,22 @@ files:
|
|
|
210
240
|
- fixtures/path-list-app/source/page/list/.gitkeep
|
|
211
241
|
- fixtures/path-list-app/source/stylesheets/all.css
|
|
212
242
|
- fixtures/path-list-app/source/templates/index.html.erb
|
|
243
|
+
- fixtures/title-app/config.rb
|
|
244
|
+
- fixtures/title-app/source/dir/sub_dir/page.md
|
|
245
|
+
- fixtures/title-app/source/images/.gitkeep
|
|
246
|
+
- fixtures/title-app/source/javascripts/.gitkeep
|
|
247
|
+
- fixtures/title-app/source/layouts/layout.erb
|
|
248
|
+
- fixtures/title-app/source/stylesheets/all.css
|
|
249
|
+
- fixtures/title-app/source/templates/index.html.erb
|
|
250
|
+
- fixtures/title-has-title-app/config.rb
|
|
251
|
+
- fixtures/title-has-title-app/source/dir/index.html.erb
|
|
252
|
+
- fixtures/title-has-title-app/source/dir/sub_dir/page.md
|
|
253
|
+
- fixtures/title-has-title-app/source/images/.gitkeep
|
|
254
|
+
- fixtures/title-has-title-app/source/index.html.erb
|
|
255
|
+
- fixtures/title-has-title-app/source/javascripts/.gitkeep
|
|
256
|
+
- fixtures/title-has-title-app/source/layouts/layout.erb
|
|
257
|
+
- fixtures/title-has-title-app/source/stylesheets/all.css
|
|
258
|
+
- fixtures/title-has-title-app/source/templates/index.html.erb
|
|
213
259
|
- lib/middleman-tansu.rb
|
|
214
260
|
- lib/middleman-tansu/command.rb
|
|
215
261
|
- lib/middleman-tansu/drawer.rb
|
|
@@ -220,6 +266,7 @@ files:
|
|
|
220
266
|
- lib/middleman-tansu/template/shared/config.tt
|
|
221
267
|
- lib/middleman-tansu/template/source/layouts/layout.slim
|
|
222
268
|
- lib/middleman-tansu/template/source/sample.html.md
|
|
269
|
+
- lib/middleman-tansu/template/source/sitemap.xml.builder
|
|
223
270
|
- lib/middleman-tansu/template/source/stylesheets/all.css.sass
|
|
224
271
|
- lib/middleman-tansu/template/source/stylesheets/github-markdown.css
|
|
225
272
|
- lib/middleman-tansu/template/source/templates/index.html.slim
|