请输入您要查询的百科知识:

 

词条 Markaby
释义

  1. Usage

  2. Distribution

  3. Camping

  4. See also

  5. External links

{{lowercase}}{{unreferenced|date=November 2014}}{{Infobox software
| name =
| title =
| logo =
| logo caption =
| logo_size =
| logo_alt =
| screenshot =
| caption =
| screenshot_size =
| screenshot_alt =
| collapsible =
| author =
| developer =
| released =
| discontinued =
| latest release version =
| latest release date =
| latest preview version =
| latest preview date =
| status =
| programming language =
| operating system =
| platform =
| size =
| language =
| language count =
| language footnote =
| genre =
| license =
| alexa =
| website = {{URL|https://markaby.github.io/markaby/}}
| standard =
| AsOf =
}}

Markaby is a small Ruby library for writing HTML code in pure Ruby. It is an alternative to templating languages such as ERb and HAML which combine Ruby code with some form of markup. It was developed by the computer programmer "why the lucky stiff" and its name comes from Markup as Ruby.

Usage

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

puts mab.to_s

Executing the above code will render the following HTML:

</head><body><h1><ul><li><li><li></ul></body></html></source><h2 style='border-bottom: 2px solid #eeeeee;'>Distribution</h2><b>Gem</b><b>Rails plugin</b><h2 style='border-bottom: 2px solid #eeeeee;'>Camping</h2><p>Markaby is the templating engine used for the Camping micro web framework.</p><source lang="ruby"><pre id='source'> # If you have a `layout' method like this, it # will wrap the HTML in the other methods. The # `self << yield' is where the HTML is inserted. def layout html do title { 'My HomePage' } body { self << yield } end end</pre><pre id='source'> # The `index' view. Inside your views, you express # the HTML in Ruby. See http://code.whytheluckystiff.net/markaby/. def index p 'Hi my name is Charles.' p 'Here are some links:' ul do li { a 'Google', :href => 'http://google.com/' } li { a 'A sample page', :href => '/sample' } end end</pre><pre id='source'> # The `sample' view. def sample p 'A sample page' end end</pre></source><h2 style='border-bottom: 2px solid #eeeeee;'>See also</h2><ul><li> eRuby<li> Haml<li> Camping (microframework)</ul><h2 style='border-bottom: 2px solid #eeeeee;'>External links</h2><ul><li> [https://markaby.github.com/markaby Project homepage]<li> <span class='url'>Screencast example</span></ul>{{Compu-library-stub}}<p><div class='category'> 1 : Ruby (programming language)</div></p></td> </tr> <tr> <td width="61" align="center">随便看</td> <td> <ul class="random"> <li><a target="_blank" href="712099.html">Marina Lobatch</a></li> <li><a target="_blank" href="712100.html">Marin Alsop</a></li> <li><a target="_blank" href="712101.html">Marina mall</a></li> <li><a target="_blank" href="712102.html">Marina Militare Italiana</a></li> <li><a target="_blank" href="712103.html">Marina Mnishek</a></li> <li><a target="_blank" href="712104.html">Marina Mniszech</a></li> <li><a target="_blank" href="712105.html">Marina Oswald</a></li> <li><a target="_blank" href="712106.html">Marina Oswald Porter</a></li> <li><a target="_blank" href="712107.html">Marinara</a></li> <li><a target="_blank" href="712108.html">Marinara pizza</a></li> <li><a target="_blank" href="712109.html">Marina Raskova</a></li> <li><a target="_blank" href="712110.html">Marinas</a></li> <li><a target="_blank" href="712111.html">Marina Sirtis</a></li> <li><a target="_blank" href="712112.html">Marinate</a></li> <li><a target="_blank" href="712113.html">Marinated</a></li> <li><a target="_blank" href="712114.html">Marinating</a></li> <li><a target="_blank" href="712115.html">Marination</a></li> <li><a target="_blank" href="712116.html">Marina Torlonia di Civitella-Cesi</a></li> <li><a target="_blank" href="712117.html">Marina Towers</a></li> <li><a target="_blank" href="712118.html">Marina town</a></li> <li><a target="_blank" href="712119.html">Marina Tsvetaeva</a></li> <li><a target="_blank" href="712120.html">Marina Tsvetayeva</a></li> <li><a target="_blank" href="712121.html">Marina Tsvigun</a></li> <li><a target="_blank" href="712122.html">Marina Vaizey</a></li> <li><a target="_blank" href="712123.html">Marina Vlady</a></li> </ul> </td> </tr> </table> <p> </p> <p>开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。<p> </p> <div class="foot">Copyright © 2023 OENC.NET All Rights Reserved<BR>京ICP备2021023879号<span class="updatetime"> 更新时间:2024/11/14 13:04:03</span><script src="Images/tongji.js" type="text/javascript"></script></div> </body> </html>