markaby 0.2 → 0.3
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.
- data/README +189 -0
- data/Rakefile +15 -0
- data/doc/rdoc/classes/Markaby.html +192 -0
- data/doc/rdoc/classes/Markaby/ActionControllerHelper.html +145 -0
- data/doc/rdoc/classes/Markaby/ActionControllerHelper.src/M000005.html +20 -0
- data/doc/rdoc/classes/Markaby/Builder.html +480 -0
- data/doc/rdoc/classes/Markaby/Builder.src/M000008.html +44 -0
- data/doc/rdoc/classes/Markaby/Builder.src/M000009.html +18 -0
- data/doc/rdoc/classes/Markaby/Builder.src/M000010.html +19 -0
- data/doc/rdoc/classes/Markaby/Builder.src/M000012.html +24 -0
- data/doc/rdoc/classes/Markaby/Builder.src/M000013.html +18 -0
- data/doc/rdoc/classes/Markaby/Builder.src/M000014.html +22 -0
- data/doc/rdoc/classes/Markaby/Builder.src/M000015.html +38 -0
- data/doc/rdoc/classes/Markaby/Builder.src/M000016.html +18 -0
- data/doc/rdoc/classes/Markaby/Builder.src/M000017.html +18 -0
- data/doc/rdoc/classes/Markaby/Builder.src/M000018.html +21 -0
- data/doc/rdoc/classes/Markaby/Builder.src/M000019.html +24 -0
- data/doc/rdoc/classes/Markaby/Builder.src/M000021.html +18 -0
- data/doc/rdoc/classes/Markaby/CssProxy.html +177 -0
- data/doc/rdoc/classes/Markaby/CssProxy.src/M000006.html +19 -0
- data/doc/rdoc/classes/Markaby/CssProxy.src/M000007.html +33 -0
- data/doc/rdoc/classes/Markaby/Template.html +156 -0
- data/doc/rdoc/classes/Markaby/Template.src/M000022.html +18 -0
- data/doc/rdoc/classes/Markaby/Template.src/M000023.html +20 -0
- data/doc/rdoc/classes/Markaby/View.html +156 -0
- data/doc/rdoc/classes/Markaby/View.src/M000024.html +18 -0
- data/doc/rdoc/classes/Markaby/View.src/M000025.html +18 -0
- data/doc/rdoc/classes/Object.html +199 -0
- data/doc/rdoc/classes/Object.src/M000001.html +16 -0
- data/doc/rdoc/classes/Object.src/M000002.html +16 -0
- data/doc/rdoc/classes/Object.src/M000003.html +18 -0
- data/doc/rdoc/classes/Object.src/M000004.html +18 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/CHANGELOG.html +136 -0
- data/doc/rdoc/files/README.html +326 -0
- data/doc/rdoc/files/lib/markaby/builder_rb.html +101 -0
- data/doc/rdoc/files/lib/markaby/cssproxy_rb.html +101 -0
- data/doc/rdoc/files/lib/markaby/helper_rb.html +101 -0
- data/doc/rdoc/files/lib/markaby/metaid_rb.html +107 -0
- data/doc/rdoc/files/lib/markaby/tags_rb.html +101 -0
- data/doc/rdoc/files/lib/markaby/template_rb.html +101 -0
- data/doc/rdoc/files/lib/markaby/view_rb.html +101 -0
- data/doc/rdoc/files/lib/markaby_rb.html +127 -0
- data/doc/rdoc/fr_class_index.html +33 -0
- data/doc/rdoc/fr_file_index.html +36 -0
- data/doc/rdoc/fr_method_index.html +51 -0
- data/doc/rdoc/index.html +24 -0
- data/doc/rdoc/rdoc-style.css +208 -0
- data/lib/markaby.rb +19 -1
- data/lib/markaby/builder.rb +106 -28
- data/lib/markaby/cssproxy.rb +9 -0
- data/lib/markaby/helper.rb +14 -0
- data/lib/markaby/tags.rb +3 -19
- data/setup.rb +1551 -0
- data/test/test_markaby.rb +53 -0
- data/tools/rakehelp.rb +100 -0
- metadata +103 -35
data/doc/rdoc/index.html
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
|
5
|
+
|
6
|
+
<!--
|
7
|
+
|
8
|
+
RDoc Documentation
|
9
|
+
|
10
|
+
-->
|
11
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
12
|
+
<head>
|
13
|
+
<title>RDoc Documentation</title>
|
14
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
15
|
+
</head>
|
16
|
+
<frameset rows="20%, 80%">
|
17
|
+
<frameset cols="25%,35%,45%">
|
18
|
+
<frame src="fr_file_index.html" title="Files" name="Files" />
|
19
|
+
<frame src="fr_class_index.html" name="Classes" />
|
20
|
+
<frame src="fr_method_index.html" name="Methods" />
|
21
|
+
</frameset>
|
22
|
+
<frame src="files/README.html" name="docwin" />
|
23
|
+
</frameset>
|
24
|
+
</html>
|
@@ -0,0 +1,208 @@
|
|
1
|
+
|
2
|
+
body {
|
3
|
+
font-family: Verdana,Arial,Helvetica,sans-serif;
|
4
|
+
font-size: 90%;
|
5
|
+
margin: 0;
|
6
|
+
margin-left: 40px;
|
7
|
+
padding: 0;
|
8
|
+
background: white;
|
9
|
+
}
|
10
|
+
|
11
|
+
h1,h2,h3,h4 { margin: 0; color: #efefef; background: transparent; }
|
12
|
+
h1 { font-size: 150%; }
|
13
|
+
h2,h3,h4 { margin-top: 1em; }
|
14
|
+
|
15
|
+
a { background: #eef; color: #039; text-decoration: none; }
|
16
|
+
a:hover { background: #039; color: #eef; }
|
17
|
+
|
18
|
+
/* Override the base stylesheet's Anchor inside a table cell */
|
19
|
+
td > a {
|
20
|
+
background: transparent;
|
21
|
+
color: #039;
|
22
|
+
text-decoration: none;
|
23
|
+
}
|
24
|
+
|
25
|
+
/* and inside a section title */
|
26
|
+
.section-title > a {
|
27
|
+
background: transparent;
|
28
|
+
color: #eee;
|
29
|
+
text-decoration: none;
|
30
|
+
}
|
31
|
+
|
32
|
+
/* === Structural elements =================================== */
|
33
|
+
|
34
|
+
div#index {
|
35
|
+
margin: 0;
|
36
|
+
margin-left: -40px;
|
37
|
+
padding: 0;
|
38
|
+
font-size: 90%;
|
39
|
+
}
|
40
|
+
|
41
|
+
|
42
|
+
div#index a {
|
43
|
+
margin-left: 0.7em;
|
44
|
+
}
|
45
|
+
|
46
|
+
div#index .section-bar {
|
47
|
+
margin-left: 0px;
|
48
|
+
padding-left: 0.7em;
|
49
|
+
background: #ccc;
|
50
|
+
font-size: small;
|
51
|
+
}
|
52
|
+
|
53
|
+
|
54
|
+
div#classHeader, div#fileHeader {
|
55
|
+
width: auto;
|
56
|
+
color: white;
|
57
|
+
padding: 0.5em 1.5em 0.5em 1.5em;
|
58
|
+
margin: 0;
|
59
|
+
margin-left: -40px;
|
60
|
+
border-bottom: 3px solid #006;
|
61
|
+
}
|
62
|
+
|
63
|
+
div#classHeader a, div#fileHeader a {
|
64
|
+
background: inherit;
|
65
|
+
color: white;
|
66
|
+
}
|
67
|
+
|
68
|
+
div#classHeader td, div#fileHeader td {
|
69
|
+
background: inherit;
|
70
|
+
color: white;
|
71
|
+
}
|
72
|
+
|
73
|
+
|
74
|
+
div#fileHeader {
|
75
|
+
background: #057;
|
76
|
+
}
|
77
|
+
|
78
|
+
div#classHeader {
|
79
|
+
background: #048;
|
80
|
+
}
|
81
|
+
|
82
|
+
|
83
|
+
.class-name-in-header {
|
84
|
+
font-size: 180%;
|
85
|
+
font-weight: bold;
|
86
|
+
}
|
87
|
+
|
88
|
+
|
89
|
+
div#bodyContent {
|
90
|
+
padding: 0 1.5em 0 1.5em;
|
91
|
+
}
|
92
|
+
|
93
|
+
div#description {
|
94
|
+
padding: 0.5em 1.5em;
|
95
|
+
background: #efefef;
|
96
|
+
border: 1px dotted #999;
|
97
|
+
}
|
98
|
+
|
99
|
+
div#description h1,h2,h3,h4,h5,h6 {
|
100
|
+
color: #125;;
|
101
|
+
background: transparent;
|
102
|
+
}
|
103
|
+
|
104
|
+
div#validator-badges {
|
105
|
+
text-align: center;
|
106
|
+
}
|
107
|
+
div#validator-badges img { border: 0; }
|
108
|
+
|
109
|
+
div#copyright {
|
110
|
+
color: #333;
|
111
|
+
background: #efefef;
|
112
|
+
font: 0.75em sans-serif;
|
113
|
+
margin-top: 5em;
|
114
|
+
margin-bottom: 0;
|
115
|
+
padding: 0.5em 2em;
|
116
|
+
}
|
117
|
+
|
118
|
+
|
119
|
+
/* === Classes =================================== */
|
120
|
+
|
121
|
+
table.header-table {
|
122
|
+
color: white;
|
123
|
+
font-size: small;
|
124
|
+
}
|
125
|
+
|
126
|
+
.type-note {
|
127
|
+
font-size: small;
|
128
|
+
color: #DEDEDE;
|
129
|
+
}
|
130
|
+
|
131
|
+
.xxsection-bar {
|
132
|
+
background: #eee;
|
133
|
+
color: #333;
|
134
|
+
padding: 3px;
|
135
|
+
}
|
136
|
+
|
137
|
+
.section-bar {
|
138
|
+
color: #333;
|
139
|
+
border-bottom: 1px solid #999;
|
140
|
+
margin-left: -20px;
|
141
|
+
}
|
142
|
+
|
143
|
+
|
144
|
+
.section-title {
|
145
|
+
background: #79a;
|
146
|
+
color: #eee;
|
147
|
+
padding: 3px;
|
148
|
+
margin-top: 2em;
|
149
|
+
margin-left: -30px;
|
150
|
+
border: 1px solid #999;
|
151
|
+
}
|
152
|
+
|
153
|
+
.top-aligned-row { vertical-align: top }
|
154
|
+
.bottom-aligned-row { vertical-align: bottom }
|
155
|
+
|
156
|
+
/* --- Context section classes ----------------------- */
|
157
|
+
|
158
|
+
.context-row { }
|
159
|
+
.context-item-name { font-family: monospace; font-weight: bold; color: black; }
|
160
|
+
.context-item-value { font-size: small; color: #448; }
|
161
|
+
.context-item-desc { color: #333; padding-left: 2em; }
|
162
|
+
|
163
|
+
/* --- Method classes -------------------------- */
|
164
|
+
.method-detail {
|
165
|
+
background: #efefef;
|
166
|
+
padding: 0;
|
167
|
+
margin-top: 0.5em;
|
168
|
+
margin-bottom: 1em;
|
169
|
+
border: 1px dotted #ccc;
|
170
|
+
}
|
171
|
+
.method-heading {
|
172
|
+
color: black;
|
173
|
+
background: #ccc;
|
174
|
+
border-bottom: 1px solid #666;
|
175
|
+
padding: 0.2em 0.5em 0 0.5em;
|
176
|
+
}
|
177
|
+
.method-signature { color: black; background: inherit; }
|
178
|
+
.method-name { font-weight: bold; }
|
179
|
+
.method-args { font-style: italic; }
|
180
|
+
.method-description { padding: 0 0.5em 0 0.5em; }
|
181
|
+
|
182
|
+
/* --- Source code sections -------------------- */
|
183
|
+
|
184
|
+
a.source-toggle { font-size: 90%; }
|
185
|
+
div.method-source-code {
|
186
|
+
background: #262626;
|
187
|
+
color: #ffdead;
|
188
|
+
margin: 1em;
|
189
|
+
padding: 0.5em;
|
190
|
+
border: 1px dashed #999;
|
191
|
+
overflow: hidden;
|
192
|
+
}
|
193
|
+
|
194
|
+
div.method-source-code pre { color: #ffdead; overflow: hidden; }
|
195
|
+
|
196
|
+
/* --- Ruby keyword styles --------------------- */
|
197
|
+
|
198
|
+
.standalone-code { background: #221111; color: #ffdead; overflow: hidden; }
|
199
|
+
|
200
|
+
.ruby-constant { color: #7fffd4; background: transparent; }
|
201
|
+
.ruby-keyword { color: #00ffff; background: transparent; }
|
202
|
+
.ruby-ivar { color: #eedd82; background: transparent; }
|
203
|
+
.ruby-operator { color: #00ffee; background: transparent; }
|
204
|
+
.ruby-identifier { color: #ffdead; background: transparent; }
|
205
|
+
.ruby-node { color: #ffa07a; background: transparent; }
|
206
|
+
.ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
|
207
|
+
.ruby-regexp { color: #ffa07a; background: transparent; }
|
208
|
+
.ruby-value { color: #7fffd4; background: transparent; }
|
data/lib/markaby.rb
CHANGED
@@ -1,7 +1,25 @@
|
|
1
|
+
# = About lib/markany.rb
|
2
|
+
#
|
3
|
+
# By requiring <tt>lib/markaby</tt>, you can load Markaby's dependency (the Builder library,)
|
4
|
+
# as well as the full set of Markaby classes.
|
5
|
+
#
|
6
|
+
# For a full list of features and instructions, see the README.
|
1
7
|
$:.unshift File.expand_path(File.dirname(__FILE__))
|
2
8
|
|
9
|
+
# Markaby is a module containing all of the great Markaby classes that
|
10
|
+
# do such an excellent job.
|
11
|
+
#
|
12
|
+
# * Markaby::Builder: the class for actually calling the Ruby methods
|
13
|
+
# which write the HTML.
|
14
|
+
# * Markaby::CSSProxy: a class which adds element classes and IDs to
|
15
|
+
# elements when used within Markaby::Builder.
|
16
|
+
# * Markaby::MetAid: metaprogramming helper methods.
|
17
|
+
# * Markaby::Tags: lists the roles of various XHTML tags to help Builder
|
18
|
+
# use these tags as they are intended.
|
19
|
+
# * Markaby::Template: a class for hooking Markaby into Rails as a
|
20
|
+
# proper templating language.
|
3
21
|
module Markaby
|
4
|
-
VERSION = '0.
|
22
|
+
VERSION = '0.3'
|
5
23
|
end
|
6
24
|
|
7
25
|
unless defined?(Builder)
|
data/lib/markaby/builder.rb
CHANGED
@@ -1,21 +1,62 @@
|
|
1
1
|
module Markaby
|
2
|
+
# The Markaby::Builder class is the central gear in the system. When using
|
3
|
+
# from Ruby code, this is the only class you need to instantiate directly.
|
4
|
+
#
|
5
|
+
# mab = Markaby::Builder.new
|
6
|
+
# mab.html do
|
7
|
+
# head { title "Boats.com" }
|
8
|
+
# body do
|
9
|
+
# h1 "Boats.com has great deals"
|
10
|
+
# ul do
|
11
|
+
# li "$49 for a canoe"
|
12
|
+
# li "$39 for a raft"
|
13
|
+
# li "$29 for a huge boot that floats and can fit 5 people"
|
14
|
+
# end
|
15
|
+
# end
|
16
|
+
# end
|
17
|
+
# puts mab.to_s
|
18
|
+
#
|
2
19
|
class Builder
|
3
20
|
|
4
21
|
attr_accessor :output_helpers
|
5
22
|
|
6
|
-
|
7
|
-
|
8
|
-
|
23
|
+
# Create a Markaby builder object. Pass in a hash of variable assignments to
|
24
|
+
# +assigns+ which will be available as instance variables inside tag construction
|
25
|
+
# blocks. If an object is passed in to +helpers+, its methods will be available
|
26
|
+
# from those same blocks.
|
27
|
+
#
|
28
|
+
# Pass in a +block+ to new and the block will be evaluated.
|
29
|
+
#
|
30
|
+
# mab = Markaby::Builder.new {
|
31
|
+
# html do
|
32
|
+
# body do
|
33
|
+
# h1 "Matching Mole"
|
34
|
+
# end
|
35
|
+
# end
|
36
|
+
# }
|
37
|
+
#
|
38
|
+
def initialize(assigns = {}, helpers = nil, &block)
|
9
39
|
@stream = []
|
40
|
+
@assigns = assigns
|
10
41
|
@builder = ::Builder::XmlMarkup.new(:indent => 2, :target => @stream)
|
11
42
|
@output_helpers = true
|
12
43
|
|
13
|
-
|
14
|
-
|
44
|
+
if helpers.nil?
|
45
|
+
@helpers = nil
|
46
|
+
else
|
47
|
+
@helpers = helpers.dup
|
48
|
+
for iv in helpers.instance_variables
|
49
|
+
instance_variable_set(iv, helpers.instance_variable_get(iv))
|
50
|
+
end
|
15
51
|
end
|
16
|
-
|
17
|
-
|
18
|
-
|
52
|
+
|
53
|
+
unless assigns.nil? || assigns.empty?
|
54
|
+
for iv, val in assigns
|
55
|
+
instance_variable_set("@#{iv}", val)
|
56
|
+
unless @helpers.nil?
|
57
|
+
@helpers.instance_variable_set("@#{iv}", val)
|
58
|
+
end
|
59
|
+
end
|
19
60
|
end
|
20
61
|
|
21
62
|
if block
|
@@ -24,16 +65,24 @@ module Markaby
|
|
24
65
|
end
|
25
66
|
end
|
26
67
|
|
68
|
+
# Returns a string containing the HTML stream. Internally, the stream is stored as an Array.
|
27
69
|
def to_s
|
28
|
-
@builder.target
|
70
|
+
@builder.target!.join
|
29
71
|
end
|
30
72
|
|
73
|
+
# Write a +string+ to the HTML stream without escaping it.
|
31
74
|
def text(string)
|
32
75
|
@builder << "#{string}"
|
33
76
|
nil
|
34
77
|
end
|
35
78
|
alias_method :<<, :text
|
36
79
|
|
80
|
+
# Captures the HTML code built inside the +block+. This is done by creating a new
|
81
|
+
# builder object, running the block and passing back its stream as a string.
|
82
|
+
#
|
83
|
+
# >> Markaby::Builder.new.capture { h1 "TEST"; h2 "CAPTURE ME" }
|
84
|
+
# => "<h1>TITLE</h1>\n<h2>CAPTURE ME</h2>\n"
|
85
|
+
#
|
37
86
|
def capture(&block)
|
38
87
|
assigns = instance_variables.inject({}) do |hsh, iv|
|
39
88
|
unless ['@stream', '@builder', '@assigns', '@helpers'].include?(iv)
|
@@ -44,10 +93,25 @@ module Markaby
|
|
44
93
|
self.class.new(assigns, @helpers, &block).to_s
|
45
94
|
end
|
46
95
|
|
96
|
+
# Content_for will store the given block in an instance variable for later use
|
97
|
+
# in another template or in the layout.
|
98
|
+
#
|
99
|
+
# The name of the instance variable is content_for_<name> to stay consistent
|
100
|
+
# with @content_for_layout which is used by ActionView's layouts.
|
101
|
+
#
|
102
|
+
# Example:
|
103
|
+
#
|
104
|
+
# content_for("header") do
|
105
|
+
# h1 "Half Shark and Half Lion"
|
106
|
+
# end
|
107
|
+
#
|
108
|
+
# If used several times, the variable will contain all the parts concatenated.
|
47
109
|
def content_for(name, &block)
|
48
110
|
eval "@content_for_#{name} = (@content_for_#{name} || '') + capture(&block)"
|
49
111
|
end
|
50
112
|
|
113
|
+
# Create a tag named +tag+. Other than the first argument which is the tag name,
|
114
|
+
# the arguments are the same as the tags implemented via method_missing.
|
51
115
|
def tag!(tag, *args, &block)
|
52
116
|
if block
|
53
117
|
str = capture &block
|
@@ -56,33 +120,42 @@ module Markaby
|
|
56
120
|
@builder.method_missing(tag, *args, &block)
|
57
121
|
end
|
58
122
|
|
59
|
-
|
123
|
+
# Create XML markup based on the name of the method +sym+. This method is never
|
124
|
+
# invoked directly, but is called for each markup method in the markup block.
|
125
|
+
#
|
126
|
+
# This method is also used to intercept calls to helper methods and instance
|
127
|
+
# variables. Here is the order of interception:
|
128
|
+
#
|
129
|
+
# * If +sym+ is a recognized HTML tag, the tag is output
|
130
|
+
# or a CssProxy is returned if no arguments are given.
|
131
|
+
# * If +sym+ appears to be a self-closing tag, its block
|
132
|
+
# is ignored, thus outputting a valid self-closing tag.
|
133
|
+
# * If +sym+ is also the name of an instance variable, the
|
134
|
+
# value of the instance variable is returned.
|
135
|
+
# * If +sym+ is a helper method, the helper method is called
|
136
|
+
# and output to the stream.
|
137
|
+
# * Otherwise, +sym+ and its arguments are passed to tag!
|
138
|
+
def method_missing(sym, *args, &block)
|
60
139
|
args.each do |arg|
|
61
140
|
@stream.delete_if { |x| x.object_id == arg.object_id }
|
62
141
|
end
|
63
|
-
|
64
|
-
if (TAGS + BIG_TAGS).include?(tag)
|
142
|
+
if TAGS.include?(sym)
|
65
143
|
if args.empty? and block.nil?
|
66
144
|
return CssProxy.new do |args, block|
|
67
|
-
tag!(
|
145
|
+
tag!(sym, *args, &block)
|
68
146
|
end
|
69
147
|
end
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
tag!(tag, *args)
|
78
|
-
elsif instance_variable_get("@#{tag}")
|
79
|
-
instance_variable_get("@#{tag}")
|
80
|
-
elsif @helpers.respond_to?(tag)
|
81
|
-
r = @helpers.send(tag, *args, &block)
|
148
|
+
tag!(sym, *args, &block)
|
149
|
+
elsif SELF_CLOSING_TAGS.include?(sym)
|
150
|
+
tag!(sym, *args)
|
151
|
+
elsif instance_variable_get("@#{sym}")
|
152
|
+
instance_variable_get("@#{sym}")
|
153
|
+
elsif @helpers.respond_to?(sym)
|
154
|
+
r = @helpers.send(sym, *args, &block)
|
82
155
|
@builder << r if @output_helpers
|
83
156
|
r
|
84
157
|
else
|
85
|
-
tag!(
|
158
|
+
tag!(sym, *args, &block)
|
86
159
|
end
|
87
160
|
end
|
88
161
|
|
@@ -92,12 +165,13 @@ module Markaby
|
|
92
165
|
|
93
166
|
@@default_image_tag_options ||= { :border => '0', :alt => '' }
|
94
167
|
|
168
|
+
# Builds a image tag. Assumes <tt>:border => '0', :alt => ''</tt>.
|
95
169
|
def img(opts = {})
|
96
|
-
opts[:border] ||= '0'
|
97
|
-
opts[:alt] ||= ''
|
98
170
|
tag!(:img, @@default_image_tag_options.merge(opts))
|
99
171
|
end
|
100
172
|
|
173
|
+
# Builds a head tag. Adds a <tt>meta</tt> tag inside with Content-Type
|
174
|
+
# set to <tt>text/html; charset=utf-8</tt>.
|
101
175
|
def head(*args, &block)
|
102
176
|
tag!(:head, *args) do
|
103
177
|
tag!(:meta, 'http-equiv' => 'Content-Type', 'content' => 'text/html; charset=utf-8')
|
@@ -105,6 +179,9 @@ module Markaby
|
|
105
179
|
end
|
106
180
|
end
|
107
181
|
|
182
|
+
# Builds an html tag. An XML 1.0 instruction and an XHTML 1.0 Transitional doctype
|
183
|
+
# are prepended. Also assumes <tt>:xmlns => "http://www.w3.org/1999/xhtml",
|
184
|
+
# "xml:lang" => "en", :lang => "en"</tt>.
|
108
185
|
def html(*args, &block)
|
109
186
|
if args.empty?
|
110
187
|
args = ["-//W3C//DTD XHTML 1.0 Transitional//EN", "DTD/xhtml1-transitional.dtd"]
|
@@ -116,6 +193,7 @@ module Markaby
|
|
116
193
|
end
|
117
194
|
alias_method :xhtml_transitional, :html
|
118
195
|
|
196
|
+
# Builds an html tag with XHTML 1.0 Strict doctype instead.
|
119
197
|
def xhtml_strict(&block)
|
120
198
|
html("-//W3C//DTD XHTML 1.0 Strict//EN", "DTD/xhtml1-strict.dtd", &block)
|
121
199
|
end
|