htx 0.1.1 → 1.0.1
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 +4 -4
- data/LICENSE +1 -1
- data/VERSION +1 -1
- data/lib/htx/template.rb +124 -24
- data/lib/htx/version.rb +1 -1
- metadata +13 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22f4b36c70794662297860c06e7459fd31c8e6a3d5660bac76fa8dc96d5b4841
|
4
|
+
data.tar.gz: 88b6761149af062d969aed55c13e5e98d55b89a1d32d3472acd00ea8888d44d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1070a23592b8cf6efb7f7a69b1c7cb94e6c13715d6dc9b809f605a1f8064fabea453a3c79cfb5dc106affc22eefd459b5e3c1c7d04564680c67e946bcdf71f2
|
7
|
+
data.tar.gz: bc8451597f94d3770ce44ecd97a66a40a79e2f75be6ccb176371997b590316e1e2d731af092ba1571e3ecd5f009b6c6122d2eeba4dc17e23decf843d31a9acdb
|
data/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright 2019-
|
1
|
+
Copyright 2019-2025 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
|
+
1.0.1
|
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
|
@@ -80,6 +80,21 @@ module HTX
|
|
80
80
|
@compiled
|
81
81
|
end
|
82
82
|
|
83
|
+
##
|
84
|
+
# Returns high-level object info string.
|
85
|
+
#
|
86
|
+
def inspect
|
87
|
+
"#<#{self.class} "\
|
88
|
+
"@as_module=#{@as_module.inspect}, "\
|
89
|
+
"@assign_to=#{@assign_to.inspect}, "\
|
90
|
+
"@base_indent=#{@base_indent.inspect}, "\
|
91
|
+
"@compiled=#{@compiled&.sub(/\n[\s\S]+/, ' [...]').inspect}, "\
|
92
|
+
"@content=#{@content&.sub(/\n[\s\S]+/, ' [...]').inspect}, "\
|
93
|
+
"@import_path=#{@import_path.inspect}, "\
|
94
|
+
"@name=#{@name.inspect}"\
|
95
|
+
'>'
|
96
|
+
end
|
97
|
+
|
83
98
|
private
|
84
99
|
|
85
100
|
##
|
@@ -182,6 +197,7 @@ module HTX
|
|
182
197
|
# * +xmlns+ - True if node is the descendant of a node with an xmlns attribute.
|
183
198
|
#
|
184
199
|
def process_element_node(node, xmlns: false)
|
200
|
+
is_template = node.name == 'template'
|
185
201
|
children = node.children
|
186
202
|
childless = children.empty? || (children.size == 1 && self.class.formatting_node?(children.first))
|
187
203
|
dynamic_key = self.class.attribute_value(node.attr(DYNAMIC_KEY_ATTR))
|
@@ -201,19 +217,21 @@ module HTX
|
|
201
217
|
dynamic_key: dynamic_key,
|
202
218
|
)
|
203
219
|
else
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
220
|
+
unless is_template
|
221
|
+
append_htx_node(
|
222
|
+
"'#{self.class.tag_name(node.name)}'",
|
223
|
+
*attributes,
|
224
|
+
dynamic_key,
|
225
|
+
ELEMENT | (childless ? CHILDLESS : 0) | (xmlns ? XMLNS : 0),
|
226
|
+
)
|
227
|
+
end
|
210
228
|
|
211
229
|
unless childless
|
212
230
|
children.each do |child|
|
213
231
|
process(child, xmlns: xmlns)
|
214
232
|
end
|
215
233
|
|
216
|
-
@close_count += 1
|
234
|
+
@close_count += 1 unless is_template
|
217
235
|
end
|
218
236
|
end
|
219
237
|
end
|
@@ -281,8 +299,14 @@ module HTX
|
|
281
299
|
|
282
300
|
if (confirmed_newline || @statement_buff.match?(NEWLINE_END)) && !text.match?(NEWLINE_BEGIN)
|
283
301
|
@statement_buff << @indent
|
284
|
-
|
285
|
-
@statement_buff
|
302
|
+
else
|
303
|
+
unless @statement_buff.match?(AUTO_SEMICOLON_END) || text.match?(AUTO_SEMICOLON_BEGIN)
|
304
|
+
@statement_buff << ";"
|
305
|
+
end
|
306
|
+
|
307
|
+
unless @statement_buff.empty? || text.match?(WHITESPACE_BEGIN)
|
308
|
+
@statement_buff << ' '
|
309
|
+
end
|
286
310
|
end
|
287
311
|
|
288
312
|
flush if text.match?(NON_WHITESPACE)
|
@@ -410,24 +434,100 @@ module HTX
|
|
410
434
|
|
411
435
|
# Source: https://developer.mozilla.org/en-US/docs/Web/SVG/Element
|
412
436
|
TAG_MAP = %w[
|
413
|
-
animateMotion
|
414
|
-
|
415
|
-
|
416
|
-
|
437
|
+
animateMotion
|
438
|
+
animateTransform
|
439
|
+
clipPath
|
440
|
+
feBlend
|
441
|
+
feColorMatrix
|
442
|
+
feComponentTransfer
|
443
|
+
feComposite
|
444
|
+
feConvolveMatrix
|
445
|
+
feDiffuseLighting
|
446
|
+
feDisplacementMap
|
447
|
+
feDistantLight
|
448
|
+
feDropShadow
|
449
|
+
feFlood
|
450
|
+
feFuncA
|
451
|
+
feFuncB
|
452
|
+
feFuncG
|
453
|
+
feFuncR
|
454
|
+
feGaussianBlur
|
455
|
+
feImage
|
456
|
+
feMerge
|
457
|
+
feMergeNode
|
458
|
+
feMorphology
|
459
|
+
feOffset
|
460
|
+
fePointLight
|
461
|
+
feSpecularLighting
|
462
|
+
feSpotLight
|
463
|
+
feTile
|
464
|
+
feTurbulence
|
465
|
+
foreignObject
|
466
|
+
linearGradient
|
467
|
+
radialGradient
|
417
468
|
textPath
|
418
469
|
].map { |tag| [tag.downcase, tag] }.to_h.freeze
|
419
470
|
|
420
471
|
# Source: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
|
421
472
|
ATTR_MAP = %w[
|
422
|
-
attributeName
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
473
|
+
attributeName
|
474
|
+
attributeType
|
475
|
+
baseFrequency
|
476
|
+
baseProfile
|
477
|
+
calcMode
|
478
|
+
clipPathUnits
|
479
|
+
diffuseConstant
|
480
|
+
edgeMode
|
481
|
+
filterUnits
|
482
|
+
glyphRef
|
483
|
+
gradientTransform
|
484
|
+
gradientUnits
|
485
|
+
kernelMatrix
|
486
|
+
kernelUnitLength
|
487
|
+
keyPoints
|
488
|
+
keySplines
|
489
|
+
keyTimes
|
490
|
+
lengthAdjust
|
491
|
+
limitingConeAngle
|
492
|
+
markerHeight
|
493
|
+
markerUnits
|
494
|
+
markerWidth
|
495
|
+
maskContentUnits
|
496
|
+
maskUnits
|
497
|
+
numOctaves
|
498
|
+
pathLength
|
499
|
+
patternContentUnits
|
500
|
+
patternTransform
|
501
|
+
patternUnits
|
502
|
+
pointsAtX
|
503
|
+
pointsAtY
|
504
|
+
pointsAtZ
|
505
|
+
preserveAlpha
|
506
|
+
preserveAspectRatio
|
507
|
+
primitiveUnits
|
508
|
+
refX
|
509
|
+
refY
|
510
|
+
referrerPolicy
|
511
|
+
repeatCount
|
512
|
+
repeatDur
|
513
|
+
requiredExtensions
|
514
|
+
requiredFeatures
|
515
|
+
specularConstant
|
516
|
+
specularExponent
|
517
|
+
spreadMethod
|
518
|
+
startOffset
|
519
|
+
stdDeviation
|
520
|
+
stitchTiles
|
521
|
+
surfaceScale
|
522
|
+
systemLanguage
|
523
|
+
tableValues
|
524
|
+
targetX
|
525
|
+
targetY
|
526
|
+
textLength
|
527
|
+
viewBox
|
528
|
+
xChannelSelector
|
529
|
+
yChannelSelector
|
530
|
+
zoomAndPan
|
431
531
|
].map { |attr| [attr.downcase, attr] }.to_h.freeze
|
432
532
|
end
|
433
533
|
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.1
|
4
|
+
version: 1.0.1
|
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: 2025-01-21 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,10 @@ homepage: https://github.com/npickens/htx
|
|
78
72
|
licenses:
|
79
73
|
- MIT
|
80
74
|
metadata:
|
81
|
-
|
82
|
-
|
83
|
-
|
75
|
+
bug_tracker_uri: https://github.com/npickens/htx/issues
|
76
|
+
changelog_uri: https://github.com/npickens/htx/blob/master/CHANGELOG.md
|
77
|
+
documentation_uri: https://github.com/npickens/htx/blob/1.0.1/README.md
|
78
|
+
source_code_uri: https://github.com/npickens/htx/tree/1.0.1
|
84
79
|
post_install_message:
|
85
80
|
rdoc_options: []
|
86
81
|
require_paths:
|
@@ -89,14 +84,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
84
|
requirements:
|
90
85
|
- - ">="
|
91
86
|
- !ruby/object:Gem::Version
|
92
|
-
version:
|
87
|
+
version: 3.0.0
|
93
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
89
|
requirements:
|
95
90
|
- - ">="
|
96
91
|
- !ruby/object:Gem::Version
|
97
|
-
version:
|
92
|
+
version: 2.0.0
|
98
93
|
requirements: []
|
99
|
-
rubygems_version: 3.
|
94
|
+
rubygems_version: 3.5.10
|
100
95
|
signing_key:
|
101
96
|
specification_version: 4
|
102
97
|
summary: A Ruby compiler for HTX templates.
|