forked from fdorg/flashdevelop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxhtmlwriter.rb
More file actions
138 lines (126 loc) · 1.76 KB
/
Copy pathxhtmlwriter.rb
File metadata and controls
138 lines (126 loc) · 1.76 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
module XHTMLWriter
private
TAGS = [
"br",
"span",
"abbr",
"acronym",
"cite",
"code",
"dfn",
"em",
"kbd",
"q",
"samp",
"strong",
"var",
"div",
"p",
"address",
"blockquote",
"pre",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"a",
"dl",
"dt",
"dd",
"ol",
"ul",
"li",
"ins",
"del",
"bdo",
"ruby",
"rbc",
"rtc",
"rb",
"rt",
"rp",
"b",
"big",
"i",
"small",
"sub",
"sup",
"tt",
"hr",
"link",
"meta",
"base",
"script",
"noscript",
"style",
"img",
"area",
"map",
"param",
"object",
"table",
"caption",
"thead",
"tfoot",
"tbody",
"colgroup",
"col",
"tr",
"th",
"td",
"form",
"label",
"input",
"select",
"optgroup",
"option",
"textarea",
"fieldset",
"legend",
"button",
"title",
"head",
"body",
"html"
]
TAGS << "frameset" << "noframes" << "frame"
TAGS.each do |name|
class_eval <<-HERE
def html_#{name}(*args)
if block_given?
@io.element("#{name}", *args) { yield }
else
if args.length == 0
@io.empty_tag("#{name}")
else
if args[0].instance_of?(String)
@io.simple_element("#{name}", *args)
else
@io.empty_tag("#{name}", *args)
end
end
end
end
HERE
end
public
def pcdata(text)
@io.pcdata(text)
end
def pi(text)
@io.pi(text)
end
def comment(text)
@io.comment(text)
end
def doctype(name, syspub, public_id, system_id)
@io.doctype(name, syspub, public_id, system_id)
end
def passthrough(text)
@io.passthrough(text)
end
def xml; @io end
end
# vim:sw=2