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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87183d6afcb52a7a0772f5859b5fa1899122a6e8297f4e169b4b544e9ec6211d
4
- data.tar.gz: f99716556f847c2e500bca8915446d1dbf470e63bca5229b94402b20b2563dd5
3
+ metadata.gz: 38ddec3156d6f59a3bb90d3507e79072fccba6a3bcbb29f801929b139601311e
4
+ data.tar.gz: fddbca13e0b5f6d0dc341897763f1c5ae833dedf3f59766133b6051a2c9c6696
5
5
  SHA512:
6
- metadata.gz: a7589f3ed5f56ac6655ed563387a63138d9f548bb49ea9dcd873a69b8362fc18650ab0e2c2367c842236112c5f11ee3b8b66fafc324b275c1f2a3a909766332f
7
- data.tar.gz: 981703fd7707a83303d9570e77265945522c4d75d02a2a7c41e4fe24643964f7e6dbc430a598d64dad4f945db92a11dc25bee69a3e6abd20c6a47103ea14643f
6
+ metadata.gz: 2e021cc1d5dea573bb62515faae428b74d91a402c2f42e404a0ae026cc7736e4c18ccf86d07bd8c8f6bcb8722b7f188ead9388c81d33e3322f21cc6138eb7bcb
7
+ data.tar.gz: 011630401f4a40142cba99cbed78b1b18daf0f61ae83e659b0c3e16ca3d3a6d5c05786bcf4807ed73a9979c0cb65239f06c776eb285adbb3131b11648e0763e5
data/NEWS.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Nanoc news
2
2
 
3
+ ## 4.14.0 (2025-10-18)
4
+
5
+ Features:
6
+
7
+ - Added support for TOML in frontmatter (with `+++` separators rather than `---`) and in the configuration file (`nanoc.toml`) (#1757)
8
+
3
9
  ## 4.13.5 (2025-04-21)
4
10
 
5
11
  Fixes:
data/bin/nanoc CHANGED
@@ -2,13 +2,6 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require 'nanoc'
5
-
6
- begin
7
- require 'nanoc-rust'
8
- NanocRust.activate!
9
- rescue LoadError
10
- end
11
-
12
5
  require 'nanoc/orig_cli'
13
6
 
14
7
  if File.file?('Gemfile') && !defined?(Bundler)
@@ -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
- unless /\A#{SEPARATOR}\s*$/.match?(data)
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
- begin
63
- meta = Nanoc::Core::YamlLoader.load(data) || {}
64
- rescue => e
65
- raise Errors::UnparseableMetadata.new(filename, e)
66
- end
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)
@@ -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
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Nanoc
4
4
  # The current Nanoc version.
5
- VERSION = '4.13.5'
5
+ VERSION = '4.14.0'
6
6
  end
data/lib/nanoc.rb CHANGED
@@ -20,7 +20,6 @@ require 'net/http'
20
20
  require 'net/https'
21
21
  require 'open3'
22
22
  require 'pathname'
23
- require 'set'
24
23
  require 'singleton'
25
24
  require 'stringio'
26
25
  require 'tempfile'
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.13.5
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.13.5
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.13.5
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.13.5
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.13.5
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.13.5/nanoc
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.1'
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.6.7
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: []