Moved HTML files -> MD

(still getting compile errors on the spacebars one however...
This commit is contained in:
Tom Coleman
2016-03-18 10:11:37 +11:00
parent 4066bd81cf
commit ea4ddea6a4
14 changed files with 117 additions and 145 deletions

View File

@@ -1,5 +1,4 @@
<template name="pkg_accounts_ui">
{{#markdown}}
{{#template name="pkg_accounts_ui"}}
## `accounts-ui`
A turn-key user interface for Meteor Accounts.
@@ -29,5 +28,4 @@ when the URLs are loaded.
If you want to control the look and feel of your accounts system a little more, we recommend reading the [useraccounts](http://guide.meteor.com/accounts.html#useraccounts) section of the Meteor Guide.
{{/markdown}}
</template>
{{/template}}

View File

@@ -1,5 +1,4 @@
<template name="pkg_appcache">
{{#markdown}}
{{#template name="pkg_appcache"}}
## `appcache`
@@ -80,5 +79,4 @@ cache, see the
[AppCache page](https://github.com/meteor/meteor/wiki/AppCache)
in the Meteor wiki.
{{/markdown}}
</template>
{{/template}}

View File

@@ -1,5 +1,4 @@
<template name="pkg_audit_argument_checks">
{{#markdown}}
{{#template name="pkg_audit_argument_checks"}}
## `audit-argument-checks`
@@ -14,5 +13,4 @@ Methods and publish functions that do not need to validate their arguments can
simply run `check(arguments, [Match.Any])` to satisfy the
`audit-argument-checks` coverage checker.
{{/markdown}}
</template>
{{/template}}

View File

@@ -1,5 +1,4 @@
<template name="pkg_coffeescript">
{{#markdown}}
{{#template name="pkg_coffeescript"}}
## `coffeescript`
[CoffeeScript](http://coffeescript.org/) is a little language that
@@ -48,5 +47,4 @@ Heavy CoffeeScript users, please let us know how this arrangement
works for you, whether `share` is helpful for you, and anything else
you'd like to see changed.
{{/markdown}}
</template>
{{/template}}

View File

@@ -1,6 +1,5 @@
<template name="pkg_ecmascript">
{{#markdown}}
## ecmascript
{{#template name="pkg_ecmascript"}}
## `ecmascript`
This package lets you use new JavaScript language features that are part
of the [ECMAScript 2015
@@ -313,5 +312,4 @@ package is installed:
Complete reference [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array).
{{/markdown}}
</template>
{{/template}}

View File

@@ -1,5 +1,4 @@
<template name="pkg_jquery">
{{#markdown}}
{{#template name="pkg_jquery"}}
## `jquery`
@@ -17,5 +16,4 @@ plugins as separate packages. These include:
* [`jquery-layout`](http://layout.jquery-dev.net/)
* [`jquery-waypoints`](http://imakewebthings.com/jquery-waypoints/)
{{/markdown}}
</template>
{{/template}}

View File

@@ -1,5 +1,4 @@
<template name="pkg_less">
{{#markdown}}
{{#template name="pkg_less"}}
## `less`
[LESS](http://lesscss.org/) extends CSS with dynamic behavior such as variables, mixins,
@@ -15,5 +14,4 @@ If you want to `@import` a file, give it the extension `.import.less`
to prevent Meteor from processing it independently.
{{/note}}
{{/markdown}}
</template>
{{/template}}

View File

@@ -1,5 +1,4 @@
<template name="pkg_markdown">
{{#markdown}}
{{#template name="pkg_markdown"}}
## `markdown`
@@ -17,5 +16,4 @@ outputs
<p>I am using <strong>markdown</strong>.</p>
{{/markdown}}
</template>
{{/template}}

View File

@@ -1,6 +1,5 @@
<template name="pkg_modules">
{{#markdown}}
## Modules
{{#template name="pkg_modules"}}
## `modules`
Though Meteor 1.2 introduced support for [many new ECMAScript 2015 features](https://github.com/meteor/meteor/blob/devel/packages/ecmascript/README.md#supported-es2015-features), one of the most notable omissions was [ES2015 `import` and `export` syntax](http://exploringjs.com/es6/ch_modules.html). Meteor 1.3 fills that gap with a fully standards-compliant module system that works on both the client and the server, solves multiple long-standing problems for Meteor applications (such as controlling file load order), and yet maintains full backwards compatibility with existing Meteor code. This document explains the usage and key features of the new module system.
@@ -197,5 +196,4 @@ console.log(bThing, "in a.js");
console.log("in c.js");
```
{{/markdown}}
</template>
{{/template}}

View File

@@ -1,5 +1,4 @@
<template name="pkg_oauth_encryption">
{{#markdown}}
{{#template name="pkg_oauth_encryption"}}
## `oauth-encryption`
Encrypts sensitive login secrets stored in the database such as a
@@ -79,5 +78,4 @@ You can decrypt them using `OAuth.openSecrets`:
This package depends on [npm-node-aes-gcm](https://github.com/meteor/meteor/tree/devel/packages/non-core/npm-node-aes-gcm), which requires you to have OpenSSL installed on your system to run. To install OpenSSL on Windows, use one of the binaries on [this page](http://slproweb.com/products/Win32OpenSSL.html). Don't forget to install the Visual Studio 2008 redistributables if you don't have them yet.
{{/markdown}}
</template>
{{/template}}

View File

@@ -1,5 +1,4 @@
<template name="pkg_random">
{{#markdown}}
{{#template name="pkg_random"}}
## `random`
The `random` package provides several functions for generating random
@@ -37,5 +36,4 @@ Returns a random string of `n` hexadecimal digits.
{{/dtdd}}
</dl>
{{/markdown}}
</template>
{{/template}}

View File

@@ -1,6 +1,5 @@
<template name="pkg_spacebars">
{{#markdown}}
<h2 id="pkg_spacebars">Spacebars</h2>
{{#template name="pkg_spacebars"}}
<h2 id="pkg_spacebars">`spacebars`</h2>
Spacebars is a Meteor template language inspired by
[Handlebars](http://handlebarsjs.com/). It shares some of the spirit and syntax
@@ -10,43 +9,43 @@ when compiled.
### Getting Started
A Spacebars template consists of HTML interspersed with template tags, which are
delimited by `{{|` and `}}` (two curly braces).
delimited by `{{dstache}}` and `}}` (two curly braces).
```
<{{! }}template name="myPage">
<h1>{{|pageTitle}}</h1>
```html
<template name="myPage">
<h1>{{pageTitle}}</h1>
{{|> nav}}
{{> nav}}
{{|#each posts}}
{{#each posts}}
<div class="post">
<h3>{{|title}}</h3>
<h3>{{title}}</h3>
<div class="post-content">
{{|{content}}}
{{{content}}}
</div>
</div>
{{|/each}}
<{{! }}/template>
{{/each}}
</template>
```
As illustrated by the above example, there are four major types of template
tags:
* `{{|pageTitle}}` - Double-braced template tags are used to insert a string of
* `{{dstache}}pageTitle}}` - Double-braced template tags are used to insert a string of
text. The text is automatically made safe. It may contain any characters
(like `<`) and will never produce HTML tags.
* `{{|> nav}}` - Inclusion template tags are used to insert another template by
* `{{dstache}}> nav}}` - Inclusion template tags are used to insert another template by
name.
* `{{|#each}}` - Block template tags are notable for having a block of content.
* `{{dstache}}#each}}` - Block template tags are notable for having a block of content.
The block tags `#if`, `#each`, `#with`, and `#unless` are built in, and it is
also possible define custom ones. Some block tags, like `#each` and `#with`,
establish a new data context for evaluating their contents. In the above
example, `{{|title}}` and `{{|content}}` most likely refer to properties of the
example, `{{dstache}}title}}` and `{{dstache}}content}}` most likely refer to properties of the
current post (though they could also refer to template helpers).
* `{{|{content}}}` - Triple-braced template tags are used to insert raw HTML. Be
* `{{dstache}}{content}}}` - Triple-braced template tags are used to insert raw HTML. Be
careful with these! It's your job to make sure the HTML is safe, either by
generating it yourself or sanitizing it if it came from a user input.
@@ -95,7 +94,7 @@ When evaluating a path, identifiers after the first are used to index into the
object so far, like JavaScript's `.`. However, an error is never thrown when
trying to index into a non-object or an undefined value.
In addition, Spacebars will call functions for you, so `{{|foo.bar}}` may be
In addition, Spacebars will call functions for you, so `{{dstache}}foo.bar}}` may be
taken to mean `foo().bar`, `foo.bar()`, or `foo().bar()` as appropriate.
### Helper Arguments
@@ -107,7 +106,7 @@ Double-braced and triple-braced template tags take any number of positional and
keyword arguments:
```
{{|frob a b c verily=true}}
{{frob a b c verily=true}}
```
calls:
```javascript
@@ -121,12 +120,12 @@ The helper's implementation can access the current data context as `this`.
### Inclusion and Block Arguments
Inclusion tags (`{{|> foo}}`) and block tags (`{{|#foo}}`) take a single
Inclusion tags (`{{dstache}}> foo}}`) and block tags (`{{dstache}}#foo}}`) take a single
data argument, or no argument. Any other form of arguments will be interpreted
as an *object specification* or a *nested helper*:
* **Object specification**: If there are only keyword arguments, as in `{{|#with
x=1 y=2}}` or `{{|> prettyBox color=red}}`, the keyword arguments will be
* **Object specification**: If there are only keyword arguments, as in `{{dstache}}#with
x=1 y=2}}` or `{{dstache}}> prettyBox color=red}}`, the keyword arguments will be
assembled into a data object with properties named after the keywords.
* **Nested Helper**: If there is a positional argument followed by other
@@ -173,7 +172,7 @@ is safe to insert.
A double-braced tag may be part of, or all of, an HTML attribute value:
```
<input type="checkbox" class="checky {{|moreClasses}}" checked={{|isChecked}}>
<input type="checkbox" class="checky {{dstache}}moreClasses}}" checked={{dstache}}isChecked}}>
```
An attribute value that consists entirely of template tags that return `null`,
@@ -186,9 +185,9 @@ A double-braced tag can be used in an HTML start tag to specify an arbitrary set
of attributes:
```
<div {{|attrs}}>...</div>
<div {{dstache}}attrs}}>...</div>
<input type=checkbox {{|isChecked}}>
<input type=checkbox {{dstache}}isChecked}}>
```
The tag must evaluate to an object that serves as a dictionary of attribute name
@@ -215,13 +214,13 @@ To summarize:
You can combine multiple dynamic attributes tags with other attributes:
```
<div id=foo class={{|myClass}} {{|attrs1}} {{|attrs2}}>...</div>
<div id=foo class={{dstache}}myClass}} {{dstache}}attrs1}} {{dstache}}attrs2}}>...</div>
```
Attributes from dynamic attribute tags are combined from left to right, after
normal attributes, with later attribute values overwriting previous ones.
Multiple values for the same attribute are not merged in any way, so if `attrs1`
specifies a value for the `class` attribute, it will overwrite `{{|myClass}}`.
specifies a value for the `class` attribute, it will overwrite `{{dstache}}myClass}}`.
As always, Spacebars takes care of recalculating the element's attributes if any
of `myClass`, `attrs1`, or `attrs2` changes reactively.
@@ -232,7 +231,7 @@ Triple-braced tags are used to insert raw HTML into a template:
```
<div class="snippet">
{{|{snippetBody}}}
{{{snippetBody}}}
</div>
```
@@ -243,7 +242,7 @@ This template tag cannot be used in attributes or in an HTML start tag.
### Inclusion Tags
An inclusion tag takes the form `{{|> templateName}}` or `{{|> templateName
An inclusion tag takes the form `{{dstache}}> templateName}}` or `{{dstache}}> templateName
dataObj}}`. Other argument forms are syntactic sugar for constructing a data
object (see Inclusion and Block Arguments).
@@ -252,9 +251,9 @@ location. If there is an argument, it becomes the data context, much as if the
following code were used:
```
{{|#with dataObj}}
{{|> templateName}}
{{|/with}}
{{dstache}}#with dataObj}}
{{dstache}}> templateName}}
{{dstache}}/with}}
```
Instead of simply naming a template, an inclusion tag can also specify a path
@@ -263,10 +262,10 @@ object.
Note that the above two points interact in a way that can be surprising!
If `foo` is a template helper function that returns another template, then
`{{|>foo bar}}` will _first_ push `bar` onto the data context stack _then_ call
`{{dstache}}>foo bar}}` will _first_ push `bar` onto the data context stack _then_ call
`foo()`, due to the way this line is expanded as shown above. You will need to
use `Template.parentData(1)` to access the original context. This differs
from regular helper calls like `{{|foo bar}}`, in which `bar` is passed as a
from regular helper calls like `{{dstache}}foo bar}}`, in which `bar` is passed as a
parameter rather than pushed onto the data context stack.
### Function Returning a Template
@@ -282,20 +281,20 @@ of template content that may be instantiated once, more than once, or not at all
by the directive or helper.
```
{{|#block}}
{{#block}}
<p>Hello</p>
{{|/block}}
{{/block}}
```
Block tags may also specify "else" content, separated from the main content by
the special template tag `{{|else}}`.
the special template tag `{{dstache}}else}}`.
A block tag's content must consist of HTML with balanced tags.
Block tags can be used inside attribute values:
```
<div class="{{|#if done}}done{{|else}}notdone{{|/if}}">
<div class="{{dstache}}#if done}}done{{dstache}}else}}notdone{{dstache}}/if}}">
...
</div>
```
@@ -308,11 +307,11 @@ depending on the value of its data argument. Any falsy JavaScript value
well as the empty array, while any other value is considered true.
```
{{|#if something}}
{{#if something}}
<p>It's true</p>
{{|else}}
{{else}}
<p>It's false</p>
{{|/if}}
{{/if}}
```
`#unless` is just `#if` with the condition inverted.
@@ -324,19 +323,19 @@ The properties of the data context object are where Spacebars looks when
resolving template tag names.
```
{{|#with employee}}
<div>Name: {{|name}}</div>
<div>Age: {{|age}}</div>
{{|/with}}
{{#with employee}}
<div>Name: {{name}}</div>
<div>Age: {{age}}</div>
{{/with}}
```
We can take advantage of the object specification form of a block tag to define
an object with properties we name:
```
{{|#with x=1 y=2}}
{{|{getHTMLForPoint this}}}
{{|/with}}
{{#with x=1 y=2}}
{{{getHTMLForPoint this}}}
{{/with}}
```
If the argument to `#with` is falsy (by the same rules as for `#if`), the
@@ -356,9 +355,9 @@ each item in the sequence, setting the data context to the value of that item:
```
<ul>
{{|#each people}}
<li>{{|name}}</li>
{{|/each}}
{{#each people}}
<li>{{name}}</li>
{{/each}}
</ul>
```
@@ -367,9 +366,9 @@ new variable that can be used in the body to refer to the current item:
```
<ul>
{{|#each person in people}}
<li>{{|person.name}}</li>
{{|/each}}
{{#each person in people}}
<li>{{person.name}}</li>
{{/each}}
</ul>
```
@@ -418,9 +417,9 @@ doesn't change the data context, it allows to refer to an expression (helper,
data context, another variable) with a short-hand within the template:
```
{{|#let name=person.bio.firstName color=generateColor}}
<div>{{|name}} gets a {{|color}} card!</div>
{{|/let}}
{{#let name=person.bio.firstName color=generateColor}}
<div>{{name}} gets a {{color}} card!</div>
{{/let}}
```
Variables introduced this way take precedence over names of templates, global
@@ -430,42 +429,42 @@ variables with the same name.
### Custom Block Helpers
To define your own block helper, simply declare a template, and then invoke it
using `{{|#someTemplate}}` (block) instead of `{{|> someTemplate}}` (inclusion)
using `{{dstache}}#someTemplate}}` (block) instead of `{{dstache}}> someTemplate}}` (inclusion)
syntax.
When a template is invoked as a block helper, it can use `{{|>
Template.contentBlock}}` and `{{|> Template.elseBlock}}` to include the block
When a template is invoked as a block helper, it can use `{{dstache}}>
Template.contentBlock}}` and `{{dstache}}> Template.elseBlock}}` to include the block
content it was passed.
Here is a simple block helper that wraps its content in a div:
```
<{{! }}template name="note">
<template name="note">
<div class="note">
{{|> Template.contentBlock}}
{{> Template.contentBlock}}
</div>
<{{! }}/template>
</template>
```
You would invoke it as:
```
{{|#note}}
{{#note}}
Any content here
{{|/note}}
{{/note}}
```
Here is an example of implementing `#unless` in terms of `#if` (ignoring for the
moment that `unless` is a built-in directive):
```
<{{! }}template name="unless">
{{|#if this}}
{{|> Template.elseBlock}}
{{|else}}
{{|> Template.contentBlock}}
{{|/if}}
<{{! }}/template>
<template name="unless">
{{#if this}}
{{> Template.elseBlock}}
{{else}}
{{> Template.contentBlock}}
{{/if}}
</template>
```
Note that the argument to `#unless` (the condition) becomes the data context in
@@ -473,38 +472,38 @@ the `unless` template and is accessed via `this`. However, it would not work
very well if this data context was visible to `Template.contentBlock`, which is
supplied by the user of `unless`.
Therefore, when you include `{{|> Template.contentBlock}}`, Spacebars hides the
Therefore, when you include `{{dstache}}> Template.contentBlock}}`, Spacebars hides the
data context of the calling template, and any data contexts established in the
template by `#each` and `#with`. They are not visible to the content block,
even via `..`. Put another way, it's as if the `{{|> Template.contentBlock}}`
inclusion occurred at the location where `{{|#unless}}` was invoked, as far as
even via `..`. Put another way, it's as if the `{{dstache}}> Template.contentBlock}}`
inclusion occurred at the location where `{{dstache}}#unless}}` was invoked, as far as
the data context stack is concerned.
You can pass an argument to `{{|> Template.contentBlock}}` or `{{|>
You can pass an argument to `{{dstache}}> Template.contentBlock}}` or `{{dstache}}>
Template.elseBlock}}` to invoke it with a data context of your choice. You can
also use `{{|#if Template.contentBlock}}` to see if the current template was
also use `{{dstache}}#if Template.contentBlock}}` to see if the current template was
invoked as a block helper rather than an inclusion.
### Comment Tags
Comment template tags begin with `{{|!` and can contain any characters except for
Comment template tags begin with `{{dstache}}!` and can contain any characters except for
`}}`. Comments are removed upon compilation and never appear in the compiled
template code or the generated HTML.
```
{{|! Start of a section}}
{{! Start of a section}}
<div class="section">
...
</div>
```
Comment tags also come in a "block comment" form. Block comments may contain
`{{|` and `}}`:
`{{dstache}}` and `}}`:
```
{{|!-- This is a block comment.
We can write {{|foo}} and it doesn't matter.
{{|#with x}}This code is commented out.{{|/with}}
{{!-- This is a block comment.
We can write {{foo}} and it doesn't matter.
{{#with x}}This code is commented out.{{/with}}
--}}
```
@@ -517,7 +516,7 @@ some other expression. For this and other cases, one can use parentheses to
express the evaluation order of nested expressions.
```
{{|capitalize (getSummary post)}}
{{capitalize (getSummary post)}}
```
In this example, the result of the `getSummary` helper call will be passed to
@@ -526,7 +525,7 @@ the `capitalize` helper.
Sub-expressions can be used to calculate key-word arguments, too:
```
{{|> tmpl arg=(helper post)}}
{{dstache}}> tmpl arg=(helper post)}}
```
### HTML Dialect
@@ -576,9 +575,8 @@ following elements:
### Escaping Curly Braces
To insert a literal `{{|`, `{{|{`, or any number of curly braces, put a
vertical bar after it. So `{{||` will show up as `{{|`, `{{|{|` will
show up as `{{|{`, and so on.
To insert a literal `{{dstache}}`, `{{dstache}}{`, or any number of curly braces, put a
vertical bar after it. So `{{dstache}}|` will show up as `{{dstache}}`, `{{dstache}}{|` will
show up as `{{dstache}}{`, and so on.
{{/markdown}}
</template>
{{/template}}

View File

@@ -1,5 +1,4 @@
<template name="pkg_underscore">
{{#markdown}}
{{#template name="pkg_underscore"}}
## `underscore`
[Underscore](http://underscorejs.org/) is a utility-belt library for
@@ -30,5 +29,4 @@ are treated as objects if they have no prototype (specifically, if
{{/warning}}
{{/markdown}}
</template>
{{/template}}

View File

@@ -1,5 +1,4 @@
<template name="pkg_webapp">
{{#markdown}}
{{#template name="pkg_webapp"}}
## `webapp`
The `webapp` package is what lets your Meteor app serve content to a web
@@ -43,5 +42,4 @@ object. Use this to write data that should be sent in response to the
request, and call `res.end()` when you are done.
- **next** - a function. Calling this function will pass on the handling of
this request to the next relevant handler.
{{/markdown}}
</template>
{{/template}}