Skip to content
Browse files

cleaned up the two new sections

  • Loading branch information...
1 parent dc786e9 commit de9c25ea18d680b4dc0e8de2efae5181db1fc432 @mark-hahn committed
Showing with 7 additions and 5 deletions.
  1. +7 −5 README.md
View
12 README.md
@@ -44,9 +44,9 @@ The top part of the added code defines a lot of things, the most important of wh
Let's walk through the execution of the Hello World template code. First the `head` function is called with the `title` function as an argument. The `head` function adds the `<head>` text to the buffer, then calls the `title` function which adds it's own html to the buffer, and finally adds the closing `</head>`.
-The `title` function was called with `"Hello World"` as its only argument. In a case like this, the function only had to wrap `<title>` and `</title>` around the string it was passed and add the whole thing to the buffer. The `body` function did the same thing as the `head` function except that the function passed to it returned nothing.
+The `title` function was called with `"Hello World"` as its only argument. In a case like this, the function only had to wrap `<title>` and `</title>` around the string it was passed and add the whole thing to the buffer. The `body` function did the same thing as the `head` function except that the function passed to it added nothing to the output buffer.
-So the "tag" functions create all the resulting HTML by just passing their arguments through while executing the function arguments. Quite elegant, yes?
+So the "tag" functions create all the resulting HTML by adding their arguments to the output buffer while executing the function arguments to create the nesting. Quite elegant, yes?
If this was all there was to KoffeeKup then it would already be quite useful as a way to write all your HTML in a concise way. No more adding all those nasty closing tags. But wait, there's more ...
@@ -72,7 +72,9 @@ Let's look at this more complicated example which ties everything we know togeth
<span color="green">And I'm ugly text</span>
</div>
-Now it is starting to look like real html you'd find on an ugly web page. Did you notice the parentheses around `color:"green"`? In older versions of coffeescript this is needed so that the string after it is not treated as part of the hash. The newest versions of CoffeeScript have changed the rules so this isn't needed. I'm going to assume the latest version of CoffeeScript in the following examples to keep them prettier. As of this writing the KoffeeKup online trial page uses an older version of CoffeeScript. So add the parentheses before trying them out there.
+Now it is starting to look like real html you'd find on an ugly web page.
+
+Did you notice the parentheses around `color:"green"`? In older versions of coffeescript this is needed so that the string after it is not treated as part of the hash. The newest versions of CoffeeScript have changed the rules so this isn't needed. I'm going to assume the latest version of CoffeeScript in the following examples to keep them prettier. As of this writing the KoffeeKup online trial page uses an older version of CoffeeScript. So add the parentheses before trying them out there.
Lonely Text
---
@@ -87,9 +89,9 @@ At this point in my use of KoffeeKup I was starting to think I knew how to gener
I'm boring black
<span color="blue">I'm feeling blue</span>
-The text tag (function) just adds whatever text is in its string argument to the output buffer. If the `text` function was missing, it would still be legal CoffeeScript, and the template would execute without error, but the text would be lost because nothing added it to the output buffer.
+The `text` tag (function) just adds whatever text is in its string argument to the output buffer. If we removed `text` from the beginning of the middle line, that line with only the string would be legal CoffeeScript, and the template would execute without error, but the text would be lost because there would be no function to add it to the output buffer.
-Before we leave the discussion of general text I'd like to point something out. Whether it is a string argument to a real tag like `div`, or a string argument to the fake `text` tag, a string can contain any text, even html. We will learn how to do this properly in the section _The Great Escape_.
+Before we leave the discussion of general text I'd like to point something out. Whether it is a string argument to a real tag like `div`, or a string argument to the fake `text` tag, a string can contain any text, even html. We will learn how to use this to our advantage in the section _The Great Escape_.
Variables, Conditionals, Loops, And Functions Galore
---

0 comments on commit de9c25e

Please sign in to comment.
Something went wrong with that request. Please try again.