homura-runtime 0.2.18 → 0.2.20
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/exe/compile-erb +23 -1
- data/lib/cloudflare_workers/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c353eae6d02619f499bf359610f28d12c0824415cc584e835dd0440d6807cff6
|
|
4
|
+
data.tar.gz: 998317164a89b71d98f01275a20dd1482d7ccf464c8ebef1095555db669765be
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f6b0a9a1f4d55913deb468056980e70c3913ef7397603f1b9ee156241cf6d55cdd7eb6cb94cf54513c1d293816a9f69d455e36731f013c648a4716bec49f0972
|
|
7
|
+
data.tar.gz: 19e6c31d9e1fee24749b91a8d3caadb6789d9d05652d76ce2addc9642b892d47ac8fa8fffad7ff9862d309c34d994af9cc5da718b20d6b96bb2e38ce7e492d74
|
data/exe/compile-erb
CHANGED
|
@@ -415,6 +415,25 @@ def emit_sinatra_patch(io, namespace)
|
|
|
415
415
|
end
|
|
416
416
|
end
|
|
417
417
|
|
|
418
|
+
# A template is "layout-like" if its name is `:layout` or starts
|
|
419
|
+
# with `layout_` (e.g. `:layout_docs`). The auto-layout pass in
|
|
420
|
+
# `erb` skips wrapping such templates in `:layout` so that
|
|
421
|
+
# rendering `:layout_docs` doesn't end up nested inside `:layout`,
|
|
422
|
+
# which would otherwise produce a duplicate header / nav.
|
|
423
|
+
def __homura_layout_template?(template)
|
|
424
|
+
name = template.to_sym
|
|
425
|
+
name == :layout || name.to_s.start_with?('layout_')
|
|
426
|
+
end
|
|
427
|
+
|
|
428
|
+
# Rails-/Sinatra-flavoured partial convention: a template name
|
|
429
|
+
# starting with `_` is treated as a partial (e.g. `_docs_nav`),
|
|
430
|
+
# so the auto-layout pass leaves it alone. Without this, calling
|
|
431
|
+
# `<%= erb :_docs_nav %>` from inside a layout template would
|
|
432
|
+
# rewrap the partial in `:layout`, doubling header/nav output.
|
|
433
|
+
def __homura_partial_template?(template)
|
|
434
|
+
template.to_s.start_with?('_')
|
|
435
|
+
end
|
|
436
|
+
|
|
418
437
|
# homura patch: dispatch to precompiled templates when we
|
|
419
438
|
# have one. Unknown symbols raise a clear message instead of
|
|
420
439
|
# wandering into upstream Tilt, which would blow up on
|
|
@@ -432,7 +451,10 @@ def emit_sinatra_patch(io, namespace)
|
|
|
432
451
|
|
|
433
452
|
layout = options[:layout]
|
|
434
453
|
layout = false if layout.nil? && options.include?(:layout)
|
|
435
|
-
if layout.nil? &&
|
|
454
|
+
if layout.nil? &&
|
|
455
|
+
!__homura_layout_template?(template) &&
|
|
456
|
+
!__homura_partial_template?(template) &&
|
|
457
|
+
::#{namespace}.registered?(:layout)
|
|
436
458
|
layout = :layout
|
|
437
459
|
end
|
|
438
460
|
if layout
|