nanoc-dart-sass 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.md +4 -0
- data/lib/nanoc/dart_sass/filter.rb +40 -7
- 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: abb3353a67957a72db05a7eaec7a3dcd669b600a188b081bc41d9a8dd8b99a54
|
4
|
+
data.tar.gz: ce51516fc85577f8c265669f9a3e71be00417eedda5f419b9e3d0f11d48ffbe4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c7a5043abd21b916203fc476a4305b7da06ce44b21e856714a48b88c125be5508bef0a60e41f48db09dbcf92365effa9f158b87628a2c56ba4cb0b2851d5e70
|
7
|
+
data.tar.gz: a4e1f92ac5ec75283a1ef62d9b9801a773b05d7aaff4ca75b266d0130047d1343d95f85326c91528f9799273270cc5b3b46cb556b1455be436691303ed9ec060
|
data/NEWS.md
CHANGED
@@ -18,35 +18,68 @@ 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
|
26
|
+
rescue StandardError => e # rubocop:disable Lint/UselessRescue
|
27
27
|
# TODO: use full_message for syntax errors
|
28
28
|
raise e
|
29
29
|
end
|
30
30
|
|
31
31
|
class NanocImporter
|
32
|
-
def initialize(items)
|
32
|
+
def initialize(items, source_item)
|
33
33
|
@items = items
|
34
|
+
@source_item = source_item
|
34
35
|
end
|
35
36
|
|
36
37
|
def canonicalize(url, **)
|
37
|
-
|
38
|
+
# Construct proper URL with `nanoc:` prefix if needed
|
39
|
+
if url.start_with?('nanoc:')
|
40
|
+
url
|
41
|
+
else
|
42
|
+
"nanoc:#{url}"
|
43
|
+
end
|
38
44
|
end
|
39
45
|
|
40
46
|
def load(url)
|
41
|
-
item =
|
47
|
+
item = find_item_for_url(url)
|
48
|
+
|
42
49
|
{
|
43
50
|
contents: item.raw_content,
|
44
51
|
syntax: Util.syntax_from_ext(item.identifier.ext),
|
45
52
|
}
|
46
53
|
end
|
47
|
-
end
|
48
54
|
|
49
|
-
|
55
|
+
private
|
56
|
+
|
57
|
+
def find_item_for_url(url)
|
58
|
+
pat = url.sub(/\Ananoc:/, '')
|
59
|
+
|
60
|
+
# If URL has no extension, add `.*` at the end
|
61
|
+
if pat.match?(%r{(/|^)[^.]+$})
|
62
|
+
pat += '.*'
|
63
|
+
end
|
64
|
+
|
65
|
+
# Convert to absolute pattern
|
66
|
+
pat =
|
67
|
+
if pat.start_with?('/')
|
68
|
+
pat
|
69
|
+
else
|
70
|
+
dirname = File.dirname(@source_item.identifier.to_s)
|
71
|
+
File.expand_path(pat, dirname)
|
72
|
+
end
|
73
|
+
|
74
|
+
item = @items[pat]
|
75
|
+
|
76
|
+
unless item
|
77
|
+
raise "Could not find an item matching pattern `#{pat}`"
|
78
|
+
end
|
79
|
+
|
80
|
+
item
|
81
|
+
end
|
82
|
+
end
|
50
83
|
|
51
84
|
module Util
|
52
85
|
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.1
|
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-06-15 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.14
|
75
75
|
signing_key:
|
76
76
|
specification_version: 4
|
77
77
|
summary: Dart Sass filter for Nanoc
|