File tree 2 files changed +42
-0
lines changed
2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ REBOL [
49
49
%mezz-colors.r
50
50
%mezz-crypt.r
51
51
%mezz-date.r ; Internet date support
52
+ ;%mezz-tag.r ; build-tag
52
53
%mezz-tail.r
53
54
%codec-json.r
54
55
%codec-unixtime.r
Original file line number Diff line number Diff line change
1
+ REBOL [
2
+ System: "REBOL [R3] Language Interpreter and Run-time Environment"
3
+ Title: "REBOL 3 Mezzanine: Tag"
4
+ Rights: {
5
+ Copyright 2012 REBOL Technologies
6
+ REBOL is a trademark of REBOL Technologies
7
+ }
8
+ License: {
9
+ Licensed under the Apache License, Version 2.0
10
+ See: http://www.apache.org/licenses/LICENSE-2.0
11
+ }
12
+ ]
13
+
14
+ build-tag : func [
15
+ "Generates a tag from a composed block."
16
+ values [block! ] "Block of parens to evaluate and other data."
17
+ /local tag value-rule xml? name attribute value
18
+ ] [ ;@@ slightly modified version from Rebol2
19
+ tag: make string! 7 * length? values
20
+ value-rule: [
21
+ set value issue! (value: mold value)
22
+ | set value file! (value: replace/all copy value #" " "%20" )
23
+ | set value any-type! (value: replace/all form value #"'" {\'} )
24
+ ]
25
+ xml?: false
26
+ parse compose values [
27
+ [
28
+ set name ['?xml (xml?: true) | word! | url! ] (append tag name)
29
+ any [
30
+ set attribute [word! | url! ] value-rule (
31
+ append tag ajoin [#" " attribute {='} value #"'" ]
32
+ )
33
+ | value-rule (append tag join #" " value)
34
+ ]
35
+ end (if xml? [append tag #"?" ])
36
+ ]
37
+ |
38
+ [set name refinement! to end (tag: mold name)]
39
+ ]
40
+ to tag! tag
41
+ ]
You can’t perform that action at this time.
0 commit comments