utopia 3.0.0 → 3.0.2
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
- checksums.yaml.gz.sig +0 -0
- data/context/what-is-xnode.md +6 -0
- data/lib/utopia/content/middleware.rb +10 -2
- data/lib/utopia/static/mime_types.rb +5 -2
- data/lib/utopia/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b209f640f2956c9d656cbac537793f828bb7dd398b9e7a2df41f3591aedd2aa6
|
|
4
|
+
data.tar.gz: 3d4ad85f0e311e7ec907e51bc837fad936658648f718986d2049c05b8e9391a3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 93c77c5abbef5ed5436b00220acdaeec1a774d23ea6e3418ebe0c29b5511b7da4439902bccbc264c4111ba5f5bb529e30e0215a93bc94cd6607f4ee89445ec2e
|
|
7
|
+
data.tar.gz: 59463ee050dec081e27b81829c79515e3845a7f15cab56cfbca7763a317ce11a864f4b019dca9ac276f95068ed7f5bb2ab21ad7923a5c40535faf79c033639ff
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/context/what-is-xnode.md
CHANGED
|
@@ -39,3 +39,9 @@ In order to render this, you will need two additional files, `_page.xnode` and `
|
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
When the parser encounters `<content:heading>...` in the main page, it would evaluate the above template. `<utopia:content/>` is a special tag that evaluates to the content that the parent tag provided, so in this case: `"Welcome to my page"`. Thus, the final output is `<h1>Welcome to my page</h1>`.
|
|
42
|
+
|
|
43
|
+
## Relative Content
|
|
44
|
+
|
|
45
|
+
By default, `<content:...>` tags resolve relative to the physical location of the template which contains them. This ensures that a shared template uses its own related content templates consistently.
|
|
46
|
+
|
|
47
|
+
Use the `<relative:...>` namespace when a shared template should instead allow content to be overridden relative to the node being rendered. For example, a root `_page.xnode` can render `<relative:header/>`; when it wraps `blog/index.xnode`, Utopia first looks for `blog/_header.xnode` before falling back to `/_header.xnode`.
|
|
@@ -25,6 +25,7 @@ module Utopia
|
|
|
25
25
|
include Localization::Resolver
|
|
26
26
|
|
|
27
27
|
CONTENT_NAMESPACE = "content".freeze
|
|
28
|
+
RELATIVE_NAMESPACE = "relative".freeze
|
|
28
29
|
UTOPIA_NAMESPACE = "utopia".freeze
|
|
29
30
|
CONTENT_TAG_NAME = "utopia:content".freeze
|
|
30
31
|
|
|
@@ -45,6 +46,9 @@ module Utopia
|
|
|
45
46
|
# Default content namespace for dynamic path based lookup:
|
|
46
47
|
@namespaces[CONTENT_NAMESPACE] ||= self.method(:content_tag)
|
|
47
48
|
|
|
49
|
+
# Resolve content relative to the logical invocation path:
|
|
50
|
+
@namespaces[RELATIVE_NAMESPACE] ||= self.method(:relative_tag)
|
|
51
|
+
|
|
48
52
|
# The core namespace for utopia specific functionality:
|
|
49
53
|
@namespaces[UTOPIA_NAMESPACE] ||= Tags
|
|
50
54
|
end
|
|
@@ -190,8 +194,8 @@ module Utopia
|
|
|
190
194
|
return nil
|
|
191
195
|
end
|
|
192
196
|
|
|
193
|
-
def content_tag(name, node)
|
|
194
|
-
full_path =
|
|
197
|
+
def content_tag(name, node, parent_path: node.parent_path)
|
|
198
|
+
full_path = parent_path + name
|
|
195
199
|
|
|
196
200
|
name = full_path.pop
|
|
197
201
|
|
|
@@ -206,6 +210,10 @@ module Utopia
|
|
|
206
210
|
lookup_content(name, full_path)
|
|
207
211
|
end
|
|
208
212
|
end
|
|
213
|
+
|
|
214
|
+
def relative_tag(name, node)
|
|
215
|
+
content_tag(name, node, parent_path: node.request_path.dirname)
|
|
216
|
+
end
|
|
209
217
|
end
|
|
210
218
|
|
|
211
219
|
Traces::Provider(Middleware) do
|
|
@@ -16,8 +16,11 @@ module Utopia
|
|
|
16
16
|
:media => [
|
|
17
17
|
:xiph, "mp3", "mp4", "wav", "aiff", "aac", "webm", "weba", "mov", "avi", "wmv", "mpg", "m3u8", "ts"
|
|
18
18
|
],
|
|
19
|
+
:scripts => [
|
|
20
|
+
"js", "mjs", "wasm"
|
|
21
|
+
],
|
|
19
22
|
:text => [
|
|
20
|
-
"html", "css", "
|
|
23
|
+
"html", "css", "map", "txt", "rtf", "xml", "pdf"
|
|
21
24
|
],
|
|
22
25
|
:fonts => [
|
|
23
26
|
"otf", "eot", "ttf", "woff", "woff2"
|
|
@@ -29,7 +32,7 @@ module Utopia
|
|
|
29
32
|
"png", "gif", "jpeg", "tiff", "svg", "webp"
|
|
30
33
|
],
|
|
31
34
|
:default => [
|
|
32
|
-
:media, :text, :archive, :images, :fonts
|
|
35
|
+
:media, :scripts, :text, :archive, :images, :fonts
|
|
33
36
|
]
|
|
34
37
|
}
|
|
35
38
|
|
data/lib/utopia/version.rb
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|