luoma 0.1.0
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 +7 -0
- checksums.yaml.gz.sig +2 -0
- data/.rdoc_options +16 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +68 -0
- data/Rakefile +69 -0
- data/Steepfile +41 -0
- data/certs/jgrp.pem +27 -0
- data/docs/configuration.md +180 -0
- data/docs/custom_filters.md +3 -0
- data/docs/custom_tags.md +3 -0
- data/docs/expressions.md +3 -0
- data/docs/extension_types.md +41 -0
- data/docs/filter_reference.md +1702 -0
- data/docs/index.md +73 -0
- data/docs/luoma_for_template_authors.md +3 -0
- data/docs/markdown.md +111 -0
- data/docs/predicate_reference.md +3 -0
- data/docs/static_analysis.md +3 -0
- data/docs/tag_reference.md +352 -0
- data/docs/template_loaders.md +177 -0
- data/docs/undefined_variables.md +3 -0
- data/docs-requirements.txt +11 -0
- data/docs_/cycle.md +17 -0
- data/docs_/font_rendering_example.md +157 -0
- data/docs_/header_block_example.md +51 -0
- data/docs_/increment_and_decrement.md +49 -0
- data/docs_/logo_style_example.md +40 -0
- data/docs_/migration.md +11 -0
- data/docs_/notes.md +19 -0
- data/lib/luoma/cache.rb +80 -0
- data/lib/luoma/chain_hash.rb +54 -0
- data/lib/luoma/context.rb +227 -0
- data/lib/luoma/drop.rb +84 -0
- data/lib/luoma/drops/block.rb +33 -0
- data/lib/luoma/drops/expression.rb +29 -0
- data/lib/luoma/drops/html_safe.rb +36 -0
- data/lib/luoma/drops/range.rb +69 -0
- data/lib/luoma/drops/undefined.rb +119 -0
- data/lib/luoma/environment.rb +479 -0
- data/lib/luoma/errors.rb +79 -0
- data/lib/luoma/escape.rb +35 -0
- data/lib/luoma/expression.rb +1271 -0
- data/lib/luoma/filter.rb +97 -0
- data/lib/luoma/filters/array.rb +372 -0
- data/lib/luoma/filters/date.rb +19 -0
- data/lib/luoma/filters/default.rb +16 -0
- data/lib/luoma/filters/json.rb +14 -0
- data/lib/luoma/filters/math.rb +84 -0
- data/lib/luoma/filters/size.rb +13 -0
- data/lib/luoma/filters/slice.rb +52 -0
- data/lib/luoma/filters/sort.rb +113 -0
- data/lib/luoma/filters/string.rb +186 -0
- data/lib/luoma/fnv.rb +15 -0
- data/lib/luoma/lexer.rb +106 -0
- data/lib/luoma/lexer_legacy.rb +396 -0
- data/lib/luoma/lexer_unified.rb +279 -0
- data/lib/luoma/loader.rb +50 -0
- data/lib/luoma/loaders/choice_loader.rb +20 -0
- data/lib/luoma/loaders/file_system_loader.rb +75 -0
- data/lib/luoma/loaders/mixins.rb +52 -0
- data/lib/luoma/markup.rb +109 -0
- data/lib/luoma/parser.rb +252 -0
- data/lib/luoma/parser_unified.rb +979 -0
- data/lib/luoma/predicates/blank.rb +19 -0
- data/lib/luoma/predicates/defined.rb +10 -0
- data/lib/luoma/predicates/empty.rb +15 -0
- data/lib/luoma/predicates/type.rb +35 -0
- data/lib/luoma/static_analysis.rb +427 -0
- data/lib/luoma/tags/assign.rb +63 -0
- data/lib/luoma/tags/break.rb +23 -0
- data/lib/luoma/tags/capture.rb +43 -0
- data/lib/luoma/tags/case.rb +137 -0
- data/lib/luoma/tags/comment.rb +17 -0
- data/lib/luoma/tags/continue.rb +23 -0
- data/lib/luoma/tags/define.rb +42 -0
- data/lib/luoma/tags/else.rb +30 -0
- data/lib/luoma/tags/for.rb +108 -0
- data/lib/luoma/tags/if.rb +109 -0
- data/lib/luoma/tags/import.rb +91 -0
- data/lib/luoma/tags/include.rb +77 -0
- data/lib/luoma/tags/output.rb +20 -0
- data/lib/luoma/tags/raw.rb +26 -0
- data/lib/luoma/tags/render.rb +92 -0
- data/lib/luoma/tags/with.rb +55 -0
- data/lib/luoma/template.rb +178 -0
- data/lib/luoma/token.rb +84 -0
- data/lib/luoma/version.rb +5 -0
- data/lib/luoma.rb +75 -0
- data/sig/luoma/cache.rbs +44 -0
- data/sig/luoma/chain_hash.rbs +26 -0
- data/sig/luoma/context.rbs +115 -0
- data/sig/luoma/drop.rbs +44 -0
- data/sig/luoma/drops/block.rbs +10 -0
- data/sig/luoma/drops/expression.rbs +10 -0
- data/sig/luoma/drops/html_safe.rbs +14 -0
- data/sig/luoma/drops/range.rbs +15 -0
- data/sig/luoma/drops/undefined.rbs +27 -0
- data/sig/luoma/environment.rbs +212 -0
- data/sig/luoma/errors.rbs +67 -0
- data/sig/luoma/escape.rbs +15 -0
- data/sig/luoma/expression.rbs +514 -0
- data/sig/luoma/filter.rbs +66 -0
- data/sig/luoma/filters/array.rbs +74 -0
- data/sig/luoma/filters/date.rbs +9 -0
- data/sig/luoma/filters/default.rbs +8 -0
- data/sig/luoma/filters/json.rbs +7 -0
- data/sig/luoma/filters/math.rbs +37 -0
- data/sig/luoma/filters/size.rbs +6 -0
- data/sig/luoma/filters/slice.rbs +10 -0
- data/sig/luoma/filters/sort.rbs +17 -0
- data/sig/luoma/filters/string.rbs +103 -0
- data/sig/luoma/fnv.rbs +3 -0
- data/sig/luoma/lexer.rbs +42 -0
- data/sig/luoma/lexer_legacy.rbs +81 -0
- data/sig/luoma/lexer_unified.rbs +49 -0
- data/sig/luoma/loader.rbs +40 -0
- data/sig/luoma/loaders/choice_loader.rbs +9 -0
- data/sig/luoma/loaders/file_system_loader.rbs +19 -0
- data/sig/luoma/loaders/mixins.rbs +16 -0
- data/sig/luoma/markup.rbs +68 -0
- data/sig/luoma/parser.rbs +105 -0
- data/sig/luoma/parser_unified.rbs +150 -0
- data/sig/luoma/predicates/blank.rbs +6 -0
- data/sig/luoma/predicates/defined.rbs +6 -0
- data/sig/luoma/predicates/empty.rbs +6 -0
- data/sig/luoma/predicates/type.rbs +21 -0
- data/sig/luoma/static_analysis.rbs +141 -0
- data/sig/luoma/tags/assign.rbs +12 -0
- data/sig/luoma/tags/break.rbs +11 -0
- data/sig/luoma/tags/capture.rbs +14 -0
- data/sig/luoma/tags/case.rbs +36 -0
- data/sig/luoma/tags/comment.rbs +11 -0
- data/sig/luoma/tags/continue.rbs +11 -0
- data/sig/luoma/tags/define.rbs +16 -0
- data/sig/luoma/tags/else.rbs +17 -0
- data/sig/luoma/tags/for.rbs +26 -0
- data/sig/luoma/tags/if.rbs +45 -0
- data/sig/luoma/tags/import.rbs +13 -0
- data/sig/luoma/tags/include.rbs +13 -0
- data/sig/luoma/tags/output.rbs +13 -0
- data/sig/luoma/tags/raw.rbs +11 -0
- data/sig/luoma/tags/render.rbs +13 -0
- data/sig/luoma/tags/with.rbs +15 -0
- data/sig/luoma/template.rbs +117 -0
- data/sig/luoma/token.rbs +81 -0
- data/sig/luoma.rbs +11 -0
- data/zensical.toml +363 -0
- data.tar.gz.sig +0 -0
- metadata +233 -0
- metadata.gz.sig +0 -0
data/sig/luoma/drop.rbs
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module Luoma
|
|
2
|
+
class Drop
|
|
3
|
+
include Enumerable[untyped]
|
|
4
|
+
|
|
5
|
+
# (untyped, RenderContext) -> bool
|
|
6
|
+
def key?: (untyped obj, Luoma::RenderContext context) -> bool
|
|
7
|
+
|
|
8
|
+
# (String, RenderContext) -> untyped
|
|
9
|
+
def fetch: (untyped name, Luoma::RenderContext context, ?default: untyped?) -> untyped
|
|
10
|
+
|
|
11
|
+
def each: () ?{ (?) -> untyped } -> untyped
|
|
12
|
+
|
|
13
|
+
def to_a: () -> Array[untyped]
|
|
14
|
+
|
|
15
|
+
# (untyped, RenderContext) -> bool
|
|
16
|
+
def eq?: (untyped obj, Luoma::RenderContext context) -> bool
|
|
17
|
+
|
|
18
|
+
# (untyped, RenderContext) -> bool
|
|
19
|
+
def lt?: (untyped obj, Luoma::RenderContext context) -> bool
|
|
20
|
+
|
|
21
|
+
# (untyped, RenderContext) -> bool
|
|
22
|
+
def gt?: (untyped obj, Luoma::RenderContext context) -> bool
|
|
23
|
+
|
|
24
|
+
# (untyped, RenderContext) -> bool
|
|
25
|
+
def contains?: (untyped obj, Luoma::RenderContext context) -> bool
|
|
26
|
+
|
|
27
|
+
# Return the length of this object.
|
|
28
|
+
# Along with `#slice`, `#length` is part of the iterator protocol.
|
|
29
|
+
# (RenderContext) -> Integer
|
|
30
|
+
def length: (Luoma::RenderContext context) -> Integer
|
|
31
|
+
|
|
32
|
+
# (Integer, Integer, Integer) -> Enumerable[untyped]
|
|
33
|
+
def slice: (Integer start, Integer stop, Integer step) -> untyped
|
|
34
|
+
|
|
35
|
+
# (:data | :numeric | :string | :boolean, RenderContext) -> untyped
|
|
36
|
+
def to_primitive: (:data | :numeric | :string | :boolean hint, Luoma::RenderContext context) -> untyped
|
|
37
|
+
|
|
38
|
+
# () -> String
|
|
39
|
+
def to_s: () -> String
|
|
40
|
+
|
|
41
|
+
# (RenderContext) -> String?
|
|
42
|
+
def render: (RenderContext context) -> String?
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Luoma
|
|
2
|
+
class HTMLSafe < Drop
|
|
3
|
+
@s: String
|
|
4
|
+
|
|
5
|
+
# (String | HTMLSafe) -> HTMLSafe
|
|
6
|
+
def self.escape: (String | HTMLSafe value) -> HTMLSafe
|
|
7
|
+
|
|
8
|
+
# (String | HTMLSafe) -> HTMLSafe
|
|
9
|
+
def self.from: (String | HTMLSafe value) -> HTMLSafe
|
|
10
|
+
|
|
11
|
+
# (String) -> void
|
|
12
|
+
def initialize: (String s) -> void
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module Luoma
|
|
2
|
+
attr_reader path: String
|
|
3
|
+
|
|
4
|
+
# The default and base "undefined" type.
|
|
5
|
+
class UndefinedDrop < Drop
|
|
6
|
+
@path: String
|
|
7
|
+
|
|
8
|
+
@token: t_token
|
|
9
|
+
|
|
10
|
+
@source: String
|
|
11
|
+
|
|
12
|
+
@template_name: String
|
|
13
|
+
|
|
14
|
+
# (String, t_token, String, String) -> void
|
|
15
|
+
def initialize: (String path, t_token token, String source, String template_name) -> void
|
|
16
|
+
|
|
17
|
+
# (untyped, RenderContext) -> bool
|
|
18
|
+
def eq?: (untyped obj, RenderContext context) -> bool
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
class StrictUndefinedDrop < UndefinedDrop
|
|
22
|
+
def error: () -> untyped
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
class FalsyStrictUndefinedDrop < StrictUndefinedDrop
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
module Luoma
|
|
2
|
+
type t_namespace = Hash[String, untyped]
|
|
3
|
+
|
|
4
|
+
interface _Namespace
|
|
5
|
+
def key?: (String) -> bool
|
|
6
|
+
def fetch: (String, ?::Symbol default) -> untyped
|
|
7
|
+
def []: (String) -> untyped
|
|
8
|
+
def nil?: () -> bool
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
interface _Lexer
|
|
12
|
+
def tokenize: (Environment, String) -> Array[t_token]
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
interface _Parser
|
|
16
|
+
def parse: (Environment, String, String, Array[t_token]) -> t_block
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
class Environment
|
|
20
|
+
@auto_trim: '-' | '~' | nil
|
|
21
|
+
|
|
22
|
+
@globals: t_namespace?
|
|
23
|
+
|
|
24
|
+
@lexer: _Lexer
|
|
25
|
+
|
|
26
|
+
@loader: TemplateLoader
|
|
27
|
+
|
|
28
|
+
@parser: _Parser
|
|
29
|
+
|
|
30
|
+
@strict: bool
|
|
31
|
+
|
|
32
|
+
@suppress_blank_control_flow_blocks: bool
|
|
33
|
+
|
|
34
|
+
@undefined: singleton(UndefinedDrop)
|
|
35
|
+
|
|
36
|
+
@tags: Hash[String, _Tag]
|
|
37
|
+
|
|
38
|
+
@filters: Hash[String, untyped]
|
|
39
|
+
|
|
40
|
+
@predicates: Hash[String, ^(untyped) -> bool]
|
|
41
|
+
|
|
42
|
+
@max_assign_score_cumulative: Integer?
|
|
43
|
+
|
|
44
|
+
@max_assign_score: Integer?
|
|
45
|
+
|
|
46
|
+
@max_context_depth: Integer
|
|
47
|
+
|
|
48
|
+
@max_render_score_cumulative: Integer?
|
|
49
|
+
|
|
50
|
+
@max_render_score: Integer?
|
|
51
|
+
|
|
52
|
+
@max_render_size: Integer?
|
|
53
|
+
|
|
54
|
+
@persistent_registers: Set[Symbol]
|
|
55
|
+
|
|
56
|
+
attr_accessor auto_trim: '-' | '~' | nil
|
|
57
|
+
|
|
58
|
+
attr_accessor globals: t_namespace?
|
|
59
|
+
|
|
60
|
+
attr_accessor lexer: _Lexer
|
|
61
|
+
|
|
62
|
+
attr_accessor loader: TemplateLoader
|
|
63
|
+
|
|
64
|
+
attr_accessor parser: _Parser
|
|
65
|
+
|
|
66
|
+
attr_reader filters: Hash[String, untyped]
|
|
67
|
+
|
|
68
|
+
attr_reader predicates: Hash[String, ^(untyped) -> bool]
|
|
69
|
+
|
|
70
|
+
attr_accessor strict: bool
|
|
71
|
+
|
|
72
|
+
attr_reader tags: Hash[String, _Tag]
|
|
73
|
+
|
|
74
|
+
attr_accessor undefined: singleton(UndefinedDrop)
|
|
75
|
+
|
|
76
|
+
attr_accessor max_assign_score_cumulative: Integer?
|
|
77
|
+
|
|
78
|
+
attr_accessor max_assign_score: Integer?
|
|
79
|
+
|
|
80
|
+
attr_accessor max_context_depth: Integer
|
|
81
|
+
|
|
82
|
+
attr_accessor max_render_score_cumulative: Integer?
|
|
83
|
+
|
|
84
|
+
attr_accessor max_render_score: Integer?
|
|
85
|
+
|
|
86
|
+
attr_accessor max_render_size: Integer?
|
|
87
|
+
|
|
88
|
+
attr_reader persistent_registers: Set[Symbol]
|
|
89
|
+
|
|
90
|
+
RE_INTEGER: Regexp
|
|
91
|
+
|
|
92
|
+
RE_DECIMAL: Regexp
|
|
93
|
+
|
|
94
|
+
def initialize: (
|
|
95
|
+
?auto_trim: ('-' | '~' | nil),
|
|
96
|
+
?globals: t_namespace?,
|
|
97
|
+
?lexer: _Lexer,
|
|
98
|
+
?loader: TemplateLoader?,
|
|
99
|
+
?parser: _Parser,
|
|
100
|
+
?strict: bool,
|
|
101
|
+
?suppress_blank_control_flow_blocks: bool,
|
|
102
|
+
?undefined: singleton(UndefinedDrop),
|
|
103
|
+
?max_assign_score_cumulative: Integer?,
|
|
104
|
+
?max_assign_score: Integer?,
|
|
105
|
+
?max_context_depth: Integer,
|
|
106
|
+
?max_render_score_cumulative: Integer?,
|
|
107
|
+
?max_render_score: Integer?,
|
|
108
|
+
?max_render_size: Integer?
|
|
109
|
+
) -> void
|
|
110
|
+
|
|
111
|
+
# (String,
|
|
112
|
+
# ?globals: t_namespace?,
|
|
113
|
+
# ?name: String?,
|
|
114
|
+
# ?overlay: t_namespace?,
|
|
115
|
+
# ?up_to_date: Proc::_Callable?) -> Template
|
|
116
|
+
def parse: (String source, ?globals: t_namespace?, ?name: String?, ?overlay: t_namespace?, ?up_to_date: untyped?) -> Template
|
|
117
|
+
|
|
118
|
+
# (String, ?t_namespace?) -> String
|
|
119
|
+
def render: (String source, ?t_namespace? data) -> String
|
|
120
|
+
|
|
121
|
+
# (String, ?globals: t_namespace?, ?context: RenderContext?, **untyped) -> Template
|
|
122
|
+
def get_template: (String name, ?globals: t_namespace?, ?context: RenderContext?, **untyped kwargs) -> Template
|
|
123
|
+
|
|
124
|
+
# Add or replace a filter. The same callable can be registered multiple
|
|
125
|
+
# times with different names.
|
|
126
|
+
#
|
|
127
|
+
# When evaluated as a filter, _callable_ will be called with an instance of
|
|
128
|
+
# `FilterContext` as the first argument, and the result of the expression
|
|
129
|
+
# to the left of the pipe operator as the second argument.
|
|
130
|
+
#
|
|
131
|
+
# Remaining positional and keyword arguments are passed through from the
|
|
132
|
+
# filter invocation.
|
|
133
|
+
#
|
|
134
|
+
#: (String, untyped) -> void
|
|
135
|
+
def register_filter: (String name, untyped callable) -> void
|
|
136
|
+
|
|
137
|
+
# Remove a filter from the filter register.
|
|
138
|
+
#: (String) -> untyped
|
|
139
|
+
def delete_filter: (String name) -> void
|
|
140
|
+
|
|
141
|
+
# Add or replace a tag.
|
|
142
|
+
#: (String, _Tag) -> void
|
|
143
|
+
def register_tag: (String name, _Tag tag) -> void
|
|
144
|
+
|
|
145
|
+
# Remove a tag from the tag register.
|
|
146
|
+
#: (String) -> (_Tag | nil)
|
|
147
|
+
def delete_tag: (String name) -> _Tag?
|
|
148
|
+
|
|
149
|
+
# Add or replace a predicate function.
|
|
150
|
+
#: (String, ^(untyped) -> bool) -> void
|
|
151
|
+
def register_predicate: (String name, untyped callable) -> void
|
|
152
|
+
|
|
153
|
+
# Remove a predicate from the predicate register.
|
|
154
|
+
#: (String) -> (^(untyped) -> bool | nil)
|
|
155
|
+
def delete_predicate: (String name) -> untyped
|
|
156
|
+
|
|
157
|
+
# () -> void
|
|
158
|
+
def setup_tags_filters_and_predicates: () -> void
|
|
159
|
+
|
|
160
|
+
# (untyped, untyped, RenderContext, t_token) -> bool
|
|
161
|
+
def contains?: (untyped left, untyped right, RenderContext context, t_token token) -> bool
|
|
162
|
+
|
|
163
|
+
# (untyped, untyped, RenderContext, t_token) -> bool
|
|
164
|
+
def eq?: (untyped left, untyped right, RenderContext context, t_token token) -> bool
|
|
165
|
+
|
|
166
|
+
# (untyped, untyped, RenderContext, t_token) -> bool?
|
|
167
|
+
def lt?: (untyped left, untyped right, RenderContext context, t_token token) -> bool?
|
|
168
|
+
|
|
169
|
+
# (untyped, untyped, RenderContext, t_token) -> (-1 | 1 | 0 | nil)
|
|
170
|
+
def cmp: (untyped left, untyped right, RenderContext context, t_token token) -> (-1 | 1 | 0 | nil)
|
|
171
|
+
|
|
172
|
+
# (untyped) -> bool
|
|
173
|
+
def nothing?: (untyped obj) -> bool
|
|
174
|
+
|
|
175
|
+
# (untyped, RenderContext) -> bool
|
|
176
|
+
def truthy?: (untyped obj, RenderContext context) -> bool
|
|
177
|
+
|
|
178
|
+
# (untyped, RenderContext) -> String
|
|
179
|
+
def serialize: (untyped obj, RenderContext context) -> String
|
|
180
|
+
|
|
181
|
+
# (untyped, RenderContext) -> Array[untyped]
|
|
182
|
+
def to_a: (untyped obj, RenderContext context) -> Array[untyped]
|
|
183
|
+
|
|
184
|
+
# (untyped, RenderContext) -> Hash[untyped, untyped]
|
|
185
|
+
def to_h: (untyped obj, RenderContext context) -> Hash[untyped, untyped]
|
|
186
|
+
|
|
187
|
+
# [X] (untyped, RenderContext, ?default: X) -> (Integer | X)
|
|
188
|
+
def to_i: [X] (untyped obj, RenderContext context, ?default: X) -> (Integer | X)
|
|
189
|
+
|
|
190
|
+
# [X] (untyped, RenderContext, ?default: X) -> (Numeric | X)
|
|
191
|
+
def to_numeric: [X] (untyped obj, RenderContext context, ?default: X) -> (Numeric | X)
|
|
192
|
+
|
|
193
|
+
# (untyped, RenderContext) -> Enumerable
|
|
194
|
+
def to_enumerable: (untyped obj, RenderContext context) -> Enumerable[untyped]
|
|
195
|
+
|
|
196
|
+
# (untyped, RenderContext) -> String
|
|
197
|
+
def to_string: (untyped obj, RenderContext context) -> String
|
|
198
|
+
|
|
199
|
+
# Cast _obj_ to a date and time. Return `nil` if casting fails.
|
|
200
|
+
# NOTE: This was copied from Shopify/liquid.
|
|
201
|
+
def to_date: (untyped obj, RenderContext context) -> untyped
|
|
202
|
+
|
|
203
|
+
# (String, String?, String?) -> String
|
|
204
|
+
def trim: (String value, String? left, String? right) -> String
|
|
205
|
+
|
|
206
|
+
# (t_namespace?) -> t_namespace?
|
|
207
|
+
def make_globals: (t_namespace? namespace) -> t_namespace?
|
|
208
|
+
|
|
209
|
+
# (untyped, RenderContext) -> untyped
|
|
210
|
+
def to_data: (untyped obj, RenderContext context) -> untyped
|
|
211
|
+
end
|
|
212
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
module Luoma
|
|
2
|
+
# The base class for all template errors.
|
|
3
|
+
class LuomaError < StandardError
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
class DetailedLuomaError < LuomaError
|
|
7
|
+
@token: t_token
|
|
8
|
+
|
|
9
|
+
@template_name: String
|
|
10
|
+
|
|
11
|
+
@source: String
|
|
12
|
+
|
|
13
|
+
attr_accessor token: t_token
|
|
14
|
+
|
|
15
|
+
attr_accessor template_name: String
|
|
16
|
+
|
|
17
|
+
attr_accessor source: String
|
|
18
|
+
|
|
19
|
+
def initialize: (String message, t_token token, String source, String template_name) -> void
|
|
20
|
+
|
|
21
|
+
def detailed_message: (?highlight: bool, **untyped kwargs) -> String
|
|
22
|
+
|
|
23
|
+
def error_context: (String source, Integer index) -> [Integer, Integer, String]
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
class DisabledTagError < DetailedLuomaError
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
class FilterArgumentError < DetailedLuomaError
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
class FilterNotFoundError < DetailedLuomaError
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
class PredicateNotFoundError < DetailedLuomaError
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
class RequiredBlockError < TemplateInheritanceError
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
class ResourceLimitError < LuomaError
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
class ContextDepthError < ResourceLimitError
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
class TemplateInheritanceError < DetailedLuomaError
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
class TemplateNotFoundError < LuomaError
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
class NoSuchTemplateError < DetailedLuomaError
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
class TemplateSyntaxError < DetailedLuomaError
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
class TemplateTypeError < DetailedLuomaError
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
class UndefinedVariableError < DetailedLuomaError
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
class IncomparableValuesError < LuomaError
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Luoma
|
|
2
|
+
RE_ESCAPE: ::Regexp
|
|
3
|
+
|
|
4
|
+
ESCAPE_MAP: Hash[String, String]
|
|
5
|
+
|
|
6
|
+
RE_UNESCAPE: ::Regexp
|
|
7
|
+
|
|
8
|
+
UNESCAPE_MAP: Hash[String, String]
|
|
9
|
+
|
|
10
|
+
# (String) -> String
|
|
11
|
+
def self.escape: (String s) -> String
|
|
12
|
+
|
|
13
|
+
# (String) -> String
|
|
14
|
+
def self.unescape: (String s) -> String
|
|
15
|
+
end
|