htx 0.1.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/VERSION +1 -1
- data/lib/htx/template.rb +109 -24
- data/lib/htx/version.rb +1 -1
- metadata +12 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d869f62a146bed898334d085ce1dc507d214950d166454b65e502058bc68e6b6
|
4
|
+
data.tar.gz: fd81c8b3b82f2bd95e85899f14ee35f881f11a8b0f8b07b38af1f5b0ee599a87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd23ac9b3363d467c1e47258654ed3d9a136e32e66379374b2d33a1abeeb358a1957de66364ad5af3dd20768a4ace5226ccb57c256b18b232de0381fe3144d25
|
7
|
+
data.tar.gz: e304e3e8b87c093eabc07628c0179c15eef76d9870483d96a129ce9f2f1358d0ec50df14e369e2c052aa59b992bcae2647753f3cb62f9e37de1d06b221332f4b
|
data/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright 2019-
|
1
|
+
Copyright 2019-2024 Nate Pickens
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
4
4
|
documentation files (the "Software"), to deal in the Software without restriction, including without
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
1.0.0
|
data/lib/htx/template.rb
CHANGED
@@ -20,8 +20,8 @@ module HTX
|
|
20
20
|
INDENT_GUESS = /^( +|\t+)(?=\S)/.freeze
|
21
21
|
INDENT_REGEX = /\n(?=[^\n])/.freeze
|
22
22
|
|
23
|
-
|
24
|
-
|
23
|
+
AUTO_SEMICOLON_BEGIN = /\A\s*[\n;}]/.freeze
|
24
|
+
AUTO_SEMICOLON_END = /(\A|[\n;{}][^\S\n]*)\z/.freeze
|
25
25
|
|
26
26
|
NEWLINE_BEGIN = /\A\s*\n/.freeze
|
27
27
|
NEWLINE_END = /\n[^\S\n]*\z/.freeze
|
@@ -182,6 +182,7 @@ module HTX
|
|
182
182
|
# * +xmlns+ - True if node is the descendant of a node with an xmlns attribute.
|
183
183
|
#
|
184
184
|
def process_element_node(node, xmlns: false)
|
185
|
+
is_template = node.name == 'template'
|
185
186
|
children = node.children
|
186
187
|
childless = children.empty? || (children.size == 1 && self.class.formatting_node?(children.first))
|
187
188
|
dynamic_key = self.class.attribute_value(node.attr(DYNAMIC_KEY_ATTR))
|
@@ -201,19 +202,21 @@ module HTX
|
|
201
202
|
dynamic_key: dynamic_key,
|
202
203
|
)
|
203
204
|
else
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
205
|
+
unless is_template
|
206
|
+
append_htx_node(
|
207
|
+
"'#{self.class.tag_name(node.name)}'",
|
208
|
+
*attributes,
|
209
|
+
dynamic_key,
|
210
|
+
ELEMENT | (childless ? CHILDLESS : 0) | (xmlns ? XMLNS : 0),
|
211
|
+
)
|
212
|
+
end
|
210
213
|
|
211
214
|
unless childless
|
212
215
|
children.each do |child|
|
213
216
|
process(child, xmlns: xmlns)
|
214
217
|
end
|
215
218
|
|
216
|
-
@close_count += 1
|
219
|
+
@close_count += 1 unless is_template
|
217
220
|
end
|
218
221
|
end
|
219
222
|
end
|
@@ -281,8 +284,14 @@ module HTX
|
|
281
284
|
|
282
285
|
if (confirmed_newline || @statement_buff.match?(NEWLINE_END)) && !text.match?(NEWLINE_BEGIN)
|
283
286
|
@statement_buff << @indent
|
284
|
-
|
285
|
-
@statement_buff
|
287
|
+
else
|
288
|
+
unless @statement_buff.match?(AUTO_SEMICOLON_END) || text.match?(AUTO_SEMICOLON_BEGIN)
|
289
|
+
@statement_buff << ";"
|
290
|
+
end
|
291
|
+
|
292
|
+
unless @statement_buff.empty? || text.match?(WHITESPACE_BEGIN)
|
293
|
+
@statement_buff << ' '
|
294
|
+
end
|
286
295
|
end
|
287
296
|
|
288
297
|
flush if text.match?(NON_WHITESPACE)
|
@@ -410,24 +419,100 @@ module HTX
|
|
410
419
|
|
411
420
|
# Source: https://developer.mozilla.org/en-US/docs/Web/SVG/Element
|
412
421
|
TAG_MAP = %w[
|
413
|
-
animateMotion
|
414
|
-
|
415
|
-
|
416
|
-
|
422
|
+
animateMotion
|
423
|
+
animateTransform
|
424
|
+
clipPath
|
425
|
+
feBlend
|
426
|
+
feColorMatrix
|
427
|
+
feComponentTransfer
|
428
|
+
feComposite
|
429
|
+
feConvolveMatrix
|
430
|
+
feDiffuseLighting
|
431
|
+
feDisplacementMap
|
432
|
+
feDistantLight
|
433
|
+
feDropShadow
|
434
|
+
feFlood
|
435
|
+
feFuncA
|
436
|
+
feFuncB
|
437
|
+
feFuncG
|
438
|
+
feFuncR
|
439
|
+
feGaussianBlur
|
440
|
+
feImage
|
441
|
+
feMerge
|
442
|
+
feMergeNode
|
443
|
+
feMorphology
|
444
|
+
feOffset
|
445
|
+
fePointLight
|
446
|
+
feSpecularLighting
|
447
|
+
feSpotLight
|
448
|
+
feTile
|
449
|
+
feTurbulence
|
450
|
+
foreignObject
|
451
|
+
linearGradient
|
452
|
+
radialGradient
|
417
453
|
textPath
|
418
454
|
].map { |tag| [tag.downcase, tag] }.to_h.freeze
|
419
455
|
|
420
456
|
# Source: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
|
421
457
|
ATTR_MAP = %w[
|
422
|
-
attributeName
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
458
|
+
attributeName
|
459
|
+
attributeType
|
460
|
+
baseFrequency
|
461
|
+
baseProfile
|
462
|
+
calcMode
|
463
|
+
clipPathUnits
|
464
|
+
diffuseConstant
|
465
|
+
edgeMode
|
466
|
+
filterUnits
|
467
|
+
glyphRef
|
468
|
+
gradientTransform
|
469
|
+
gradientUnits
|
470
|
+
kernelMatrix
|
471
|
+
kernelUnitLength
|
472
|
+
keyPoints
|
473
|
+
keySplines
|
474
|
+
keyTimes
|
475
|
+
lengthAdjust
|
476
|
+
limitingConeAngle
|
477
|
+
markerHeight
|
478
|
+
markerUnits
|
479
|
+
markerWidth
|
480
|
+
maskContentUnits
|
481
|
+
maskUnits
|
482
|
+
numOctaves
|
483
|
+
pathLength
|
484
|
+
patternContentUnits
|
485
|
+
patternTransform
|
486
|
+
patternUnits
|
487
|
+
pointsAtX
|
488
|
+
pointsAtY
|
489
|
+
pointsAtZ
|
490
|
+
preserveAlpha
|
491
|
+
preserveAspectRatio
|
492
|
+
primitiveUnits
|
493
|
+
refX
|
494
|
+
refY
|
495
|
+
referrerPolicy
|
496
|
+
repeatCount
|
497
|
+
repeatDur
|
498
|
+
requiredExtensions
|
499
|
+
requiredFeatures
|
500
|
+
specularConstant
|
501
|
+
specularExponent
|
502
|
+
spreadMethod
|
503
|
+
startOffset
|
504
|
+
stdDeviation
|
505
|
+
stitchTiles
|
506
|
+
surfaceScale
|
507
|
+
systemLanguage
|
508
|
+
tableValues
|
509
|
+
targetX
|
510
|
+
targetY
|
511
|
+
textLength
|
512
|
+
viewBox
|
513
|
+
xChannelSelector
|
514
|
+
yChannelSelector
|
515
|
+
zoomAndPan
|
431
516
|
].map { |attr| [attr.downcase, attr] }.to_h.freeze
|
432
517
|
end
|
433
518
|
end
|
data/lib/htx/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: htx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nate Pickens
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -42,22 +42,16 @@ dependencies:
|
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 5.11.2
|
48
|
-
- - "<"
|
45
|
+
- - "~>"
|
49
46
|
- !ruby/object:Gem::Version
|
50
|
-
version:
|
47
|
+
version: '5.21'
|
51
48
|
type: :development
|
52
49
|
prerelease: false
|
53
50
|
version_requirements: !ruby/object:Gem::Requirement
|
54
51
|
requirements:
|
55
|
-
- - "
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: 5.11.2
|
58
|
-
- - "<"
|
52
|
+
- - "~>"
|
59
53
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
54
|
+
version: '5.21'
|
61
55
|
description: HTX is a full-featured HTML template system that is simple, lightweight,
|
62
56
|
and highly performant. This library is a Ruby implementation of the HTX template
|
63
57
|
compiler--it converts HTX templates to their compiled JavaScript form.
|
@@ -78,9 +72,9 @@ homepage: https://github.com/npickens/htx
|
|
78
72
|
licenses:
|
79
73
|
- MIT
|
80
74
|
metadata:
|
81
|
-
|
82
|
-
|
83
|
-
source_code_uri: https://github.com/npickens/htx
|
75
|
+
bug_tracker_uri: https://github.com/npickens/htx/issues
|
76
|
+
documentation_uri: https://github.com/npickens/htx/blob/1.0.0/README.md
|
77
|
+
source_code_uri: https://github.com/npickens/htx/tree/1.0.0
|
84
78
|
post_install_message:
|
85
79
|
rdoc_options: []
|
86
80
|
require_paths:
|
@@ -89,14 +83,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
83
|
requirements:
|
90
84
|
- - ">="
|
91
85
|
- !ruby/object:Gem::Version
|
92
|
-
version:
|
86
|
+
version: 3.0.0
|
93
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
88
|
requirements:
|
95
89
|
- - ">="
|
96
90
|
- !ruby/object:Gem::Version
|
97
|
-
version:
|
91
|
+
version: 2.0.0
|
98
92
|
requirements: []
|
99
|
-
rubygems_version: 3.
|
93
|
+
rubygems_version: 3.5.10
|
100
94
|
signing_key:
|
101
95
|
specification_version: 4
|
102
96
|
summary: A Ruby compiler for HTX templates.
|