From 329d2915c4601e5fb883e014709d6f0252a34c1f Mon Sep 17 00:00:00 2001 From: amarcruz Date: Thu, 19 Nov 2015 16:08:51 -0600 Subject: [PATCH] v2.3.13 --- dist/compiler.js | 1 + dist/riot.compiler.js | 1 + doc/guide.md | 57 +++++++++++++++++++++++-------------------- lib/core.js | 1 + package.json | 2 +- 5 files changed, 35 insertions(+), 27 deletions(-) diff --git a/dist/compiler.js b/dist/compiler.js index 64c9802..edf582a 100644 --- a/dist/compiler.js +++ b/dist/compiler.js @@ -198,6 +198,7 @@ function extend(obj, props) { for (var prop in props) { + /* istanbul ignore next */ if (props.hasOwnProperty(prop)) { obj[prop] = props[prop] } diff --git a/dist/riot.compiler.js b/dist/riot.compiler.js index 56632a3..34ff110 100644 --- a/dist/riot.compiler.js +++ b/dist/riot.compiler.js @@ -129,6 +129,7 @@ var compile = (function () { function extend(obj, props) { for (var prop in props) { + /* istanbul ignore next */ if (props.hasOwnProperty(prop)) { obj[prop] = props[prop] } diff --git a/doc/guide.md b/doc/guide.md index 61067a7..e77723f 100644 --- a/doc/guide.md +++ b/doc/guide.md @@ -3,7 +3,7 @@ ## Indentation In v2.3.12 the compiler handles a more consistent and flexible indentation in both inline and external tag definitions. -You can use any tabs or spaces you want. The compiler uses this to find the closing tag and unindent the content, so the closing tag must have _exactly_ the same indentation of the opening tag. +The opening tag must begin a line. You can use any tabs or spaces you want. The compiler uses this to find the closing tag and unindent the content, so the closing tag must have _exactly_ the same indentation of the opening tag. HTML comments and trailing whitespace are removed from the entire tag content (JavaScript comments are removed in the JavaScript block only, so you can not use comment in expressions). @@ -23,8 +23,8 @@ generates: ```js // This JS comment is at column 0, out of the tag riot.tag2('treeitem', '
one\n  two\n
', '', '', function(opts) { - click(e) {} // JavaScript code is unindented by 2 spaces -}); + click(e) {} +}); // the closing tag is indented by 2 spaces, this comment must be JS ``` note the `
` content, this is unindented by 2 too.
 
@@ -37,9 +37,9 @@ In the html, including quoted text, newlines are converted to spaces and compact
 
 No matter which options are used, newlines are normalized to `\n` and trailing spaces are removed.
 
-## Options
+## Compilation options
 
-The compile and riot.compile functions can take an additional parameter specifing various settings. This is a plain JavaScript object with one or more of following options as properties.
+The `compile` and `riot.compile` functions can take an additional parameter specifing various settings. This is a plain JavaScript object with one or more of following options as properties.
 
 | option      | module  | type    | description |
 | ----------- |:------: |:------: | ----------- |
@@ -52,50 +52,54 @@ The compile and riot.compile functions can take an additional parameter specifin
 | style       | css     | string  | CSS pre-processor. Built-in support for: jade
 
 
-## Options as attributes
+## Parser options
 
-In addition to the `type` attribute, script and style tags can include additional configuration in the `options` and `compile` attributes, at tag level.
+In addition to the `type` attribute, script and style tags can include additional configuration at tag level through the `options` attribute.
 
-**NOTE:** These attributes are not expressions, are [JSON](http://json.org/) objects and must comply with the [JSON specs](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf), i.e. suitable for `JSON.parse`.
+**NOTE:** This attribute is not an expression, it is a [JSON](http://json.org/) object and must comply with the [JSON specs](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf), i.e. suitable for `JSON.parse`.
 
 The `options` attribute specify options for the JS or CSS parser.
 
 Example:
 ```html
 
-  
   

Red

-
-``` -will ... - -The `compile` attribute specify options for the compiler, and must be defined in the root tag. -Example: -```html - -
This is
-    multiline
-    text.
-  
+
``` -will compile my-tag with the whitespace option, even if whitespace is not enabled in the global options + ## The untagged JS block -Where the html ends? +Where the html ends? or where should I put my JS? +The first action taken by the compiler is send the received source to any htm parser. After that, +it normalizes line endings to `\n` and removes _html_ comments. +Once prepared the source, searches for tags, separate the parts (closing/opening tag, root +attributes, and content). In the content, search the `