-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathxml.tag.fmfn
31 lines (24 loc) · 847 Bytes
/
xml.tag.fmfn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
=====================================================
xml.tag ( tag; attributes; value )
RETURNS: (string) Valid XML tag with attributes
DEPS: none
NOTES: http://www.w3.org/TR/xml/
=====================================================
*/
Let ( [
var.tag.cleaned = Filter ( tag ; "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz" );
var.value.cleaned = Substitute( value;
["|";" "]; /* pipe */
[" ";" "]; /* shift-space */
["&";"&"];
["<";"<"];
[">";">"];
["\"";"""];
["'";"'"]
)
];
"<" & var.tag.cleaned & attributes & ">" & var.value.cleaned & "</" & var.tag.cleaned & ">"
)
// TODO:
// Not currently validating that attributes are properly formatted - just passing them through