Re: [心得] HTML?New Template System ?
※ 引述《giive (lala)》之銘言:
: require 'markaby'
: mab = Markaby::Builder.new
: mab.html do
: head { title "Boats.com" }
: body do
: h1 "Boats.com has great deals"
: ul do
: li "$49 for a canoe"
: li "$39 for a raft"
: li "$29 for a huge boot that floats and can fit 5 people"
: end
: end
: end
其實這個和 Common Lisp 的 Uncommon Web 架構類似說 @_@
如以下的 @_@
(defmethod render ((hello-world hello-world))
(<:as-is "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \
""" rel="nofollow">http://www.w3.org/TR/xhtml1/DTD/transitional.dtd\">"
#\Newline)
(<:html
(<:head
(<:meta :http-equiv "Content-Type" :content "text/html; charset=utf-8;")
(<:title (<:as-html "hi"))
(<:link :rel "stylesheet"
:href "sheet.css"
:type "text/css")
(<:link :rel "stylesheet"
:href "sheet2.css"
:type "text/css")
(<:script
;; most browsers (firefox, safari and ie at least) really,
;; really, really don't like empty script tags. The "" forces
;; yaclml to generate a seperate closing tag.
:type "text/javascript" :src "dojo.js" "")
(<:script :type "text/javascript" (<:as-is (js:js* '(dojo.require "dojo.ev
ent.*"))))
(<:script :type "text/javascript" (<:as-is "var foo = 3;")))
(<:body (<:as-html "hello world"))))
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.220.34.34
→
09/18 16:48, , 1F
09/18 16:48, 1F
→
09/19 05:10, , 2F
09/19 05:10, 2F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 3 篇):
Ruby 近期熱門文章
PTT數位生活區 即時熱門文章