Commit Graph

67 Commits

Author SHA1 Message Date
David Greenspan
bb271987e0 Improve errors when scanning .html file (#3758) 2015-03-27 10:00:33 -07:00
Sashko Stubailo
5cbe84e917 Remove error checking for <body> attrs 2015-02-24 17:14:56 -08:00
Netanel Gilad
d49af044d2 throw error instead of warning when two attributes with the same name are defined in the body. 2015-02-23 21:24:49 -08:00
Netanel Gilad
fa4e9c676e add body attributes tests 2015-02-23 21:24:49 -08:00
Netanel Gilad
48ecdf1d54 add warning when the same body attribute appears more than once. 2015-02-23 21:24:48 -08:00
Netanel Gilad
0eab851204 add body attributes to body 2015-02-23 21:24:48 -08:00
David Greenspan
0177507492 Template._body_ to Template.body 2014-08-26 17:37:52 -07:00
David Greenspan
be0e2a0139 Remove Template.__assign in favor of __checkName
It seems nice to actually write `Template[“foo”] = …` in our generated code rather than obscuring it behind __assign.
2014-08-17 12:04:25 -07:00
David Greenspan
7035b91249 Merge branch 'devel' into blaze-templates
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
2014-08-08 18:16:56 -07:00
David Greenspan
22d4c48188 Rename Template.__create__, __define__, and others
* `Template.__create__` is now `new Template`
* `Template = Blaze.Template`
* `Template` is a constructor function
* `Template.foo instanceof Template` (but keep `Blaze.isTemplate`)
* No more `Blaze.runTemplate` (use `template.constructView`)
* `constructView` instead of `__makeView`
* template objects have `__kind` and `__render`
* No `__viewName`, `__templateName`
* `Template.__body__` is now `Template._body_` (and renamed methods)
* No `Template.__lookup__`, instead `(name in Template) && (Template[name] instance of Template)`
* `Template.__define__` replaced by `Template.__assign(name, template)`
2014-08-06 16:05:27 -07:00
David Glasser
ddc3657e4f Watch files which fail before emitting a resource
Regression introduced by the CSS watching code (specifically, f230eba62)
by the sourceIsWatched check. We need to be able to tell the difference
between "source handler didn't do anything because there was an error"
and "source handler didn't do anything because it's web-specific and
this is an os arch".

A simple fix would have been to interpret compileStep.error as
"sourceIsWatched = true", but I didn't think of that until after doing
it the slightly more complicated but more precise way :)

Also, ensure that if the runner rebuilds the client and there's an
error, it properly kills the app process (and the watchers and the
keepalive interval, etc).
2014-08-04 21:32:22 -07:00
Matthew Arbesfeld
8bcbd65344 Separate "browser" target into web.browser/cordova
Cordova projects often have a different set of files than web targets,
so we would like to be able to target different client architectures in
our bundles. Ideally, we allow the user to use arbitrary client
architectures - but this patch is a step in the right direction by
abstracting out more of the hard coded "browser"/"os" lines.

We accomplish this separation in a backwards compatible way by allowing
api.___ commands to target a "client" architecture. For example,
api.addFiles('a.js', 'client') adds 'a.js' to both the 'client.browser'
and 'client.cordova' targets.

Effects on 0.9 packaging stuff: packages don't have to change, but the
"data.json" file in ".meteor0" has "browser" in some places. We think we
have to fix the troposphere code where this data.json is created.

Some plugins will also be backwards-incompatible with this change, since
many have a "clientArch.matches("browser")" line in the plugin
code. Ideally, we fix plugins so that this stops being an issue, but for
now package authors can just patch that line.

At the compiled (unipackage) level the new names are 'web.browser' and
'web.cordova', replacing 'browser'. In package.js, the new names are
'client.browser' and 'client.cordova', serving as an adjunct to 'client'.
2014-07-31 14:12:15 -07:00
David Greenspan
63a99da4d2 Tweaks to view kinds 2014-06-26 19:55:29 -07:00
David Greenspan
2bef2924a4 Make Blaze.View not require new 2014-06-26 09:51:13 -07:00
David Greenspan
7eecf9a9ff Make templates use Blaze.Views (break the world)
The path forward is to start with an empty app and get basic template tags working again, then finish rewriting the builtins (with/if/unless/each).
2014-06-25 18:08:41 -07:00
David Greenspan
a72c497276 UI.body2 -> UI.body 2014-06-21 18:19:09 -07:00
David Greenspan
bc4339c1dc Replace old codegen with codegen2 2014-05-06 14:30:48 -07:00
David Greenspan
1b6a06615e Make a simple {{test}} tag work
You put it in the body of your app and put a helper on UI.body2.  Bam.

For now, the modifications to CodeGen will go in CodeGen2.  Otherwise, the server-side "webapp" template would barf.

Gotta make more template tags work now.
2014-05-05 15:52:58 -07:00
David Greenspan
b8f7f1d093 Try out using Blaze in UI (break the world)
Basically all that works is an app with a static body :)
2014-05-01 00:13:07 -07:00
David Greenspan
fc64081c52 Move Spacebars compiler to SpacebarsCompiler
The pattern of one package defining Spacebars and another augmenting it with methods like Spacebars.parse is too confusing.

The symbols `parse`, `compile`, `TemplateTag` are now on `SpacebarsCompiler`.  You can now access `SpacebarsCompiler.optimize`, and we can start exposing more symbols.
2014-04-24 13:23:01 -07:00
David Glasser
f36abc946e Generalize "load *.html files first" hack
Now any plugin can request that its files be treated as "templates" by
setting an isTemplate flag.

(This API is just as supported as you'd expect based on the fact that
you still can't access it without calling a function which starts with
"_transitional_".)

Tested by renaming leaderboard.js to a.js and confirming that it still
works (and that it *doesn't* if templating does not set isTemplate).
2014-04-01 17:21:24 -07:00
Avital Oliver
d46a5e11b1 Correctly check for reserved template names 2014-01-26 11:52:27 -08:00
Avital Oliver
23405cd5d4 Don't allow templates named 'content'
Trying to include them later with {{> content}}
fails. We could disallow the other built-ins,
eg 'if' and 'elseContent' but sounds less likely
that users will try to define templates with
those names, and this simple change lets us
not duplicate code.
2014-01-22 19:35:44 -08:00
David Greenspan
cd6387cc02 Clean up DomRange, phase 1
- Get rid of DomRange "host objects" (too confusing)
- start to use `r instanceof DomRange` instead of `'dom' in r`

Ported domrange tests; all tests pass
2014-01-09 20:23:35 -08:00
David Greenspan
7e7f29c550 Perform template optimization in <body> too 2014-01-08 13:09:57 -08:00
David Greenspan
df0e414193 Route Spacebars errors properly
Now Spacebars syntax errors (as well as html_scanner errors) go through proper error reporting channels rather than throwing exceptions.  For simple cases, we are back to showing nice errors like Handlebars did on devel, with context.

Next:  Comb the spacebars compiler for errors that are thrown or lack good line numbers.  Go through our own list of bad error messages.
2014-01-06 13:48:31 -08:00
David Greenspan
7fadc29828 Start to make markdown work; avoid double UI.body 2013-12-11 22:32:48 -08:00
David Greenspan
cb2d331dbf seems to work (not fully tested) 2013-12-09 22:52:20 -08:00
David Greenspan
1952a61c53 De-2 {render,parse,compile,mustache}2 2013-12-06 01:27:07 -08:00
David Greenspan
0c087cc84a html2_scanner -> html_scanner 2013-12-06 01:22:02 -08:00
David Greenspan
2e4199e9ee get rid of 2s in file names 2013-12-06 01:19:22 -08:00
David Greenspan
7dc913723d Destroy tons of dead code 2013-12-06 01:12:25 -08:00
David Greenspan
47953854bb Render test results using html2! break embox...
This commit does the minimum to switch to the new renderer,
by mapping .html to html2_scanner.  Now we have to remove
all the references to "2" and all the old dead code, of course.

Our use of emboxValue breaks test-in-browser pretty severely
by assuming that in `{{#each results}}`, if `results` is `===`
to what it was last time, then there is no change.  In fact,
test-in-browser mutates arrays and expects invalidating the
result to cause a re-render.
2013-12-06 00:32:12 -08:00
David Greenspan
6397fec3dc Port html_scanner tests; detect duplicate templates
Reintroduce a Template.__define__ (like on devel)

Remove old compiler tests
2013-12-05 16:31:59 -08:00
David Greenspan
ccd3e185fc making block helpers work 2013-12-03 14:23:18 -08:00
David Greenspan
ae7ac181fc pass .html2 files to the new rendering system
this is a temporary state of affairs for testing the branch
2013-11-22 15:03:11 -08:00
David Greenspan
d1e6bd1a4f spacebars: prettier code gen pretty-printing 2013-10-08 19:02:42 -07:00
David Greenspan
b88e40b0b7 hack for lexical scope of {{> content}} 2013-10-07 15:37:56 -07:00
David Greenspan
7a112872fd fix {{> content}} in {{#if} with messy hack 2013-10-07 14:27:20 -07:00
David Greenspan
6e5d73d181 fix html_scanner tests a little bit 2013-10-03 16:22:37 -07:00
Avital Oliver
4f564062a0 let packages define templates 2013-10-02 14:00:36 -07:00
David Greenspan
4add01f934 events seem to work 2013-09-17 14:25:01 -07:00
David Greenspan
2ff37d14f3 shark example seems to work (with many XXX) 2013-08-26 13:59:00 -07:00
David Glasser
75a4cf3199 Merge branch 'devel' into shark
Conflicts:
	packages/templating/deftemplate.js
	packages/templating/package.js
	packages/templating/plugin/html_scanner.js
	packages/test-in-browser/driver.js
	tools/packages.js
2013-08-01 17:17:18 -07:00
David Glasser
af06112044 templating implies spark and meteor: generated code needs them.
also finish getting rid of deprecated startup package, and some other minor
packaging cleanups to templating.
2013-07-26 19:34:45 -07:00
Geoff Schmidt
3d1c09794f Comprehensive namespace cleanup. 2013-07-25 18:54:40 -07:00
David Greenspan
95c4a2124c fix misc stuff 2013-07-25 05:22:03 -07:00
David Greenspan
c91307e32e try to get apps working (crashes Chrome) 2013-07-25 04:07:55 -07:00
David Greenspan
df3939bf2d mv ui2 ui; port spacebars (untested) 2013-07-25 01:32:18 -07:00
David Greenspan
23fa59bd77 bodies inherit from UI.Body 2013-07-16 19:45:56 -07:00