Skip to content
This repository
tree: 41ca0629a6
Fetching contributors…

Cannot retrieve contributors at this time

file 62 lines (45 sloc) 1.369 kb
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
- /*
  here we can have a comment that will not be output.
  Since executable-JS is a block-level thing, we can
  have as much comment as we want */


- /* now you can have arbitrary control logic
    This will output <div>1</div><div>2</div><div>3</div>
    notice: the %div isn't indented! Explained below!
  */

- for(var i=1; i < 4; i++){
%div= i
-}


%h1 Woah!

- /* we can include new variable declarations as well! */
  var someObj = {
    a: 1,
    b: 2
  }
= someObj.b


%br


- /* this is going to be funky. i DO NOT expect you to do this.
    Here we will begin with a comment, then define our variable.
    Next we begin a function definition.
    
    We will use this function to output a div that contains a number.
    Successive calls should output the next number in the div.

    We want our function to output the value of the counter,
    so we "outdent" to escape the JavaScript block in haml.
    Note that we have not closed our function definition's
    parenthesis yet. So, even though we outdent, the
    concatenation statement will be in the function's body.
  */
  
  var counter = 0;
  function increment(){
  counter++;
.count
  = counter
-}
- increment() /* the tags wil be appended to the buffer, so use - instead of = */
- increment()




- function b(item){
.item
  %b= item
  %span.length= item.length
- }
- b("Hi")
- b("World")
Something went wrong with that request. Please try again.