File tree Expand file tree Collapse file tree 3 files changed +24
-65
lines changed Expand file tree Collapse file tree 3 files changed +24
-65
lines changed Original file line number Diff line number Diff line change @@ -126,37 +126,6 @@ function export.declare_generator(func)
126
126
127
127
Allows you to create a function in which the ` _ENV ` is overloaded with the ` xml ` table. This allows you to write XML more concisely (see example above).
128
128
129
- ### ` xml_gen.html_table `
130
- ``` lua
131
- --- @generic TKey , TValue
132
- --- @param tbl { [TKey] : TValue },
133
- --- @param order TKey[] ?
134
- --- @param classes { table : string ?, tr : string ?, td : string ? }?
135
- --- @return XML.Node
136
- function export .html_table (tbl , order , classes )
137
- ```
138
-
139
- Creates an HTML table based off a lua table. This is unstyled, so you will need to add your own CSS.
140
-
141
- ``` lua
142
-
143
- local my_table = {
144
- key = " value" ,
145
- sub = {
146
- key = " value" ,
147
- }
148
- }
149
-
150
- local tbl = xml_gen .html_table (my_table , { " key" , " sub" }, {
151
- table = " my-table" ,
152
- tr = " my-table-row" ,
153
- td = " my-table-cell" ,
154
- })
155
-
156
- print (tbl )
157
-
158
- ```
159
-
160
129
### ` xml_gen.style `
161
130
``` lua
162
131
--- @param css { [string | string[]] : { [string | string[]] : (number | string | string[] ) } }
@@ -186,6 +155,18 @@ local style = xml_gen.style {
186
155
print (style )
187
156
```
188
157
158
+ ### ` xml_gen.raw `
159
+ ``` lua
160
+ --- WILL NOT BE SANITIZED
161
+ --- @param ... string
162
+ --- @return string[]
163
+ function export .raw (...) end
164
+ ```
165
+
166
+ Inserts raw (NOT SANITIZED) strings into the document.
167
+
168
+ ``` lua
169
+
189
170
## API
190
171
191
172
You do not need to generate XML with this library , instead , you can use an ` XML.Node` as its own object .
Original file line number Diff line number Diff line change @@ -15,40 +15,13 @@ local doc = xml.html {charset="utf-8", lang="en"} {
15
15
end
16
16
end
17
17
}
18
- }
18
+ };
19
+
20
+ xml_gen .raw [[
21
+ <script>
22
+ console.log("Hello, World!");
23
+ </script>
24
+ ]]
19
25
}
20
26
21
27
print (doc )
22
-
23
- -- local my_table = {
24
- -- key = "value",
25
- -- sub = {
26
- -- key = "value",
27
- -- }
28
- -- }
29
-
30
- -- local tbl = xml_gen.html_table(my_table, { "key", "sub" }, {
31
- -- table = "my-table",
32
- -- tr = "my-table-row",
33
- -- td = "my-table-cell",
34
- -- })
35
-
36
- -- print(tbl)
37
-
38
- -- local xml_gen = require("xml-generator")
39
-
40
- -- local style = xml_gen.style {
41
- -- [{ "body", "html" }] = {
42
- -- margin = 0,
43
- -- padding = 0,
44
- -- },
45
-
46
- -- body = {
47
- -- background = "#000",
48
- -- color = "#fff",
49
- -- }
50
-
51
- -- --etc
52
- -- }
53
-
54
- -- print(style)
Original file line number Diff line number Diff line change @@ -322,4 +322,9 @@ function export.namespace(ns, sep)
322
322
})
323
323
end
324
324
325
+ --- WILL NOT BE SANITIZED
326
+ --- @param ... string
327
+ --- @return string[]
328
+ function export .raw (...) return stringable_array { ... } end
329
+
325
330
return export
You can’t perform that action at this time.
0 commit comments