nanoc-dart-sass 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.md +8 -0
- data/lib/nanoc/dart_sass/filter.rb +40 -10
- data/lib/nanoc/dart_sass/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71ddac060520e3149a4caa4bdb0a605e1f123f281255d0e1691600b0eedfe440
|
4
|
+
data.tar.gz: 2429ebae5cfead56edd001349c4493cbe696fe9b3662c793aa3003ac49ca50dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ee86ca61d395df8599e4effbf19b5cec3876a8c07f6cd07f48be1b9e2ca3e229c36d9ed2c3428407eef0f080757c24e0c75383468f6496d958813c17977ca57
|
7
|
+
data.tar.gz: 8a9688ddf9f4faf94578d52eeedb18bcbb87d2efa3ce23433ace33b07ce37e70f528fc6561f5781f754827331de47882d5e9cfe145dd9491a273ed7ade8f0261
|
data/NEWS.md
CHANGED
@@ -18,35 +18,65 @@ module Nanoc
|
|
18
18
|
|
19
19
|
result = Sass.compile_string(
|
20
20
|
content,
|
21
|
-
importer: NanocImporter.new(@items),
|
21
|
+
importer: NanocImporter.new(@items, item),
|
22
22
|
**params,
|
23
23
|
syntax: syntax,
|
24
24
|
)
|
25
25
|
result.css
|
26
|
-
rescue StandardError => e
|
27
|
-
# TODO: use full_message for syntax errors
|
28
|
-
raise e
|
29
26
|
end
|
30
27
|
|
31
28
|
class NanocImporter
|
32
|
-
def initialize(items)
|
29
|
+
def initialize(items, source_item)
|
33
30
|
@items = items
|
31
|
+
@source_item = source_item
|
34
32
|
end
|
35
33
|
|
36
|
-
def canonicalize(url, **)
|
37
|
-
|
34
|
+
def canonicalize(url, *, **)
|
35
|
+
# Construct proper URL with `nanoc:` prefix if needed
|
36
|
+
if url.start_with?('nanoc:')
|
37
|
+
url
|
38
|
+
else
|
39
|
+
"nanoc:#{url}"
|
40
|
+
end
|
38
41
|
end
|
39
42
|
|
40
43
|
def load(url)
|
41
|
-
item =
|
44
|
+
item = find_item_for_url(url)
|
45
|
+
|
42
46
|
{
|
43
47
|
contents: item.raw_content,
|
44
48
|
syntax: Util.syntax_from_ext(item.identifier.ext),
|
45
49
|
}
|
46
50
|
end
|
47
|
-
end
|
48
51
|
|
49
|
-
|
52
|
+
private
|
53
|
+
|
54
|
+
def find_item_for_url(url)
|
55
|
+
pat = url.sub(/\Ananoc:/, '')
|
56
|
+
|
57
|
+
# If URL has no extension, add `.*` at the end
|
58
|
+
if pat.match?(%r{(/|^)[^.]+$})
|
59
|
+
pat += '.*'
|
60
|
+
end
|
61
|
+
|
62
|
+
# Convert to absolute pattern
|
63
|
+
pat =
|
64
|
+
if pat.start_with?('/')
|
65
|
+
pat
|
66
|
+
else
|
67
|
+
dirname = File.dirname(@source_item.identifier.to_s)
|
68
|
+
File.expand_path(pat, dirname)
|
69
|
+
end
|
70
|
+
|
71
|
+
item = @items[pat]
|
72
|
+
|
73
|
+
unless item
|
74
|
+
raise "Could not find an item matching pattern `#{pat}`"
|
75
|
+
end
|
76
|
+
|
77
|
+
item
|
78
|
+
end
|
79
|
+
end
|
50
80
|
|
51
81
|
module Util
|
52
82
|
module_function
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanoc-dart-sass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Defreyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nanoc-core
|
@@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
71
|
- !ruby/object:Gem::Version
|
72
72
|
version: '0'
|
73
73
|
requirements: []
|
74
|
-
rubygems_version: 3.
|
74
|
+
rubygems_version: 3.4.20
|
75
75
|
signing_key:
|
76
76
|
specification_version: 4
|
77
77
|
summary: Dart Sass filter for Nanoc
|