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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5859b27799d61ea7f72bba2904aaa0978ad43797f90fd6ab6255dba9279ef3a
4
- data.tar.gz: c8e681f15c0617a42fabbf1d571ad2cd82aa4458087070704c36598bf9909a9c
3
+ metadata.gz: 71ddac060520e3149a4caa4bdb0a605e1f123f281255d0e1691600b0eedfe440
4
+ data.tar.gz: 2429ebae5cfead56edd001349c4493cbe696fe9b3662c793aa3003ac49ca50dc
5
5
  SHA512:
6
- metadata.gz: 906336b07db8e08f332f424d447f0d7a1954da7a5fbfef9d4d8a808936e5c8be92afee9786d1b22a812901d378c3a7454328a06bbb45ee0166b3bd02f8453023
7
- data.tar.gz: c528b493cd63d3dc670a1307c2b78f41d30ca44e45420e5ef05e1f3ba6f42778e898b2f455db060c409bd2cea91c838f6667728a7e79608e397701cd07d839de
6
+ metadata.gz: 4ee86ca61d395df8599e4effbf19b5cec3876a8c07f6cd07f48be1b9e2ca3e229c36d9ed2c3428407eef0f080757c24e0c75383468f6496d958813c17977ca57
7
+ data.tar.gz: 8a9688ddf9f4faf94578d52eeedb18bcbb87d2efa3ce23433ace33b07ce37e70f528fc6561f5781f754827331de47882d5e9cfe145dd9491a273ed7ade8f0261
data/NEWS.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # nanoc-dart-sass news
2
2
 
3
+ ## 1.0.2 (2023-09-30)
4
+
5
+ - Fix dart-sass compatibility (#1664)
6
+
7
+ ## 1.0.1 (2023-06-15)
8
+
9
+ - Added support for importing relative paths (#1646, #1653)
10
+
3
11
  ## 1.0.0 (2022-12-17)
4
12
 
5
13
  Initial release.
@@ -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
- "nanoc:#{@items[url.sub(/\Ananoc:/, '')].identifier}"
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 = @items[url.sub(/\Ananoc:/, '')]
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
- private_constant :NanocImporter
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Nanoc
4
4
  module DartSass
5
- VERSION = '1.0.0'
5
+ VERSION = '1.0.2'
6
6
  end
7
7
  end
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.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: 2022-12-17 00:00:00.000000000 Z
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.3.26
74
+ rubygems_version: 3.4.20
75
75
  signing_key:
76
76
  specification_version: 4
77
77
  summary: Dart Sass filter for Nanoc