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 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330
|
= amritaĥ2
ΥɥȤƤ뵡ǽϡV1.0ǤFIXƤʤΤǤ
塢ѹǽޤ
---
== ѡĥƥץ졼(¸Ūǽ)
=== ɤȽ
:
:include: sample/tour/parts1.rb
:
<html>
<body>
<h1>Scripting Languages</h1>
<ul>
<li>Ruby</li>
<li>Perl</li>
<li>Python</li>
</ul>
<table>
<tr>
<td>Ruby</td>
<td>matz</td>
<td><a href="http://www.ruby-lang.org/">http://www.ruby-lang.org/</a></td>
</tr>
<tr>
<td>perl</td>
<td>Larry Wall</td>
<td><a href="http://www.perl.com/">http://www.perl.com/</a></td>
</tr>
<tr>
<td>python</td>
<td>Guido van Rossum</td>
<td><a href="http://www.python.org/">http://www.python.org/</a></td>
</tr>
</table>
</body>
</html>
=== description
Τ褦ʥ饹äȤޤ
class Header
attr_reader :title
def initialize(title)
@title = title
end
end
Τ褦ʥƥץ졼Ȥơ
饹˥ƥץ졼Ȥ֥ȡפȡ
<span class=Header>
<h1 id=title></h1>
</span>
Header饹ϡΥƥץ졼Ȥ˽äơʬȤŸɽ뤳
ȤǤ褦ˤʤޤ
h = Header.new("Scripting Languages")
puts h.to_s # => <h1>Scripting Languages</h1>
⤷Υ֥ȤǥǡΰʬȤƻѤȡ
HTMLɥȤᤳޤޤ
̤Υ⥸塼˥ƥץ졼Ȥȡ뤷ơ
¹Ի˻Ѥ⥸塼뤳ȤǽǤ
ܺ٤ϲȤƤ
sample/tour/parts2.rb
----
== °Ÿ(¸Ūǽ)
=== ɤȽ
:
:include: sample/tour/makeurl2.rb
:
<table border="1">
<tr>
<th>name</th>
<th>author</th>
<th>webpage</th>
</tr>
<tr>
<td>Ruby</td>
<td>matz</td>
<td><a href="http://www.ruby-lang.org/">Ruby Home Page</a></td>
</tr>
<tr>
<td>perl</td>
<td>Larry Wall</td>
<td><a href="http://www.perl.com/">Perl.com</a></td>
</tr>
<tr>
<td>python</td>
<td>Guido van Rossum</td>
<td><a href="http://www.python.org/">Python Language Website</a></td>
</tr>
</table>
===
tmpl.expand_attr = true
Υȥӥ塼ȤꤵƤȡ
"@url"Τ褦"@"ǻϤޤʸꤵ줿°åޤ
If this attribute was set, then amrita checks all attribute values and
convert it with model data if the value in template begins "@" like
"@url".
---
== CGIKitե(¸Ūǽ)
CGIKit(http://www.spice-of-life.net/download/cgikit/index_en.html)
RubyˤäCGI ץꥱȯ뤿Υե졼Ǥ
amritaˤϡCGIKitȤΥեޤCKAmritaElement ¾
ɸΥݡͥȤƱͤ˻Ѥ뤳ȤǡCGIץꥱȯ뤳ȤǤޤ
=== Ƚ
HelloWorld.cgi:
require 'amrita/cgikit'
app = CKApplication.instance
app.run
MainPage/MainPage.html
<html>
<head>
<title>Hello World</title>
</head>
<body>
<h1>
<CGIKIT NAME=HelloWorld>
<span id="hello"></span>
</CGIKIT>
</h1>
</body>
</html>
MainPage/MainPage.ckd
HelloWorld : CKAmritaElement {
hello = sayHello;
}
MainPage/MainPage.rb
class MainPage < CKComponent
def sayHello
"Hello World!"
end
end
output:
Hello World!
===
ckdեCKAmritaElement˳ꤢƤ줿<CGIKIT>...</CGIKIT>δ֤HTMLϡ
amrita˥ƥץ졼ȤȤϤޤ
ʳHTMLCGIKit̤˽ޤ
Ǥ顢CGIKitɸॳݡͥȤ
amrita(CKAmritaElement: amritaΥƥץ졼ȥޤCGIKitΥݡͥ)ߤ뤳Ȥǽˤʤޤ
CKAmritaElement ǥǡCGIKitΥݡͥȤФޤ
ŪˤϰʲΥǡѤޤ
* ᥤڡ֥(ƥݡͥ)Υå
+id+ °ϥåɥ˻Ѥޤ
ckdեǻꤹ뤳Ȥˤ¾Υå̾Ѥ뤳ȤǤޤ
* ckdեŪꤵ줿
* ¾ΥݡͥȤˤäưŪꤵ줿
FORM䥢ˤCGIKitѤơɽamritaȤΤ褤Ȼפޤ
(CGIKitǤϥեΥܥRubyåɤ˥ХɤǤޤ)
ܺ٤ sample/cgikit/Examples ȤƤ
---
== Amrita Script (¸Ūǽ)
Amrita Script ƥץ졼Ȥ˥ǥǡޤ¸ŪʵǽǤ
=== ɤȽ
:
:include: sample/tour/amstest.ams
:
$ ams amstest.ams
<html>
<body>
<h1>hello world</h1>
<p>Amrita is a html template libraly for Ruby</p>
<hr>
Wed Aug 07 18:12:38 JST 2002/
last-modified Wed Aug 07 08:44:33 JST 2002
</body>
</html>
===
+ams+ Ȥޥ(bin/amsȤamritaΥ֤˴ޤޤƤޤ)
<tt><amritascript> <!-- ... //--></amritascript></tt> ΥƥȤȴФơ
RubyΥɤȤɾޤ
ơɾ̤ǥǡȤamritaѤޤ
---
== amx: ⤦ҤȤĤXMLѥ륷(¸Ūǽ)
amx(AMrita eXtention for XML)XMLѥ륷ȤǤ
XMLɥȤHTMLѴޤ
ϤηꤹΤamritaΥƥץ졼ȤѤǤޤ
=== ɤȽ
source document:
:include: sample/tour/amxtest.xml
template:
:include: sample/tour/amxtest.amx
output:
<html>
<body>
<title>amx sample</title>
<p>
amx is a XML document.
It contains model data as well-formed XML, HTML template
and a small Ruby code map both.
</p><p>
This is a sample AMX document.
</p>
<hr />
Fri Aug 23 13:35:02 JST 2002
</body>
</html>
===
amxѤˤϡΥޥɤѤƤ
$ amx amxtest.xml
ɥȤϡ(well-formed)XMLʤ顢ɤXMLʸǤ⤫ޤޤ
Ƭ˰ʲλؼޤɬפޤ
<?amx href="index.amx" ?>
href°ǡamxƥץ졼ȤؤΥѥꤷޤ
amxϻꤵ줿ƥץ졼ȥեɤߤߡƥץ졼ȥ֥Ȥޤ
ƥץ졼ȥե̤XMLʸǡʲĤΥѡȤʬƤޤ
* <template>
(XHTMLǵҤ줿)̤amritaΥƥץ졼ȤǤ
* <method>
ǤѤȡƥץ졼ȥ֥Ȥ˥åɤɲäǤޤ
ƥץ졼ȥ֥ȤϡAmx::Template 饹Υ֥ȤǤ
REXMLDOMĥȤƥɤ줿ɥȤǥǡޤ
===
amritaۡڡΥȥåץڡamxƤޤ
[docs/index.xml] ɥ
[docs/index.amx] ƥץ졼ȥɥ
[docs/amritadoc.rb] Ruby
amxξܺ٤ʻѤϤޤꤷƤޤ
⤷amxȤȻפä顢ڤ˻˥뤷Ƥ
* XMLʸ
* HTMLʸ(դѴȤ)
館顢ɤä餤狼褦ʥץơΥ˴ޤޤ
ץ뤬ޤä顢amxΥɥȤƻͤꤷޤ
|