bade 0.3.6 → 0.3.8

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: f0e26e77d2d1be1c0ef31a906d025a3f13417be44f0f7377e0228a2a38b25cc9
4
- data.tar.gz: d9a9b30ef8235cef2f15491b739b61afacc8b4b015d22154434fb3debc6bbacb
3
+ metadata.gz: 634cad9ad0535b4b49969984f50f300837fef21b3d98558e0dfa0321bef70481
4
+ data.tar.gz: 242c463186adbb17102be57c0bf0071341e40f75b639135fced349d2a31f0210
5
5
  SHA512:
6
- metadata.gz: 80c968d59631db457a0e2ce7d81fb87da9a2ac66436bb64b4b78a099f3e30ff192fadc2a289b35eec1ea0af254975a936ca39bd1e59becf560a05246713b706e
7
- data.tar.gz: 72f4888f35b356454dc49653c30a87fd79fb4e25c014414728e4eb3d7ec4f202b885b7c98371df517b841c5538ff2617367a73b698780ef0a762c3b722c25f09
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
@@ -100,7 +100,6 @@ module Bade
100
100
  # rubocop:enable Security/Eval
101
101
  else
102
102
  context_path = caller_locations(1, 1).first.path
103
- puts "context_path: #{context_path}"
104
103
 
105
104
  abs_path = File.expand_path(filename, File.dirname(context_path))
106
105
 
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.6'.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.6
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.