bade 0.3.7 → 0.3.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a481b2a1a19745d8660df10476ca85cfa6687a47115cf7f964d40c63dd36327e
4
- data.tar.gz: 5996a6dd699189cc5059619558524a65c892a751ffbedeb3fd09cdf41e7d8b18
3
+ metadata.gz: 634cad9ad0535b4b49969984f50f300837fef21b3d98558e0dfa0321bef70481
4
+ data.tar.gz: 242c463186adbb17102be57c0bf0071341e40f75b639135fced349d2a31f0210
5
5
  SHA512:
6
- metadata.gz: 0675d10d28933ee600d2530a3ae863cdfe53bae8632c6eb92e59e49a37fddc7eb3a6b62b6f492d88734597e988c0361d5f0b1f4b68d069e7e55789d061d55ed2
7
- data.tar.gz: 149cb3709994965d70e3552b7f548b0c04d39610176379ed09b8ff21d6c2444d26546fceca0976c813cb86f997c174343cb418a480697551058b20dd7c1b2ede
6
+ metadata.gz: 5d2c6b50741926cf20cdb4c1243cf95c75c445b6d4b0d3992b2f0d467133b2c33e0f058269840b51af94390fba3c7ac4e8b3ea17cff0be1ba088b410f97de3e6
7
+ data.tar.gz: a431f9a0f4c4d087c7e8038d9065c954b135418107de2b0b8796657427e1d550a5d1b72830641dc859027373bbb44d0c725194af93d76d30f65a6606c8abf937
@@ -14,7 +14,7 @@ module Bade
14
14
 
15
15
  DEFAULT_BLOCK_NAME = 'default_block'.freeze
16
16
 
17
- REQUIRE_RELATIVE_REGEX = /require_relative\s+['"](.+)['"]/
17
+ REQUIRE_RELATIVE_REGEX = /require_relative\s+(['"])(.+)['"]/
18
18
 
19
19
  # @param [Document] document
20
20
  #
@@ -435,12 +435,19 @@ module Bade
435
435
  #
436
436
  def _fix_required_relative(text)
437
437
  text.gsub(REQUIRE_RELATIVE_REGEX) do
438
- relative_path = Regexp.last_match[1]
439
- abs_path = File.expand_path(relative_path, File.dirname(@documents.last.file_path))
440
- document_abs_path = Pathname.new(File.expand_path(File.dirname(@documents.first.file_path)))
441
- new_relative_path = Pathname.new(abs_path).relative_path_from(document_abs_path).to_s
438
+ quote = Regexp.last_match[1]
439
+ relative_path = Regexp.last_match[2]
442
440
 
443
- "require_relative '#{new_relative_path}'"
441
+ should_not_process = quote === '"' && relative_path.include?('#{')
442
+
443
+ new_relative_path = relative_path
444
+ unless should_not_process
445
+ abs_path = File.expand_path(relative_path, File.dirname(@documents.last.file_path))
446
+ document_abs_path = Pathname.new(File.expand_path(File.dirname(@documents.first.file_path)))
447
+ new_relative_path = Pathname.new(abs_path).relative_path_from(document_abs_path).to_s
448
+ end
449
+
450
+ "require_relative #{quote}#{new_relative_path}#{quote}"
444
451
  end
445
452
  end
446
453
  end
data/lib/bade/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bade
4
- VERSION = '0.3.7'.freeze
4
+ VERSION = '0.3.8'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bade
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Kříž
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-15 00:00:00.000000000 Z
11
+ date: 2023-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: psych
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  - !ruby/object:Gem::Version
135
135
  version: '0'
136
136
  requirements: []
137
- rubygems_version: 3.4.20
137
+ rubygems_version: 3.4.21
138
138
  signing_key:
139
139
  specification_version: 4
140
140
  summary: Minimalistic template engine for Ruby.