nanoc3 3.0.5 → 3.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS.rdoc +7 -0
- data/lib/nanoc3.rb +1 -1
- data/lib/nanoc3/cli/commands/create_site.rb +1 -0
- data/lib/nanoc3/data_sources/filesystem.rb +6 -2
- data/lib/nanoc3/data_sources/filesystem_combined.rb +17 -15
- data/lib/nanoc3/data_sources/filesystem_compact.rb +6 -2
- data/lib/nanoc3/filters/relativize_paths.rb +2 -2
- metadata +2 -2
data/NEWS.rdoc
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
= nanoc News
|
2
2
|
|
3
|
+
== 3.0.6
|
4
|
+
|
5
|
+
* Error checking in `filesystem_combined` has been improved [Brian Candler]
|
6
|
+
* Generated HTML files now have a default encoding of UTF-8
|
7
|
+
* Periods in identifiers for layouts now behave correctly
|
8
|
+
* The `relativize_paths` filter now correctly handles “/” [Eric Sunshine]
|
9
|
+
|
3
10
|
== 3.0.5
|
4
11
|
|
5
12
|
* Restored pre-3.0.3 behaviour of periods in identifiers. By default, a file
|
data/lib/nanoc3.rb
CHANGED
@@ -126,6 +126,7 @@ EOS
|
|
126
126
|
<html>
|
127
127
|
<head>
|
128
128
|
<title>A Brand New nanoc Site - <%= @item[:title] %></title>
|
129
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
129
130
|
<link rel="stylesheet" type="text/css" href="/style.css" media="screen">
|
130
131
|
</head>
|
131
132
|
<body>
|
@@ -96,7 +96,7 @@ module Nanoc3::DataSources
|
|
96
96
|
attributes = meta.merge(:file => Nanoc3::Extra::FileProxy.new(content_filename))
|
97
97
|
|
98
98
|
# Get identifier
|
99
|
-
identifier = meta_filename
|
99
|
+
identifier = meta_filename_to_identifier(meta_filename, /^content/)
|
100
100
|
|
101
101
|
# Get modification times
|
102
102
|
meta_mtime = File.stat(meta_filename).mtime
|
@@ -118,7 +118,7 @@ module Nanoc3::DataSources
|
|
118
118
|
attributes = YAML.load_file(meta_filename) || {}
|
119
119
|
|
120
120
|
# Get identifier
|
121
|
-
identifier = meta_filename
|
121
|
+
identifier = meta_filename_to_identifier(meta_filename, /^layouts/)
|
122
122
|
|
123
123
|
# Get modification times
|
124
124
|
meta_mtime = File.stat(meta_filename).mtime
|
@@ -233,6 +233,10 @@ module Nanoc3::DataSources
|
|
233
233
|
filenames.first
|
234
234
|
end
|
235
235
|
|
236
|
+
def meta_filename_to_identifier(meta_filename, regex)
|
237
|
+
meta_filename.sub(regex, '').sub(/[^\/]+\.yaml$/, '')
|
238
|
+
end
|
239
|
+
|
236
240
|
end
|
237
241
|
|
238
242
|
end
|
@@ -95,15 +95,7 @@ module Nanoc3::DataSources
|
|
95
95
|
attributes = meta.merge(:file => Nanoc3::Extra::FileProxy.new(filename))
|
96
96
|
|
97
97
|
# Get actual identifier
|
98
|
-
identifier = filename
|
99
|
-
if filename =~ /\/index\.[^\/]+$/
|
100
|
-
regex = ((@config && @config[:allow_periods_in_identifiers]) ? /index\.[^\/\.]+$/ : /index\.[^\/]+$/)
|
101
|
-
identifier.sub!(regex, '')
|
102
|
-
else
|
103
|
-
regex = ((@config && @config[:allow_periods_in_identifiers]) ? /\.[^\/\.]+$/ : /\.[^\/]+$/)
|
104
|
-
identifier.sub!(regex, '')
|
105
|
-
end
|
106
|
-
identifier << '/'
|
98
|
+
identifier = filename_to_identifier(filename, /^content/)
|
107
99
|
|
108
100
|
# Get mtime
|
109
101
|
mtime = File.stat(filename).mtime
|
@@ -119,11 +111,7 @@ module Nanoc3::DataSources
|
|
119
111
|
meta, content = *parse_file(filename, 'layout')
|
120
112
|
|
121
113
|
# Get actual identifier
|
122
|
-
|
123
|
-
identifier = filename.sub(/^layouts/, '').sub(/index\.[^\/\.]+$/, '') + '/'
|
124
|
-
else
|
125
|
-
identifier = filename.sub(/^layouts/, '').sub(/\.[^\/\.]+$/, '') + '/'
|
126
|
-
end
|
114
|
+
identifier = filename_to_identifier(filename, /^layouts/)
|
127
115
|
|
128
116
|
# Get mtime
|
129
117
|
mtime = File.stat(filename).mtime
|
@@ -194,7 +182,7 @@ module Nanoc3::DataSources
|
|
194
182
|
def parse_file(filename, kind)
|
195
183
|
# Split file
|
196
184
|
pieces = File.read(filename).split(/^(-{5}|-{3})/).compact
|
197
|
-
if pieces.size <
|
185
|
+
if pieces.size < 4
|
198
186
|
raise RuntimeError.new(
|
199
187
|
"The file '#{filename}' does not seem to be a nanoc #{kind}"
|
200
188
|
)
|
@@ -207,6 +195,20 @@ module Nanoc3::DataSources
|
|
207
195
|
[ meta, content ]
|
208
196
|
end
|
209
197
|
|
198
|
+
def filename_to_identifier(filename, regex)
|
199
|
+
identifier = filename.sub(regex, '')
|
200
|
+
if filename =~ /\/index\.[^\/]+$/
|
201
|
+
regex = ((@config && @config[:allow_periods_in_identifiers]) ? /index\.[^\/\.]+$/ : /index\.[^\/]+$/)
|
202
|
+
identifier.sub!(regex, '')
|
203
|
+
else
|
204
|
+
regex = ((@config && @config[:allow_periods_in_identifiers]) ? /\.[^\/\.]+$/ : /\.[^\/]+$/)
|
205
|
+
identifier.sub!(regex, '')
|
206
|
+
end
|
207
|
+
identifier << '/'
|
208
|
+
|
209
|
+
identifier
|
210
|
+
end
|
211
|
+
|
210
212
|
end
|
211
213
|
|
212
214
|
end
|
@@ -134,7 +134,7 @@ module Nanoc3::DataSources
|
|
134
134
|
attributes = YAML.load_file(meta_filename) || {}
|
135
135
|
|
136
136
|
# Get identifier
|
137
|
-
identifier = identifier_for_meta_filename(meta_filename.sub(/^layouts
|
137
|
+
identifier = identifier_for_meta_filename(meta_filename.sub(/^layouts/, ''))
|
138
138
|
|
139
139
|
# Get modification times
|
140
140
|
meta_mtime = File.stat(meta_filename).mtime
|
@@ -202,7 +202,11 @@ module Nanoc3::DataSources
|
|
202
202
|
def identifier_for_meta_filename(meta_filename)
|
203
203
|
# Split into components
|
204
204
|
components = meta_filename.gsub(%r{(^/|/$)}, '').split('/')
|
205
|
-
|
205
|
+
if @config && @config[:allow_periods_in_identifiers]
|
206
|
+
components[-1].sub!(/\.yaml$/, '')
|
207
|
+
else
|
208
|
+
components[-1].sub!(/\.[^\/\.]+$/, '')
|
209
|
+
end
|
206
210
|
|
207
211
|
if components[-1] == 'index'
|
208
212
|
components[0..-2].join('/').cleaned_identifier
|
@@ -13,11 +13,11 @@ module Nanoc3::Filters
|
|
13
13
|
# Filter
|
14
14
|
case params[:type]
|
15
15
|
when :html
|
16
|
-
content.gsub(/(<[^>]+\s+(src|href))=(['"]?)(
|
16
|
+
content.gsub(/(<[^>]+\s+(src|href))=(['"]?)(\/.*?)\3([ >])/) do
|
17
17
|
$1 + '=' + $3 + relative_path_to($4) + $3 + $5
|
18
18
|
end
|
19
19
|
when :css
|
20
|
-
content.gsub(/url\((['"]?)(
|
20
|
+
content.gsub(/url\((['"]?)(\/.*?)\1\)/) do
|
21
21
|
'url(' + $1 + relative_path_to($2) + $1 + ')'
|
22
22
|
end
|
23
23
|
else
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanoc3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Defreyne
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-18 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|