cecil 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/cecil/lang/typescript.rb +1 -1
- data/lib/cecil/node.rb +10 -1
- data/lib/cecil/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 715fe57905640e8d41a8eeadd3ecb79adb1d528946e166dfed80d4466812bcc8
|
4
|
+
data.tar.gz: c91b07cfbddce8b85eba0b62d055b759f3b7085a1058579633f502c25f1d507c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c160d16f05b6d156612ef773b8eae710056fccef736683890d93ec0ad1d76be8c07211f85ad65700ecd2b82ea57f4702d2b15c84ad0fe0d1c30b9679f80bda4
|
7
|
+
data.tar.gz: d885c7df13cd99900cd5aacbd978187bf7f2efce32c1da68120f6954e8e0536b82a1ddb168f3a8c9ead34556b2b67e78b424008f55a20fa8cb4557af213ac27b
|
data/Gemfile.lock
CHANGED
@@ -88,7 +88,7 @@ module Cecil
|
|
88
88
|
#
|
89
89
|
# @param item [#to_s] A string or any object that responds to `#to_s`
|
90
90
|
# @return [String] A JSON string without quotes
|
91
|
-
def s(item) = item.to_s.to_json[1...-1].gsub(
|
91
|
+
def s(item) = item.to_s.to_json[1...-1].gsub(/['`\$]/) { "\\#{_1}" }
|
92
92
|
end
|
93
93
|
end
|
94
94
|
end
|
data/lib/cecil/node.rb
CHANGED
@@ -357,6 +357,15 @@ module Cecil
|
|
357
357
|
def self.build(src:, builder:, **kwargs)
|
358
358
|
placeholders = builder.syntax.scan_for_placeholders(src)
|
359
359
|
|
360
|
+
# HACK: to make sure we throw the exception at the time the developer adds the string/template
|
361
|
+
#
|
362
|
+
# This gets called later, too, so it's work being done twice.
|
363
|
+
#
|
364
|
+
# This should probably be refactored so that Nodes carry around a de-indented version, and then just have to add
|
365
|
+
# the indentation later when stringified
|
366
|
+
Indentation.reindent(src, 0, "THIS SHOULD NEVER BE USED",
|
367
|
+
handle_ambiguity: builder.syntax.handle_ambiguous_indentation)
|
368
|
+
|
360
369
|
if placeholders.any?
|
361
370
|
new(src:, placeholders:, **kwargs)
|
362
371
|
else
|
@@ -375,7 +384,7 @@ module Cecil
|
|
375
384
|
def with(*positional_values, **named_values, &)
|
376
385
|
src =
|
377
386
|
case [positional_values, named_values, @placeholders]
|
378
|
-
in [], {}, []
|
387
|
+
in [], {}, [] # TODO: is this case possible? should it be?
|
379
388
|
@src
|
380
389
|
in [], _, _
|
381
390
|
Text.interpolate_named(@src, @placeholders, named_values)
|
data/lib/cecil/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cecil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Nicholaides
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
An experimental templating library designed specifically for generating source code (especially for languages that
|