bridgetown-core 2.0.0.beta5 → 2.0.0.beta6
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/lib/bridgetown-core/collection.rb +4 -3
- data/lib/bridgetown-core/commands/build.rb +1 -1
- data/lib/bridgetown-core/commands/console.rb +1 -1
- data/lib/bridgetown-core/commands/new.rb +1 -1
- data/lib/bridgetown-core/component.rb +8 -3
- data/lib/bridgetown-core/converters/markdown/kramdown_parser.rb +2 -0
- data/lib/bridgetown-core/helpers.rb +2 -3
- data/lib/bridgetown-core/log_adapter.rb +1 -1
- data/lib/bridgetown-core/model/base.rb +1 -5
- data/lib/bridgetown-core/ruby_template_view.rb +1 -1
- data/lib/bridgetown-core/signals.rb +1 -4
- data/lib/bridgetown-core/static_file.rb +2 -1
- data/lib/site_template/config/initializers.rb +2 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d84ce34a5f59d6f344056c29003ebaca94ae161ad2ac6b0e65c431e55a83c85
|
4
|
+
data.tar.gz: f09f1457b4a8afe31f15822ce0a453a4cbd049f30dc62cec82871f1d310bf43d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b49a0456bcb39c02a6ca661f16ce30f693845d0460f30a00971785962d23402de1c3c96aa03c07dbf7c15dc9a3ddcb6fab3ccb2638a7e8226cd9ccf8ad1a7ce
|
7
|
+
data.tar.gz: ce6c40abf5657a8c290899765384089793e5c01c54cb1122183d0523585c50ac4d9df422ac24e9cce04ad23f40107baaf255e2b84176752d19d4205316aa85ce
|
@@ -325,12 +325,13 @@ module Bridgetown
|
|
325
325
|
alias_method :add_model_resource, :add_resource_from_model
|
326
326
|
|
327
327
|
def sort_resources!
|
328
|
-
|
328
|
+
sort_by_value = metadata["sort_by"]
|
329
|
+
if sort_by_value.is_a?(String) || sort_by_value.is_a?(Symbol)
|
329
330
|
sort_resources_by_key!
|
330
331
|
else
|
331
332
|
resources.sort!
|
332
333
|
end
|
333
|
-
resources.reverse! if metadata.sort_direction == "descending"
|
334
|
+
resources.reverse! if metadata.sort_direction.to_s == "descending"
|
334
335
|
end
|
335
336
|
|
336
337
|
private
|
@@ -342,7 +343,7 @@ module Bridgetown
|
|
342
343
|
# A custom sort function based on Schwartzian transform
|
343
344
|
# Refer https://byparker.com/blog/2017/schwartzian-transform-faster-sorting/ for details
|
344
345
|
def sort_resources_by_key!
|
345
|
-
meta_key = metadata["sort_by"]
|
346
|
+
meta_key = metadata["sort_by"].to_s
|
346
347
|
# Modify array to cache property along with the Resource instance
|
347
348
|
resources.map! { |r| [r.data[meta_key], r] }.sort! do |apples, olives|
|
348
349
|
order = determine_sort_order(meta_key, apples, olives)
|
@@ -29,7 +29,7 @@ module Bridgetown
|
|
29
29
|
# Build your bridgetown site
|
30
30
|
# Continuously watch if `watch` is set to true in the config.
|
31
31
|
def build
|
32
|
-
Bridgetown.logger.adjust_verbosity(options)
|
32
|
+
Bridgetown.logger.adjust_verbosity(**options)
|
33
33
|
|
34
34
|
# @type [Bridgetown::Configuration]
|
35
35
|
config_options = configuration_with_overrides(
|
@@ -71,7 +71,7 @@ module Bridgetown
|
|
71
71
|
end
|
72
72
|
require "amazing_print" unless options[:"bypass-ap"]
|
73
73
|
|
74
|
-
Bridgetown.logger.adjust_verbosity(options)
|
74
|
+
Bridgetown.logger.adjust_verbosity(**options)
|
75
75
|
|
76
76
|
Bridgetown.logger.info "Starting:", "Bridgetown v#{Bridgetown::VERSION.magenta} " \
|
77
77
|
"(codename \"#{Bridgetown::CODE_NAME.yellow}\") " \
|
@@ -174,7 +174,7 @@ module Bridgetown
|
|
174
174
|
# unless the user opts to skip 'bundle install'.
|
175
175
|
# rubocop:todo Metrics/CyclomaticComplexity
|
176
176
|
# rubocop:disable Metrics/PerceivedComplexity
|
177
|
-
def after_install(path, cli_path, options
|
177
|
+
def after_install(path, cli_path, options)
|
178
178
|
git_init path
|
179
179
|
|
180
180
|
@skipped_bundle = true # is set to false if bundle install worked
|
@@ -158,10 +158,15 @@ module Bridgetown
|
|
158
158
|
|
159
159
|
# Provide a render helper for evaluation within the component context.
|
160
160
|
#
|
161
|
-
# @param item [Object] a component supporting `render_in
|
162
|
-
# @param options [Hash] passed to the `partial` helper if needed
|
161
|
+
# @param item [Object] a component supporting `render_in`, a Streamlined proc, or a partial name
|
162
|
+
# @param options [Hash] keyword arguments passed to the `partial` helper if needed
|
163
163
|
# @return [String]
|
164
|
-
def render(item
|
164
|
+
def render(item = nil, **options, &block) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
165
|
+
return @_rbout if !block && options.empty? && item.nil?
|
166
|
+
|
167
|
+
# Defer to Streamline's rendering logic in this case
|
168
|
+
return super if item.is_a?(Proc) || (block && item.nil?)
|
169
|
+
|
165
170
|
if item.respond_to?(:render_in)
|
166
171
|
result = ""
|
167
172
|
capture do # this ensures no leaky interactions between BT<=>VC blocks
|
@@ -45,6 +45,8 @@ module Kramdown
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def initialize(source, options = {}) # rubocop:disable Lint/MissingSuper
|
48
|
+
# NOTE: keep `options = {}` instead of the newer `**options` for Kramdown compatibility
|
49
|
+
|
48
50
|
BridgetownDocument.setup(options)
|
49
51
|
|
50
52
|
@options = BridgetownDocument.options
|
@@ -109,12 +109,11 @@ module Bridgetown
|
|
109
109
|
# @param text [String] the content inside the anchor tag
|
110
110
|
# @param relative_path [String, Object] source file path, e.g.
|
111
111
|
# "_posts/2020-10-20-my-post.md", or object that responds to `url`
|
112
|
-
# @param options [Hash]
|
112
|
+
# @param options [Hash] pass keyword arguments to add HTML attributes
|
113
113
|
# @return [String] the anchor tag HTML
|
114
114
|
# @raise [ArgumentError] if the file cannot be found
|
115
|
-
def link_to(text, relative_path = nil, options
|
115
|
+
def link_to(text, relative_path = nil, **options, &block)
|
116
116
|
if block.present?
|
117
|
-
options = relative_path || {}
|
118
117
|
relative_path = text
|
119
118
|
text = view.respond_to?(:capture) ? view.capture(&block) : yield
|
120
119
|
elsif relative_path.nil?
|
@@ -145,11 +145,7 @@ module Bridgetown
|
|
145
145
|
return attributes[method_name] if attributes.key?(method_name)
|
146
146
|
|
147
147
|
key = method_name.to_s
|
148
|
-
if key.end_with?("=")
|
149
|
-
key.chop!
|
150
|
-
attributes[key] = args.first
|
151
|
-
return attributes[key]
|
152
|
-
end
|
148
|
+
return attributes[key.chop] = args.first if key.end_with?("=")
|
153
149
|
|
154
150
|
Bridgetown.logger.warn "key `#{method_name}' not found in attributes for " \
|
155
151
|
"#{attributes[:id].presence || "new #{self.class}"}"
|
@@ -59,7 +59,7 @@ module Bridgetown
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
def liquid_render(component, options
|
62
|
+
def liquid_render(component, **options, &block)
|
63
63
|
options[:_block_content] = capture(&block) if block && respond_to?(:capture)
|
64
64
|
render_statement = _render_statement(component, options)
|
65
65
|
|
@@ -55,10 +55,7 @@ class Bridgetown::Signals < Signalize::Struct
|
|
55
55
|
return nil if value.empty? && block.nil?
|
56
56
|
|
57
57
|
key = key.to_s
|
58
|
-
if key.end_with?("=")
|
59
|
-
key.chop!
|
60
|
-
return self[key] = value[0]
|
61
|
-
end
|
58
|
+
return self[key.chop] = value[0] if key.end_with?("=")
|
62
59
|
|
63
60
|
super(key.to_sym)
|
64
61
|
end
|
@@ -166,7 +166,7 @@ module Bridgetown
|
|
166
166
|
|
167
167
|
# Applies a similar URL-building technique as resources that takes
|
168
168
|
# the collection's URL template into account. The default URL template can
|
169
|
-
# be
|
169
|
+
# be overridden in the collection's configuration
|
170
170
|
def url
|
171
171
|
@url ||= begin
|
172
172
|
newly_processed = false
|
@@ -179,6 +179,7 @@ module Bridgetown
|
|
179
179
|
newly_processed ? base : "#{base}#{extname}"
|
180
180
|
end
|
181
181
|
end
|
182
|
+
alias_method :relative_url, :url
|
182
183
|
|
183
184
|
# @return [Symbol, nil] type of the collection if present
|
184
185
|
def type
|
@@ -76,6 +76,8 @@ Bridgetown.configure do |config|
|
|
76
76
|
#
|
77
77
|
# init :"bridgetown-routes"
|
78
78
|
#
|
79
|
+
# NOTE: you can remove `init :ssr` if you load this initializer
|
80
|
+
#
|
79
81
|
|
80
82
|
# We also recommend that if you're using Roda routes you include this plugin
|
81
83
|
# so you can get a generated routes list in `.routes.json`. You can then run
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bridgetown-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.beta6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bridgetown Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -64,14 +64,14 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - '='
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: 2.0.0.
|
67
|
+
version: 2.0.0.beta6
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - '='
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 2.0.0.
|
74
|
+
version: 2.0.0.beta6
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: csv
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|