nanoc 4.13.5 → 4.14.0
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/NEWS.md +6 -0
- data/bin/nanoc +0 -7
- data/lib/nanoc/data_sources/filesystem/parser.rb +21 -10
- data/lib/nanoc/data_sources/filesystem.rb +1 -0
- data/lib/nanoc/filters/sass.rb +2 -0
- data/lib/nanoc/version.rb +1 -1
- data/lib/nanoc.rb +0 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38ddec3156d6f59a3bb90d3507e79072fccba6a3bcbb29f801929b139601311e
|
4
|
+
data.tar.gz: fddbca13e0b5f6d0dc341897763f1c5ae833dedf3f59766133b6051a2c9c6696
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e021cc1d5dea573bb62515faae428b74d91a402c2f42e404a0ae026cc7736e4c18ccf86d07bd8c8f6bcb8722b7f188ead9388c81d33e3322f21cc6138eb7bcb
|
7
|
+
data.tar.gz: 011630401f4a40142cba99cbed78b1b18daf0f61ae83e659b0c3e16ca3d3a6d5c05786bcf4807ed73a9979c0cb65239f06c776eb285adbb3131b11648e0763e5
|
data/NEWS.md
CHANGED
data/bin/nanoc
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# @api private
|
4
4
|
class Nanoc::DataSources::Filesystem
|
5
5
|
class Parser
|
6
|
-
SEPARATOR = /(-{5}|-{3})/.source
|
6
|
+
SEPARATOR = /(-{5}|-{3}|\+{3})/.source
|
7
7
|
|
8
8
|
class ParseResult
|
9
9
|
attr_reader :content
|
@@ -34,7 +34,7 @@ class Nanoc::DataSources::Filesystem
|
|
34
34
|
def parse_with_separate_meta_filename(content_filename, meta_filename)
|
35
35
|
content = content_filename ? Tools.read_file(content_filename, config: @config) : ''
|
36
36
|
meta_raw = Tools.read_file(meta_filename, config: @config)
|
37
|
-
meta = parse_metadata(meta_raw, meta_filename)
|
37
|
+
meta = parse_metadata(meta_raw, meta_filename, :yaml)
|
38
38
|
ParseResult.new(content:, attributes: meta, attributes_data: meta_raw)
|
39
39
|
end
|
40
40
|
|
@@ -42,28 +42,39 @@ class Nanoc::DataSources::Filesystem
|
|
42
42
|
def parse_with_frontmatter(content_filename)
|
43
43
|
data = Tools.read_file(content_filename, config: @config)
|
44
44
|
|
45
|
-
|
45
|
+
separator = /\A#{SEPARATOR}\s*$/.match(data)
|
46
|
+
unless separator
|
46
47
|
return ParseResult.new(content: data, attributes: {}, attributes_data: '')
|
47
48
|
end
|
48
49
|
|
50
|
+
frontmatter_language =
|
51
|
+
case separator[1]
|
52
|
+
when '+++'
|
53
|
+
:toml
|
54
|
+
else
|
55
|
+
:yaml
|
56
|
+
end
|
57
|
+
|
49
58
|
pieces = data.split(/^#{SEPARATOR}[ \t]*\r?\n?/, 3)
|
50
59
|
if pieces.size < 4
|
51
60
|
raise Errors::InvalidFormat.new(content_filename)
|
52
61
|
end
|
53
62
|
|
54
|
-
meta = parse_metadata(pieces[2], content_filename)
|
63
|
+
meta = parse_metadata(pieces[2], content_filename, frontmatter_language)
|
55
64
|
content = pieces[4].sub(/\A\n/, '')
|
56
65
|
|
57
66
|
ParseResult.new(content:, attributes: meta, attributes_data: pieces[2])
|
58
67
|
end
|
59
68
|
|
60
69
|
# @return [Hash]
|
61
|
-
def parse_metadata(data, filename)
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
70
|
+
def parse_metadata(data, filename, frontmatter_language)
|
71
|
+
loader = Nanoc::Core::StructuredDataLoader.for_language(frontmatter_language)
|
72
|
+
meta =
|
73
|
+
begin
|
74
|
+
loader.load(data) || {}
|
75
|
+
rescue => e
|
76
|
+
raise Errors::UnparseableMetadata.new(filename, e)
|
77
|
+
end
|
67
78
|
|
68
79
|
verify_meta(meta, filename)
|
69
80
|
|
@@ -152,6 +152,7 @@ module Nanoc::DataSources
|
|
152
152
|
is_binary = content_filename && !@site_config[:text_extensions].include?(File.extname(content_filename)[1..])
|
153
153
|
|
154
154
|
if is_binary && klass == Nanoc::Core::Item
|
155
|
+
# NOTE: TOML support is explicitly not added here, in case there are existing sites with `.toml` files.
|
155
156
|
meta = (meta_filename && Nanoc::Core::YamlLoader.load_file(meta_filename)) || {}
|
156
157
|
|
157
158
|
ProtoDocument.new(is_binary: true, filename: content_filename, attributes: meta)
|
data/lib/nanoc/filters/sass.rb
CHANGED
@@ -51,6 +51,7 @@ module Nanoc::Filters
|
|
51
51
|
identifier :sass
|
52
52
|
|
53
53
|
include SassCommon
|
54
|
+
|
54
55
|
requires(*SassCommon::REQUIRES)
|
55
56
|
|
56
57
|
def run(content, params = {})
|
@@ -62,6 +63,7 @@ module Nanoc::Filters
|
|
62
63
|
identifier :sass_sourcemap
|
63
64
|
|
64
65
|
include SassCommon
|
66
|
+
|
65
67
|
requires(*SassCommon::REQUIRES)
|
66
68
|
|
67
69
|
def run(content, params = {})
|
data/lib/nanoc/version.rb
CHANGED
data/lib/nanoc.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Defreyne
|
@@ -49,28 +49,28 @@ dependencies:
|
|
49
49
|
requirements:
|
50
50
|
- - '='
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: 4.
|
52
|
+
version: 4.14.0
|
53
53
|
type: :runtime
|
54
54
|
prerelease: false
|
55
55
|
version_requirements: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
57
|
- - '='
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: 4.
|
59
|
+
version: 4.14.0
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: nanoc-core
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
64
|
- - '='
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: 4.
|
66
|
+
version: 4.14.0
|
67
67
|
type: :runtime
|
68
68
|
prerelease: false
|
69
69
|
version_requirements: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
71
|
- - '='
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
version: 4.
|
73
|
+
version: 4.14.0
|
74
74
|
- !ruby/object:Gem::Dependency
|
75
75
|
name: nanoc-deploying
|
76
76
|
requirement: !ruby/object:Gem::Requirement
|
@@ -218,7 +218,7 @@ licenses:
|
|
218
218
|
- MIT
|
219
219
|
metadata:
|
220
220
|
rubygems_mfa_required: 'true'
|
221
|
-
source_code_uri: https://github.com/nanoc/nanoc/tree/4.
|
221
|
+
source_code_uri: https://github.com/nanoc/nanoc/tree/4.14.0/nanoc
|
222
222
|
rdoc_options: []
|
223
223
|
require_paths:
|
224
224
|
- lib
|
@@ -226,14 +226,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
226
226
|
requirements:
|
227
227
|
- - ">="
|
228
228
|
- !ruby/object:Gem::Version
|
229
|
-
version: '3.
|
229
|
+
version: '3.2'
|
230
230
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
231
231
|
requirements:
|
232
232
|
- - ">="
|
233
233
|
- !ruby/object:Gem::Version
|
234
234
|
version: '0'
|
235
235
|
requirements: []
|
236
|
-
rubygems_version: 3.
|
236
|
+
rubygems_version: 3.7.2
|
237
237
|
specification_version: 4
|
238
238
|
summary: A static-site generator with a focus on flexibility.
|
239
239
|
test_files: []
|