nanoc 4.13.5 → 4.14.1
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 +17 -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/erb.rb +19 -3
 - data/lib/nanoc/filters/less.rb +2 -4
 - data/lib/nanoc/filters/sass.rb +2 -0
 - data/lib/nanoc/helpers/capturing.rb +1 -2
 - 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: 923381ebbdbafb7b60b0aa640c118e6983a59113b9e50836459684a31cbb101f
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 7abde9f5c334c6a0a267d2ce5740f77c7f1c81cb53b0198ba123f944ee043352
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: e55e39e90ed7b02a65d3beb3c4b5e4d6ad5eb5698a5535411406d405759665f7ec452556b3e074f37303ac74f1b4f56e5951ad6ef802961bb969cacf8492f12e
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 24d045ab848d41bcbba99dcbea0fc140659a2b938d6bea57c1c60267bc4ef31a86c827b6331fc0bd34c1eed5f8747bb25edffc801b9ac980b1a5661dbd7caf1e
         
     | 
    
        data/NEWS.md
    CHANGED
    
    | 
         @@ -1,5 +1,22 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # Nanoc news
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            ## 4.14.1 (2025-10-30)
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Fixes:
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            - Fixed issue which would cause timings reported `--verbose --verbose` to be inaccurate (#1760, #1761)
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            Enhancements:
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            - Improved ERB filter performance through memoization (#1762)
         
     | 
| 
      
 12 
     | 
    
         
            +
            - Improved performance (#1759, #1758, #1761)
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            ## 4.14.0 (2025-10-18)
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            Features:
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            - Added support for TOML in frontmatter (with `+++` separators rather than `---`) and in the configuration file (`nanoc.toml`) (#1757)
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
       3 
20 
     | 
    
         
             
            ## 4.13.5 (2025-04-21)
         
     | 
| 
       4 
21 
     | 
    
         | 
| 
       5 
22 
     | 
    
         
             
            Fixes:
         
     | 
    
        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/erb.rb
    CHANGED
    
    | 
         @@ -7,6 +7,12 @@ module Nanoc::Filters 
     | 
|
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
                requires 'erb'
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
      
 10 
     | 
    
         
            +
                class << self
         
     | 
| 
      
 11 
     | 
    
         
            +
                  attr_accessor :_erb_cache
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                self._erb_cache = {}
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
       10 
16 
     | 
    
         
             
                # Runs the content through [ERB](http://ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html).
         
     | 
| 
       11 
17 
     | 
    
         
             
                #
         
     | 
| 
       12 
18 
     | 
    
         
             
                # @param [String] content The content to filter
         
     | 
| 
         @@ -27,9 +33,19 @@ module Nanoc::Filters 
     | 
|
| 
       27 
33 
     | 
    
         | 
| 
       28 
34 
     | 
    
         
             
                  # Get result
         
     | 
| 
       29 
35 
     | 
    
         
             
                  trim_mode = params[:trim_mode]
         
     | 
| 
       30 
     | 
    
         
            -
                   
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
      
 36 
     | 
    
         
            +
                  erb_for(content, trim_mode:).result(assigns_binding)
         
     | 
| 
      
 37 
     | 
    
         
            +
                end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                private
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                def erb_for(content, trim_mode:)
         
     | 
| 
      
 42 
     | 
    
         
            +
                  cache_key = [content, trim_mode]
         
     | 
| 
      
 43 
     | 
    
         
            +
                  self.class._erb_cache.fetch(cache_key) do
         
     | 
| 
      
 44 
     | 
    
         
            +
                    erb = ::ERB.new(content, trim_mode:)
         
     | 
| 
      
 45 
     | 
    
         
            +
                    erb.filename = filename
         
     | 
| 
      
 46 
     | 
    
         
            +
                    self.class._erb_cache[cache_key] = erb
         
     | 
| 
      
 47 
     | 
    
         
            +
                    erb
         
     | 
| 
      
 48 
     | 
    
         
            +
                  end
         
     | 
| 
       33 
49 
     | 
    
         
             
                end
         
     | 
| 
       34 
50 
     | 
    
         
             
              end
         
     | 
| 
       35 
51 
     | 
    
         
             
            end
         
     | 
    
        data/lib/nanoc/filters/less.rb
    CHANGED
    
    | 
         @@ -21,10 +21,8 @@ module Nanoc::Filters 
     | 
|
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
                  # Add filename to load path
         
     | 
| 
       23 
23 
     | 
    
         
             
                  paths = [File.dirname(@item[:content_filename])]
         
     | 
| 
       24 
     | 
    
         
            -
                   
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                    parser.parse(content).to_css(params)
         
     | 
| 
       27 
     | 
    
         
            -
                  end
         
     | 
| 
      
 24 
     | 
    
         
            +
                  parser = ::Less::Parser.new(paths:)
         
     | 
| 
      
 25 
     | 
    
         
            +
                  parser.parse(content).to_css(params)
         
     | 
| 
       28 
26 
     | 
    
         
             
                end
         
     | 
| 
       29 
27 
     | 
    
         | 
| 
       30 
28 
     | 
    
         
             
                def imported_filenames_from(content)
         
     | 
    
        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.1
         
     | 
| 
       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.1
         
     | 
| 
       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.1
         
     | 
| 
       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.1
         
     | 
| 
       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.1
         
     | 
| 
       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.1/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: []
         
     |