Commit Graph

41 Commits

Author SHA1 Message Date
Anubhav Jain
cfe29661fc Added more reserved names in compile time check 2015-07-23 12:12:35 -07:00
Anubhav Jain
b6a2dfedc1 Fix for preventing templates from having reserved names like 'body' and 'instance' 2015-07-23 12:12:35 -07:00
David Greenspan
e8234592b0 Fix {{#each helper arg1 arg2}}
Broken by each-in support.

Now we just look to see if there's an `in` in the right position in order to tell the two cases apart.

We could consider deprecating this syntax in favor of the
(now-supported) {{#each (helper arg1 arg2)}}.
2015-05-13 10:40:58 -07:00
David Greenspan
afd240fa6f Minor cleanup 2015-05-12 15:34:32 -07:00
David Greenspan
0550f6d48f Fix #let codegen and re-rendering
All tests green
2015-05-12 15:23:07 -07:00
David Greenspan
c3bef2ca79 Better #each argument validation
And another failing test for #let (argument validation)
2015-05-12 15:23:07 -07:00
David Greenspan
d79863910e Small Spacebars codegen fix 2015-05-08 17:23:41 -07:00
Slava Kim
83611e9116 Merge branch 'spacebars-nested-exprs' into devel 2015-04-23 14:27:07 -07:00
Slava Kim
474a39500e Address sashko's and greenspan's comments 2015-04-06 17:12:54 -07:00
Slava Kim
55fa333d94 Implement the codegen logic for nested mustache expressions 2015-04-02 11:04:57 -07:00
Slava Kim
c34d36986b Implement {{#let}} 2015-04-01 16:41:59 -07:00
Slava Kim
4df9b115a5 Generate Spacebars.call instead of calling the function manually 2015-04-01 16:39:08 -07:00
Slava Kim
d7ca9fc000 Add {{#each item in items}} syntax to spacebars 2015-04-01 16:39:08 -07:00
Slava Kim
be93ffc1d7 Annotate Blaze autoruns for debugging and better errors 2015-02-26 18:44:52 -08:00
Sashko Stubailo
c0aab1e8d3 Template-level subscriptions 2015-02-11 18:10:33 -08:00
David Greenspan
cd0b347b86 Allow {{| in attributes, add tests
Unfortunately, these escapes don’t enjoy full “optimization” because template tags are expanded after optimization.  To remedy this, we’d have to be more flexible about what TemplateTags can parse into (e.g. a string), or add another pass to the compiler.
2014-10-28 16:27:01 -07:00
Matteo De Micheli
82a08333b5 Added the possibility to escape "{{" braces by appending a vertical bar "{{|" 2014-10-26 16:53:17 +01:00
David Greenspan
e42ad696df Ban templates named after macros like “dynamic” 2014-09-18 17:34:56 -07:00
David Greenspan
855284559a Back-compat tests 2014-09-18 17:29:04 -07:00
David Greenspan
e7cf040177 Rename {{> UI.*}} to Template; remove UI uses
Rename inclusion macros (with back-compat) to: Template.dynamic, Template.contentBlock, Template.elseBlock.

Update all uses and mentions of UI in the repo, unless they are there for back-compat or testing reasons.

To do: Run unit tests.  Update docs for UI.dynamic.  Document Template.contentBlock and Template.elseBlock.
2014-09-17 17:24:25 -07:00
David Greenspan
307b9a9504 Make more Blaze calls private
Put underscores before:

ReactiveVar, InOuterTemplateScope, EventSupport, reportException,
wrapCatchingExceptions, DOMMaterializer, and HTMLJSExpander
2014-08-11 14:38:46 -07:00
David Greenspan
7ca944e665 UI.render/toHTML, TemplateWith, Blaze.toText
Move Spacebars.TemplateWith to Blaze._TemplateWith.  It is the official
way to give a template data, after all, but it’s a little too weird to
make public.  Use it in Blaze.renderWithData, even though it doesn’t
seem like it would make a difference.

Unify UI.render/renderWithData with Blaze.render, and add
toHTMLWithData.  Publicly, they take a Template or a View.
The View must be unrendered, of course.  If given a Template,
constructView will be called.  Privately, they take any HTMLJS
extended to be allowed to contain Templates and Views, except
null or undefined, or a function returning extended HTMLJS.
The “data” argument may be a function or a not, as in UI.With
(and unlike the old public UI.renderWithData).

Make Blaze.toText private (Blaze._toText).
2014-08-11 14:24:07 -07:00
David Greenspan
734816c7d7 Cleaner codegen of attribute values 2014-07-01 10:57:46 -07:00
David Greenspan
284529992e Fix UI.contentBlock data context 2014-07-01 10:25:48 -07:00
David Greenspan
0766b13ba8 Fix block helpers 2014-06-30 19:13:10 -07:00
David Greenspan
ab4bb8f993 Get rid of 3s/OLDSTYLE, start to exclude old code 2014-06-30 15:45:12 -07:00
David Greenspan
9dd5fac49c webapp_server works
This confirms that we can convert complicated templates (including #if, #each, and dynamic attributes) into HTML using Views.

Template#__lookup was moved to View#lookup, since webapp_server is an example of a case where we have lookup but no template!

Next steps: get rid of the “3” after some names, the OLDSTYLE flag, and dead code in the blaze package.  Then make Template features like events, `helper`, etc. work.
2014-06-30 15:36:33 -07:00
David Greenspan
85b80d3266 Implement lookup, more builtins
Move lookup to templates, not views!
2014-06-26 18:23:31 -07:00
David Greenspan
c01a9df8de Introduce OLDSTYLE flag to not break webapp
Making webapp_server work requires #if and #each that work with toHTML.  Don’t want to have to write that code just to be able to run client code again.
2014-06-26 15:54:40 -07:00
David Greenspan
0940e4dde8 Spacebars.include2 -> Spacebars.include 2014-06-21 18:21:50 -07:00
David Greenspan
99d6545d70 Spacebars.With2 -> Spacebars.With 2014-06-21 18:20:36 -07:00
David Greenspan
72d9cb9b90 Fix {{> content}} data context 2014-06-21 18:16:12 -07:00
David Greenspan
4e8472e970 Proper reactivity for calculated templates 2014-06-09 16:35:24 -07:00
David Greenspan
9108c5debd Match devel’s behavior for inclusion arg context 2014-06-09 14:02:46 -07:00
David Greenspan
1365e63ff8 Start to make custom block helpers work
UI.contentBlock
2014-06-09 12:18:48 -07:00
Emily Stark
4dc2cb6e31 Port UI.dynamic to blaze-refactor 2014-06-06 15:20:29 -07:00
David Greenspan
cff3b175c0 try to fix Spacebars.include2 2014-06-06 12:07:50 -07:00
David Greenspan
38f5932b81 Basic template inclusions work
Events are not attached.

contentBlock doesn’t work.
2014-05-13 18:02:24 -07:00
David Greenspan
bc4339c1dc Replace old codegen with codegen2 2014-05-06 14:30:48 -07:00
David Greenspan
91f279859c comment 2014-05-03 19:21:28 -07:00
David Greenspan
5d09079393 Re-org spacebars-compiler package
Make {codegen,compiler}.js, Spacebars.CodeGen class

Make more internals accessible to the outside
2014-05-03 19:05:36 -07:00