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
|
doctype html
html
head
title Slim Examples
/ This is a comment for the body
body
h1 Markup examples
/ Inline nested ruby expressions
p Nested interp #{list.map { |x| x + 1 }.inject(&:+)} parses ok
/! HTML comment
#content
p This example shows you how a basic Slim file looks like.
span class=ruby_method data-something='hmmm' = some_other_ruby_method
/ Splats
.csclass data-attr=RUBY_CONSTANT width = "23px" Woot!
.card *method_which_return_hash! = place.name
.herp *@hash_instance_variable = place.name
#derp*{'data-url'=>place_path(place), 'data-id'=>place.id} = place.name
/ Dynamic tags
*ruby_tag Some text for it
*some_tag_method( CONSTANT, "string", 1234.3 ) Woot!
p
' Some text with <bold>bold text</bold>
<p attr="something">
' Some other text with #{interp}
javascript:
var foo = 23;
function bar( lel ) {
return lel * 4;
}
/ And this is a \
wrapping comment
/ And a
p non-wrapping one
/[if IE]
p Get a better browser
a href='http://google.com/' To Google!
css:
p {
font-family: #{font_family( "Tahoma" ) && Time.now};
}
== yield
- unless items.empty?
table
- for item in items do
tr
td.name = item.name
td.price = item.price
td.spec
= render( \
partial: 'item_spec',
locals: { \
item: item,
},
)
- else
p<
| No items found. Please add some inventory.
Thank you! a href="lol"
a lol
a lol
coffee:
square = (x) -> x * x
markdown:
- Hello from #{SomeClass.interpolation_works!}
div id="footer"
= 3.times { render 'footer' }
| Copyright © #{year} #{author}
|