bade 0.3.7 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bade/generator.rb +13 -6
- data/lib/bade/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: 634cad9ad0535b4b49969984f50f300837fef21b3d98558e0dfa0321bef70481
|
4
|
+
data.tar.gz: 242c463186adbb17102be57c0bf0071341e40f75b639135fced349d2a31f0210
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d2c6b50741926cf20cdb4c1243cf95c75c445b6d4b0d3992b2f0d467133b2c33e0f058269840b51af94390fba3c7ac4e8b3ea17cff0be1ba088b410f97de3e6
|
7
|
+
data.tar.gz: a431f9a0f4c4d087c7e8038d9065c954b135418107de2b0b8796657427e1d550a5d1b72830641dc859027373bbb44d0c725194af93d76d30f65a6606c8abf937
|
data/lib/bade/generator.rb
CHANGED
@@ -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
|
-
|
439
|
-
|
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
|
-
"
|
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
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.
|
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-
|
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.
|
137
|
+
rubygems_version: 3.4.21
|
138
138
|
signing_key:
|
139
139
|
specification_version: 4
|
140
140
|
summary: Minimalistic template engine for Ruby.
|