mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Merge branch 'shark-make-docs-work' into shark
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template name="api">
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
|
||||
<h1 id="api">The Meteor API</h1>
|
||||
|
||||
@@ -1097,31 +1097,31 @@ applicable. If you only need to receive the fields that changed, see
|
||||
<dt><span class="name">added(document)</span> <span class="or">or</span></dt>
|
||||
<dt><span class="name">addedAt(document, atIndex, before)</span></dt>
|
||||
<dd>
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
A new document `document` entered the result set. The new document
|
||||
appears at position `atIndex`. It is immediately before the document
|
||||
whose `_id` is `before`. `before` will be `null` if the new document
|
||||
is at the end of the results.
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</dd>
|
||||
|
||||
<dt><span class="name">changed(newDocument, oldDocument)
|
||||
<span class="or">or</span></span></dt>
|
||||
<dt><span class="name">changedAt(newDocument, oldDocument, atIndex)</span></dt>
|
||||
<dd>
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
The contents of a document were previously `oldDocument` and are now
|
||||
`newDocument`. The position of the changed document is `atIndex`.
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</dd>
|
||||
|
||||
<dt><span class="name">removed(oldDocument)</span>
|
||||
<span class="or">or</span></dt>
|
||||
<dt><span class="name">removedAt(oldDocument, atIndex)</span></dt>
|
||||
<dd>
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
The document `oldDocument` is no longer in the result set. It used to be at position `atIndex`.
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</dd>
|
||||
|
||||
{{#dtdd "movedTo(document, fromIndex, toIndex, before)"}}
|
||||
@@ -1162,12 +1162,12 @@ result set, not the entire contents of the document that changed.
|
||||
<span class="or">or</span></dt>
|
||||
<dt><span class="name">addedBefore(id, fields, before)</span></dt>
|
||||
<dd>
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
A new document entered the result set. It has the `id` and `fields`
|
||||
specified. `fields` contains all fields of the document excluding the
|
||||
`_id` field. The new document is before the document identified by
|
||||
`before`, or at the end if `before` is `null`.
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</dd>
|
||||
|
||||
{{#dtdd "changed(id, fields)"}}
|
||||
@@ -3003,11 +3003,11 @@ by spammers.)
|
||||
'Hello from Meteor!',
|
||||
'This is a test of Email.send.');
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
|
||||
<h2 id="assets"><span>Assets</span></h2>
|
||||
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
`Assets` allows server code in a Meteor application to access static server
|
||||
assets, which are located in the `private` subdirectory of an application's
|
||||
tree.
|
||||
@@ -3021,7 +3021,7 @@ directory called `nested` with a file called `data.txt` inside it, then server
|
||||
code can read `data.txt` by running:
|
||||
|
||||
var data = Assets.getText('nested/data.txt');
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
|
||||
</template>
|
||||
|
||||
@@ -3040,7 +3040,7 @@ code can read `data.txt` by running:
|
||||
</h3>
|
||||
|
||||
<div class="desc">
|
||||
{{#each descr}}{{#better_markdown}}{{{this}}}{{/better_markdown}}{{/each}}
|
||||
{{#each descr}}{{#markdown}}{{{this}}}{{/markdown}}{{/each}}
|
||||
</div>
|
||||
|
||||
{{#if args}}
|
||||
@@ -3054,7 +3054,7 @@ code can read `data.txt` by running:
|
||||
{{/if}}
|
||||
|
||||
{{#if content}}
|
||||
{{#better_markdown}}{{> content}}{{/better_markdown}}
|
||||
{{#markdown}}{{> content}}{{/markdown}}
|
||||
{{/if}}
|
||||
|
||||
</div>
|
||||
@@ -3074,7 +3074,7 @@ code can read `data.txt` by running:
|
||||
{{{type}}}
|
||||
{{/if}}
|
||||
</span></dt>
|
||||
<dd>{{#better_markdown}}{{{descr}}}{{/better_markdown}}</dd>
|
||||
<dd>{{#markdown}}{{{descr}}}{{/markdown}}</dd>
|
||||
{{/each}}
|
||||
</dl>
|
||||
</template>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template name="commandline">
|
||||
<div>
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
|
||||
{{#api_section "commandline"}}Command line{{/api_section}}
|
||||
|
||||
@@ -188,6 +188,6 @@ instead of deploying to Meteor's servers. You will have to deal with
|
||||
logging, monitoring, backups, load-balancing, etc, all of which we
|
||||
handle for you if you use `meteor deploy`.
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -21,7 +21,7 @@ when writing those apps.
|
||||
|
||||
<template name="whatismeteor">
|
||||
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
|
||||
<h2 id="whatismeteor">What is Meteor?</h2>
|
||||
|
||||
@@ -69,11 +69,11 @@ In Meteor 1.0, the `meteor` build tool will have full support for
|
||||
Atmosphere.
|
||||
{{/note}}
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</template>
|
||||
|
||||
<template name="structure">
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
|
||||
<h2 id="structuringyourapp">Structuring your application</h2>
|
||||
|
||||
@@ -170,11 +170,11 @@ These rules stack, so that within `lib`, for example, files are still
|
||||
loaded in alphabetical order; and if there are multiple files named
|
||||
`main.js`, the ones in subdirectories are loaded earlier.
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</template>
|
||||
|
||||
<template name="data">
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
|
||||
<h2 id="dataandsecurity">Data and security</h2>
|
||||
|
||||
@@ -350,11 +350,11 @@ and publish functions validate all of their arguments. Just run
|
||||
method or publish function which skips `check`ing any of its arguments will fail
|
||||
with an exception.
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</template>
|
||||
|
||||
<template name="reactivity">
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
|
||||
<h2 id="reactivity">Reactivity</h2>
|
||||
|
||||
@@ -417,11 +417,11 @@ Meteor's
|
||||
is a package called [`Deps`](#deps) that is fairly short and straightforward.
|
||||
You can use it yourself to implement new reactive data sources.
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</template>
|
||||
|
||||
<template name="livehtml">
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
|
||||
<h2 id="livehtml">Live HTML</h2>
|
||||
|
||||
@@ -488,11 +488,11 @@ preserve these elements even when their enclosing template is
|
||||
rerendered, but will still update their children and copy over any
|
||||
attribute changes.
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</template>
|
||||
|
||||
<template name="templates">
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
|
||||
<h2 id="templates">Templates</h2>
|
||||
|
||||
@@ -640,11 +640,11 @@ discussion.
|
||||
> Session.set("weather", "cool and dry");
|
||||
In DOM: <div>It'll be cool and dry tonight</div>
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</template>
|
||||
|
||||
<template name="packages_concept">
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
|
||||
<h2 id="usingpackages">Using packages</h2>
|
||||
|
||||
@@ -681,12 +681,12 @@ are willing to brave the fact that the Meteor package format is not
|
||||
documented yet and will change significantly before Meteor 1.0. See
|
||||
[Writing Packages](#writingpackages).
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</template>
|
||||
|
||||
|
||||
<template name="namespacing">
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
|
||||
<h2 id="namespacing">Namespacing</h2>
|
||||
|
||||
@@ -775,12 +775,12 @@ certainly shouldn't depend on this quirk, and in the future Meteor may
|
||||
check for it and throw an error if you do.
|
||||
{{/note}}
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</template>
|
||||
|
||||
|
||||
<template name="deploying">
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
|
||||
<h2 id="deploying">Deploying</h2>
|
||||
|
||||
@@ -846,12 +846,12 @@ have `npm` available, and run the following:
|
||||
$ npm install fibers@1.0.1
|
||||
{{/warning}}
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</template>
|
||||
|
||||
|
||||
<template name="packages_writing">
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
|
||||
<h2 id="writingpackages">Writing packages</h2>
|
||||
|
||||
@@ -950,5 +950,5 @@ quick tips:
|
||||
machine architecture, but if not your built Meteor package will be
|
||||
portable.
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</template>
|
||||
|
||||
@@ -22,10 +22,6 @@
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<template name="better_markdown">
|
||||
{{> content}}
|
||||
</template>
|
||||
|
||||
<template name="nav">
|
||||
<div id="nav-inner">
|
||||
{{#each sections}}
|
||||
@@ -74,20 +70,20 @@
|
||||
<dt><span class="name">{{{name}}}</span>
|
||||
{{#if type}}<span class="type">{{type}}</span>{{/if}}
|
||||
</dt>
|
||||
<dd>{{#better_markdown}}{{> content}}{{/better_markdown}}</dd>
|
||||
<dd>{{#markdown}}{{> content}}{{/markdown}}</dd>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<template name="warning">
|
||||
<div class="warning">
|
||||
{{#better_markdown}}{{> content}}{{/better_markdown}}
|
||||
{{#markdown}}{{> content}}{{/markdown}}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template name="note">
|
||||
<div class="note">
|
||||
{{#better_markdown}}{{> content}}{{/better_markdown}}
|
||||
{{> content}}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
not here -->
|
||||
<!-- XXX by: (three headshot thumbnails w names) -->
|
||||
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
|
||||
<b>_Meteor is an ultra-simple environment for building modern websites.
|
||||
What once took weeks, even with the best tools, now takes hours with
|
||||
@@ -132,6 +132,6 @@ with the project!
|
||||
<dd>The core code is on <a href="http://github.com/meteor/meteor">GitHub</a>. If you're able to write code or file issues, we'd love to have your help. Please read <a href="https://github.com/meteor/meteor/wiki/Contributing-to-Meteor">Contributing to Meteor</a> for how to get started.
|
||||
</dl>
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template name="packages">
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
|
||||
<h1 id="packages">Packages</h1>
|
||||
|
||||
@@ -34,5 +34,5 @@ and removed with:
|
||||
{{> pkg_showdown}}
|
||||
{{> pkg_underscore}}
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</template>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template name="pkg_accounts_ui">
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
## `accounts-ui`
|
||||
|
||||
A turn-key user interface for Meteor Accounts.
|
||||
@@ -29,5 +29,5 @@ when the URLs are loaded.
|
||||
|
||||
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</template>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template name="pkg_amplify">
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
|
||||
## `amplify`
|
||||
|
||||
@@ -10,5 +10,5 @@ components, and several useful utility functions.
|
||||
Amplify defines a global namespace `amplify` on the client only. It does
|
||||
not run on the server.
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</template>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template name="pkg_appcache">
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
|
||||
## `appcache`
|
||||
|
||||
@@ -89,5 +89,5 @@ cache, see the
|
||||
[AppCache page](https://github.com/meteor/meteor/wiki/AppCache)
|
||||
in the Meteor wiki.
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</template>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template name="pkg_audit_argument_checks">
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
|
||||
## `audit-argument-checks`
|
||||
|
||||
@@ -14,5 +14,5 @@ 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.
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</template>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template name="pkg_backbone">
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
## `backbone`
|
||||
|
||||
[Backbone](http://documentcloud.github.com/backbone/) is a popular client-side MVC framework for managing complex
|
||||
@@ -7,5 +7,5 @@ data in the browser. In addition to the MVC and DOM-binding
|
||||
functionality, it also provides an API for HTML5 pushState and
|
||||
client-side URL routing.
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</template>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template name="pkg_bootstrap">
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
## `bootstrap`
|
||||
|
||||
[Twitter's Bootstrap](http://twitter.github.com/bootstrap/) package is a front-end toolkit for faster, more
|
||||
@@ -9,5 +9,5 @@ interactions including typography, forms, buttons, tables, grids, and
|
||||
navigation.
|
||||
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</template>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template name="pkg_browser_policy">
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
## `browser-policy`
|
||||
|
||||
The `browser-policy` package lets you set security-related policies that will be
|
||||
@@ -161,5 +161,5 @@ allows images to have their `src` attributes point to images served from
|
||||
and WebSocket connections to `https://example.com`.
|
||||
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</template>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template name="pkg_coffeescript">
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
## `coffeescript`
|
||||
|
||||
[CoffeeScript](http://coffeescript.org/) is a little language that
|
||||
@@ -48,5 +48,5 @@ 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.
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</template>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template name="pkg_d3">
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
|
||||
## `d3`
|
||||
|
||||
@@ -13,5 +13,5 @@ to DOM manipulation.
|
||||
The `d3` package adds the D3 library to the client JavaScript
|
||||
bundle. It has no effect on the server.
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</template>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template name="pkg_force_ssl">
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
## `force-ssl`
|
||||
|
||||
This package causes Meteor to redirect insecure connections (HTTP) to a
|
||||
@@ -19,5 +19,5 @@ Applications deployed to `meteor.com` subdomains with
|
||||
`meteor deploy` are automatically served via HTTPS using Meteor's
|
||||
certificate.
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</template>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template name="pkg_jquery">
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
|
||||
## `jquery`
|
||||
|
||||
@@ -17,5 +17,5 @@ plugins as separate packages. These include:
|
||||
* [`jquery-layout`](http://layout.jquery-dev.net/)
|
||||
* [`jquery-waypoints`](http://imakewebthings.com/jquery-waypoints/)
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</template>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template name="pkg_less">
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
## `less`
|
||||
|
||||
[LESS](http://lesscss.org/) extends CSS with dynamic behavior such as variables, mixins,
|
||||
@@ -15,5 +15,5 @@ If you want to `@import` a file, give it the extension `.lessimport`
|
||||
to prevent Meteor from processing it independently.
|
||||
{{/note}}
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</template>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template name="pkg_random">
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
## `random`
|
||||
|
||||
The `random` package provides several functions for generating random
|
||||
@@ -28,5 +28,5 @@ Returns a random string of `n` hexadecimal digits.
|
||||
{{/dtdd}}
|
||||
</dl>
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</template>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template name="pkg_spiderable">
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
## `spiderable`
|
||||
|
||||
|
||||
@@ -34,5 +34,5 @@ If you deploy your application with `meteor bundle`, you must install
|
||||
{{/warning}}
|
||||
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</template>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template name="pkg_stylus">
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
## `stylus`
|
||||
|
||||
[Stylus](http://learnboost.github.com/stylus/) is a CSS pre-processor with a simple syntax and expressive
|
||||
@@ -16,5 +16,5 @@ your `.styl` files to enable cross-browser mixins such as
|
||||
|
||||
See <http://visionmedia.github.com/nib> for documentation of the nib extensions of Stylus.
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</template>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template name="pkg_underscore">
|
||||
{{#better_markdown}}
|
||||
{{#markdown}}
|
||||
## `underscore`
|
||||
|
||||
[Underscore](http://underscorejs.org/) is a utility-belt library for
|
||||
@@ -19,5 +19,5 @@ package as we will remove the default underscore in the future.
|
||||
{{/warning}}
|
||||
|
||||
|
||||
{{/better_markdown}}
|
||||
{{/markdown}}
|
||||
</template>
|
||||
|
||||
@@ -132,6 +132,18 @@ HTML.toText = function (node, textMode, parentComponent) {
|
||||
|
||||
};
|
||||
|
||||
HTML.Raw.prototype.toText = function () {
|
||||
return this.value;
|
||||
};
|
||||
|
||||
// used when including templates within {{#markdown}}
|
||||
HTML.Tag.prototype.toText = function (textMode) {
|
||||
if (textMode === HTML.TEXTMODE.STRING)
|
||||
return this.toHTML();
|
||||
else
|
||||
throw new Error("Can't insert tags in attributes or TEXTAREA elements");
|
||||
};
|
||||
|
||||
HTML.CharRef.prototype.toText = function (textMode) {
|
||||
if (textMode === HTML.TEXTMODE.STRING)
|
||||
return this.str;
|
||||
|
||||
@@ -4,7 +4,7 @@ if (Package.ui) {
|
||||
Package.ui.Handlebars.registerHelper('markdown', UI.block(function () {
|
||||
var self = this;
|
||||
return function () {
|
||||
var text = UI.toRawText(self.__content);
|
||||
var text = UI.toRawText(self.__content, self /*parentComponent*/);
|
||||
var converter = new Showdown.converter();
|
||||
return HTML.Raw(converter.makeHtml(text));
|
||||
};
|
||||
|
||||
@@ -288,7 +288,8 @@
|
||||
</template>
|
||||
|
||||
<template name="spacebars_template_test_markdown_basic">
|
||||
{{#markdown}}
|
||||
{{#with obj}}
|
||||
{{#markdown}}
|
||||
{{hi}}
|
||||
/each}}
|
||||
|
||||
@@ -301,20 +302,28 @@
|
||||
* <b>{{hi}}</b>
|
||||
* <b>/each}}</b>
|
||||
|
||||
some paragraph to fix showdown's four space parsing below.
|
||||
|
||||
{{hi}}
|
||||
/each}}
|
||||
|
||||
<b>{{hi}}</b>
|
||||
<b>/each</b>
|
||||
<b>/each}}</b>
|
||||
|
||||
>
|
||||
|
||||
* >
|
||||
|
||||
`>`
|
||||
|
||||
>
|
||||
|
||||
>
|
||||
|
||||
* >
|
||||
|
||||
`>`
|
||||
|
||||
>
|
||||
|
||||
`{{hi}}`
|
||||
@@ -323,19 +332,29 @@
|
||||
`<b>{{hi}}</b>`
|
||||
`<b>/each}}`
|
||||
|
||||
{{/markdown}}
|
||||
{{/markdown}}
|
||||
{{/with}}
|
||||
</template>
|
||||
|
||||
<template name="spacebars_template_test_markdown_if">
|
||||
{{#markdown}}
|
||||
|
||||
{{#if cond}}true{{else}}false{{/if}}
|
||||
|
||||
<b>{{#if cond}}true{{else}}false{{/if}}</b>
|
||||
|
||||
* {{#if cond}}true{{else}}false{{/if}}
|
||||
|
||||
* <b>{{#if cond}}true{{else}}false{{/if}}</b>
|
||||
|
||||
some paragraph to fix showdown's four space parsing below.
|
||||
|
||||
{{#if cond}}true{{else}}false{{/if}}
|
||||
|
||||
<b>{{#if cond}}true{{else}}false{{/if}}</b>
|
||||
|
||||
`{{#if cond}}true{{else}}false{{/if}}`
|
||||
|
||||
`<b>{{#if cond}}true{{else}}false{{/if}}</b>`
|
||||
|
||||
{{/markdown}}
|
||||
@@ -345,12 +364,21 @@
|
||||
{{#markdown}}
|
||||
|
||||
{{#each seq}}{{.}}{{/each}}
|
||||
|
||||
<b>{{#each seq}}{{.}}{{/each}}</b>
|
||||
|
||||
* {{#each seq}}{{.}}{{/each}}
|
||||
|
||||
* <b>{{#each seq}}{{.}}{{/each}}</b>
|
||||
|
||||
some paragraph to fix showdown's four space parsing below.
|
||||
|
||||
{{#each seq}}{{.}}{{/each}}
|
||||
|
||||
<b>{{#each seq}}{{.}}{{/each}}</b>
|
||||
|
||||
`{{#each seq}}{{.}}{{/each}}`
|
||||
|
||||
`<b>{{#each seq}}{{.}}{{/each}}</b>`
|
||||
|
||||
{{/markdown}}
|
||||
@@ -363,7 +391,7 @@
|
||||
</template>
|
||||
|
||||
<template name="spacebars_template_test_markdown_inclusion_subtmpl">
|
||||
Nothing in particular
|
||||
<span>Nothing in particular</span>
|
||||
</template>
|
||||
|
||||
<template name="spacebars_template_test_markdown_block_helpers">
|
||||
|
||||
@@ -946,16 +946,76 @@ Tinytest.add('spacebars - templates - constant #each argument', function (test)
|
||||
// @returns {String} simplified html content
|
||||
var divContentForMarkdown = function (div) {
|
||||
return trim(stripComments(div.innerHTML))
|
||||
.replace(/\<br\>/g, '\n');
|
||||
.replace(/\<br\>/g, '\n')
|
||||
.replace(/<(\/?\S+)>/g, function (s) { return s.toLowerCase(); }); // for IE
|
||||
};
|
||||
|
||||
// extract a multi-line string from a comment within a function.
|
||||
// @param f {Function} eg function () { /* [[[...content...]]] */ }
|
||||
// @returns {String} eg "content"
|
||||
var textFromFunction = function(f) {
|
||||
return f.toString().match(/\[\[\[([\S\s]*)\]\]\]/m)[1]
|
||||
.replace(/[ ]*\/\/ \d+$/gm, ''); // remove line number comments
|
||||
};
|
||||
|
||||
Tinytest.add('spacebars - templates - #markdown - basic', function (test) {
|
||||
var tmpl = Template.spacebars_template_test_markdown_basic;
|
||||
tmpl.obj = {snippet: "<i>hi</i>"};
|
||||
tmpl.hi = function () {
|
||||
return "<i>hi</i>";
|
||||
return this.snippet;
|
||||
};
|
||||
var div = renderToDiv(tmpl);
|
||||
test.equal(divContentForMarkdown(div), "FIXME");
|
||||
test.equal(divContentForMarkdown(div), textFromFunction(function () { /*
|
||||
[[[<p><i>hi</i>
|
||||
/each}}</p>
|
||||
|
||||
<p><b><i>hi</i></b>
|
||||
<b>/each}}</b></p>
|
||||
|
||||
<ul>
|
||||
<li><i>hi</i></li>
|
||||
<li><p>/each}}</p></li>
|
||||
<li><p><b><i>hi</i></b></p></li>
|
||||
<li><b>/each}}</b></li>
|
||||
</ul>
|
||||
|
||||
<p>some paragraph to fix showdown's four space parsing below.</p>
|
||||
|
||||
<pre><code><i>hi</i>
|
||||
/each}}
|
||||
|
||||
<b><i>hi</i></b>
|
||||
<b>/each}}</b>
|
||||
</code></pre>
|
||||
|
||||
<p>&gt</p>
|
||||
|
||||
<ul>
|
||||
<li>&gt</li>
|
||||
</ul>
|
||||
|
||||
<p><code>&gt</code></p>
|
||||
|
||||
<pre><code>&gt
|
||||
</code></pre>
|
||||
|
||||
<p>></p>
|
||||
|
||||
<ul>
|
||||
<li>></li>
|
||||
</ul>
|
||||
|
||||
<p><code>&gt;</code></p>
|
||||
|
||||
<pre><code>&gt;
|
||||
</code></pre>
|
||||
|
||||
<p><code><i>hi</i></code>
|
||||
<code>/each}}</code></p>
|
||||
|
||||
<p><code><b><i>hi</i></b></code>
|
||||
<code><b>/each}}</code></p>]]] */
|
||||
}));
|
||||
});
|
||||
|
||||
Tinytest.add('spacebars - templates - #markdown - if', function (test) {
|
||||
@@ -964,10 +1024,50 @@ Tinytest.add('spacebars - templates - #markdown - if', function (test) {
|
||||
tmpl.cond = function () { return R.get(); };
|
||||
|
||||
var div = renderToDiv(tmpl);
|
||||
test.equal(divContentForMarkdown(div), "FIXME(false)");
|
||||
test.equal(divContentForMarkdown(div), textFromFunction(function () { /*
|
||||
[[[<p>false</p>
|
||||
|
||||
<p><b>false</b></p>
|
||||
|
||||
<ul>
|
||||
<li><p>false</p></li>
|
||||
<li><p><b>false</b></p></li>
|
||||
</ul>
|
||||
|
||||
<p>some paragraph to fix showdown's four space parsing below.</p>
|
||||
|
||||
<pre><code>false
|
||||
|
||||
<b>false</b>
|
||||
</code></pre>
|
||||
|
||||
<p><code>false</code></p>
|
||||
|
||||
<p><code><b>false</b></code></p>]]] */
|
||||
}));
|
||||
R.set(true);
|
||||
Deps.flush();
|
||||
test.equal(divContentForMarkdown(div), "FIXME(true)");
|
||||
test.equal(divContentForMarkdown(div), textFromFunction(function () { /*
|
||||
[[[<p>true</p>
|
||||
|
||||
<p><b>true</b></p>
|
||||
|
||||
<ul>
|
||||
<li><p>true</p></li>
|
||||
<li><p><b>true</b></p></li>
|
||||
</ul>
|
||||
|
||||
<p>some paragraph to fix showdown's four space parsing below.</p>
|
||||
|
||||
<pre><code>true
|
||||
|
||||
<b>true</b>
|
||||
</code></pre>
|
||||
|
||||
<p><code>true</code></p>
|
||||
|
||||
<p><code><b>true</b></code></p>]]] */
|
||||
}));
|
||||
});
|
||||
|
||||
Tinytest.add('spacebars - templates - #markdown - each', function (test) {
|
||||
@@ -976,16 +1076,53 @@ Tinytest.add('spacebars - templates - #markdown - each', function (test) {
|
||||
tmpl.seq = function () { return R.get(); };
|
||||
|
||||
var div = renderToDiv(tmpl);
|
||||
test.equal(divContentForMarkdown(div), "FIXME([])");
|
||||
test.equal(divContentForMarkdown(div), textFromFunction(function () { /*
|
||||
[[[<p><b></b></p>
|
||||
|
||||
<ul>
|
||||
<li></li>
|
||||
<li><b></b></li>
|
||||
</ul>
|
||||
|
||||
<p>some paragraph to fix showdown's four space parsing below.</p>
|
||||
|
||||
<pre><code><b></b>
|
||||
</code></pre>
|
||||
|
||||
<p>``</p>
|
||||
|
||||
<p><code><b></b></code></p>]]] */
|
||||
}));
|
||||
|
||||
R.set(["item"]);
|
||||
Deps.flush();
|
||||
test.equal(divContentForMarkdown(div), "FIXME([\"item\"])");
|
||||
test.equal(divContentForMarkdown(div), textFromFunction(function () { /*
|
||||
[[[<p>item</p>
|
||||
|
||||
<p><b>item</b></p>
|
||||
|
||||
<ul>
|
||||
<li><p>item</p></li>
|
||||
<li><p><b>item</b></p></li>
|
||||
</ul>
|
||||
|
||||
<p>some paragraph to fix showdown's four space parsing below.</p>
|
||||
|
||||
<pre><code>item
|
||||
|
||||
<b>item</b>
|
||||
</code></pre>
|
||||
|
||||
<p><code>item</code></p>
|
||||
|
||||
<p><code><b>item</b></code></p>]]] */
|
||||
}));
|
||||
});
|
||||
|
||||
Tinytest.add('spacebars - templates - #markdown - inclusion', function (test) {
|
||||
var tmpl = Template.spacebars_template_test_markdown_inclusion;
|
||||
var div = renderToDiv(tmpl);
|
||||
test.equal(divContentForMarkdown(div), "<p>Nothing in particular</p>");
|
||||
test.equal(divContentForMarkdown(div), "<p><span>Nothing in particular</span></p>");
|
||||
});
|
||||
|
||||
Tinytest.add('spacebars - templates - #markdown - block helpers', function (test) {
|
||||
|
||||
@@ -12,7 +12,7 @@ UI.If = Component.extend({
|
||||
// of a Component during init (but presumably not before
|
||||
// or after)?
|
||||
},
|
||||
render: function (buf) {
|
||||
render: function () {
|
||||
var self = this;
|
||||
return function () {
|
||||
var condition = getCondition(self);
|
||||
@@ -54,7 +54,7 @@ UI.Unless = Component.extend({
|
||||
this.condition = this.data;
|
||||
this.data = undefined;
|
||||
},
|
||||
render: function (buf) {
|
||||
render: function () {
|
||||
var self = this;
|
||||
return function () {
|
||||
var condition = getCondition(self);
|
||||
@@ -68,7 +68,7 @@ UI.With = Component.extend({
|
||||
init: function () {
|
||||
this.condition = this.data;
|
||||
},
|
||||
render: function (buf) {
|
||||
render: function () {
|
||||
var self = this;
|
||||
return function () {
|
||||
var condition = getCondition(self);
|
||||
|
||||
Reference in New Issue
Block a user