Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixing regex on partial names #526

Merged
merged 1 commit into from

6 participants

@jamesgorrie

Simple one to allow for points in partial names

@jamesgorrie

In respect to #519

@carlos8f

spent all day trying to figure out why my code was crashing. ended up here.

please merge! :thumbsup:

@doowb

+1 Looks like this would fix my issue #519 too.

@kpdecker kpdecker merged commit 47e0aa7 into wycats:master
@kpdecker
Collaborator

Might change how we are doing this in the not too distant future but at minimum we want to ensure that this use case is supported. Thanks for the PR!

@alejandroiglesias alejandroiglesias referenced this pull request from a commit in alejandroiglesias/handlebars.js
@alejandroiglesias alejandroiglesias Update to 1.0.11
commit 5f34991
Author: kpdecker <kpdecker@gmail.com>
Date:   Mon May 27 12:29:57 2013 -0500

    Update in the wild section

    Fixes #246

commit c1020a0
Author: kpdecker <kpdecker@gmail.com>
Date:   Mon May 27 11:52:32 2013 -0500

    Add unicode support for ID tokens

    Fixes #433
    Fixes #469

commit bff71d7
Author: kpdecker <kpdecker@gmail.com>
Date:   Sat May 25 12:32:16 2013 -0500

    Update release notes

commit 4d95d58
Author: kpdecker <kpdecker@gmail.com>
Date:   Sat May 25 12:27:31 2013 -0500

    Rebuild

commit 47e0aa7
Merge: 6bf9c6f f5fe6d0
Author: Kevin Decker <kpdecker@gmail.com>
Date:   Sat May 25 10:07:46 2013 -0700

    Merge pull request #526 from jamesgorrie/master

    Fixing regex on partial names

commit 6bf9c6f
Merge: 533be69 10669e0
Author: kpdecker <kpdecker@gmail.com>
Date:   Wed May 22 08:40:28 2013 -0400

    Merge branch 'master' of github.com:wycats/handlebars.js

commit 533be69
Author: kpdecker <kpdecker@gmail.com>
Date:   Tue May 21 13:12:11 2013 -0500

    Use better variable name

commit a97820f
Author: kpdecker <kpdecker@gmail.com>
Date:   Tue May 21 13:03:41 2013 -0500

    Update testing notes

    Fixes #467

commit f6b6361
Author: kpdecker <kpdecker@gmail.com>
Date:   Tue May 21 13:03:01 2013 -0500

    Fix typo

commit 10669e0
Merge: 5ba17c9 69bcdf3
Author: Kevin Decker <kpdecker@gmail.com>
Date:   Tue May 21 08:46:27 2013 -0700

    Merge pull request #533 from blessenm/amd-precompilation-fix

    Fix for the issue #517

commit 69bcdf3
Author: Blessan Mathew <blessenm@gmail.com>
Date:   Tue May 21 20:50:46 2013 +0530

    Fix for issue #517.

    Now when compiiled with amd option and a single input argument, we are
    checking to see whether the input is a file or folder.

commit 5ba17c9
Merge: 7fb9750 94cc419
Author: kpdecker <kpdecker@gmail.com>
Date:   Sun May 19 11:47:01 2013 -0500

    Merge branch 'master' of github.com:wycats/handlebars.js

commit 7fb9750
Author: kpdecker <kpdecker@gmail.com>
Date:   Sun May 19 11:45:20 2013 -0500

    Update block helper docs in README

    Fixes #231, #259

commit c95d9d6
Author: kpdecker <kpdecker@gmail.com>
Date:   Sun May 19 11:30:26 2013 -0500

    Use context rather than arg in README examples

commit 3aef7f6
Author: kpdecker <kpdecker@gmail.com>
Date:   Sun May 19 11:30:04 2013 -0500

    Misc readme updates

commit f5fe6d0
Author: James Gorrie <james@bravenewtalent.com>
Date:   Fri May 17 16:58:34 2013 +0100

    Allowed for points to be in partial path name

commit 94cc419
Merge: 4cf0410 d649b35
Author: Kevin Decker <kpdecker@gmail.com>
Date:   Tue May 14 21:10:14 2013 -0700

    Merge pull request #515 from jjclark1982/master

    Allow requiring ".handlebars" files within Node.js scripts

commit d649b35
Author: Jesse Clark <jjclark1982@gmail.com>
Date:   Wed May 15 10:50:01 2013 +1000

    Only run "require" tests when require() is available

commit 229b82b
Author: Jesse Clark <jjclark1982@gmail.com>
Date:   Wed May 15 10:38:45 2013 +1000

    Add unit tests for require() handler

commit 531be77
Author: Jesse Clark <jjclark1982@gmail.com>
Date:   Tue May 14 22:26:20 2013 +1000

    Publish a Node.js require() handler for handlebars files

commit 4cf0410
Author: kpdecker <kpdecker@gmail.com>
Date:   Mon May 13 23:09:21 2013 -0500

    1.0.11

commit 2ec5a97
Author: kpdecker <kpdecker@gmail.com>
Date:   Mon May 13 23:08:43 2013 -0500

    Update release notes

commit ddc4d31
Author: kpdecker <kpdecker@gmail.com>
Date:   Mon May 13 23:07:29 2013 -0500

    Rev to rc4

commit 85dd394
Author: kpdecker <kpdecker@gmail.com>
Date:   Fri May 10 01:35:25 2013 -0500

    Add regex escapes

commit 8b65fa7
Author: kpdecker <kpdecker@gmail.com>
Date:   Fri May 10 01:24:11 2013 -0500

    Update release notes

commit fa6cec2
Author: kpdecker <kpdecker@gmail.com>
Date:   Fri May 10 01:02:13 2013 -0500

    Update client packager versions

commit 436973f
Author: kpdecker <kpdecker@gmail.com>
Date:   Fri May 10 01:00:39 2013 -0500

    Version update script

commit a279678
Merge: d355d1f 8a5705a
Author: Kevin Decker <kpdecker@gmail.com>
Date:   Thu May 9 22:37:23 2013 -0700

    Merge pull request #505 from MikeMayer/master

    Include a .nuspec package file to include handlebars.js on NuGet

commit d355d1f
Author: Kevin Decker <kpdecker@gmail.com>
Date:   Fri May 10 00:35:05 2013 -0500

    Fix links in release notes

commit 71c5e36
Merge: 44ae572 fc52a65
Author: Kevin Decker <kpdecker@gmail.com>
Date:   Thu May 9 22:29:27 2013 -0700

    Merge pull request #489 from DevinClark/bower-update

    Added a component.json file for Twitter's Bower package manager.

commit 44ae572
Author: kpdecker <kpdecker@gmail.com>
Date:   Fri May 10 00:14:55 2013 -0500

    Add release notes

    Fixes #471

commit 7cd9cdb
Merge: ef32573 090ee7c
Author: Kevin Decker <kpdecker@gmail.com>
Date:   Thu May 9 21:03:03 2013 -0700

    Merge pull request #513 from tommydudebreaux/master

    Using handlebars with browserify causes IE to throw - TypeError: Invalid calling object

commit 090ee7c
Author: Tommy Messbauer <tommy@vast.com>
Date:   Thu May 9 17:17:34 2013 -0500

    added local pointer to handlerbars.utils to allow this to browserify properly for IE

commit 8a5705a
Author: MikeMayer <mike@mikemayer.me>
Date:   Wed May 1 09:58:17 2013 -0700

    Explicitly only include the handlebars.js from the dist folder

commit 344bb90
Author: MikeMayer <mike@mikemayer.me>
Date:   Wed May 1 09:52:55 2013 -0700

    Create handlebars.js.nuspec for inclusion in NuGet

    Added a .nuspec file for those people who use Visual Studio and NuGet and might want to use handlebars.js deployed from NuGet in their application.

commit fc52a65
Author: DevinClark <dclarkdesign@gmail.com>
Date:   Thu Apr 25 21:05:21 2013 -0500

    Changed component.json to bower.json per Bower 0.9.0 update.

commit 5c9aa9e
Author: DevinClark <dclarkdesign@gmail.com>
Date:   Mon Apr 8 12:28:13 2013 -0500

    Added a component.json file for Twitter's Bower package manager.

    See [https://github.com/twitter/bower#defining-a-package](Defining a
    package) for more information about how the file was generated.
c2c3808
@jamesgorrie

Could this be updated in NPM?

@kpdecker
Collaborator
@machty machty referenced this pull request in machty/emblem.js
Open

Need to support ID's in partial names #76

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 17, 2013
  1. @brwr
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 3 deletions.
  1. +1 −1  dist/handlebars.js
  2. +7 −0 spec/qunit_spec.js
  3. +2 −2 src/handlebars.l
View
2  dist/handlebars.js
@@ -644,7 +644,7 @@ case 33: return 5;
break;
}
};
-lexer.rules = [/^(?:\\\\(?=(\{\{)))/,/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\{\{>)/,/^(?:\{\{#)/,/^(?:\{\{\/)/,/^(?:\{\{\^)/,/^(?:\{\{\s*else\b)/,/^(?:\{\{\{)/,/^(?:\{\{&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{)/,/^(?:=)/,/^(?:\.(?=[}/ ]))/,/^(?:\.\.)/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}\}\})/,/^(?:\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@[a-zA-Z]+)/,/^(?:true(?=[}\s]))/,/^(?:false(?=[}\s]))/,/^(?:-?[0-9]+(?=[}\s]))/,/^(?:[a-zA-Z0-9_$:\-]+(?=[=}\s\/.]))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:\s+)/,/^(?:[a-zA-Z0-9_$\-\/]+)/,/^(?:$)/];
+lexer.rules = [/^(?:\\\\(?=(\{\{)))/,/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\{\{>)/,/^(?:\{\{#)/,/^(?:\{\{\/)/,/^(?:\{\{\^)/,/^(?:\{\{\s*else\b)/,/^(?:\{\{\{)/,/^(?:\{\{&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{)/,/^(?:=)/,/^(?:\.(?=[}/ ]))/,/^(?:\.\.)/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}\}\})/,/^(?:\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@[a-zA-Z]+)/,/^(?:true(?=[}\s]))/,/^(?:false(?=[}\s]))/,/^(?:-?[0-9]+(?=[}\s]))/,/^(?:[a-zA-Z0-9_$:\-]+(?=[=}\s\/.]))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:\s+)/,/^(?:[a-zA-Z0-9_$\-\/\.]+)/,/^(?:$)/];
lexer.conditions = {"mu":{"rules":[5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,33],"inclusive":false},"emu":{"rules":[3],"inclusive":false},"com":{"rules":[4],"inclusive":false},"par":{"rules":[31,32],"inclusive":false},"INITIAL":{"rules":[0,1,2,33],"inclusive":true}};
return lexer;})()
parser.lexer = lexer;
View
7 spec/qunit_spec.js
@@ -577,6 +577,13 @@ test("Partials with slash paths", function() {
shouldCompileToWithPartials(string, [hash, {}, {'shared/dude':dude}], true, "Dudes: Jeepers", "Partials can use literal paths");
});
+test("Partials with slash and point paths", function() {
+ var string = "Dudes: {{> shared/dude.thing}}";
+ var dude = "{{name}}";
+ var hash = {name:"Jeepers", another_dude:"Creepers"};
+ shouldCompileToWithPartials(string, [hash, {}, {'shared/dude.thing':dude}], true, "Dudes: Jeepers", "Partials can use literal with points in paths");
+});
+
test("Multiple partial registration", function() {
Handlebars.registerPartial({
'shared/dude': '{{name}}',
View
4 src/handlebars.l
@@ -44,11 +44,11 @@
<mu>"true"/[}\s] { return 'BOOLEAN'; }
<mu>"false"/[}\s] { return 'BOOLEAN'; }
<mu>\-?[0-9]+/[}\s] { return 'INTEGER'; }
-<mu>[a-zA-Z0-9_$:\-]+/[=}\s\/.] { return 'ID'; }
+<mu>[a-zA-Z0-9_$:\-]+/[=}\s\/.] { return 'ID'; }
<mu>'['[^\]]*']' { yytext = yytext.substr(1, yyleng-2); return 'ID'; }
<mu>. { return 'INVALID'; }
<par>\s+ { /*ignore whitespace*/ }
-<par>[a-zA-Z0-9_$\-\/]+ { this.popState(); return 'PARTIAL_NAME'; }
+<par>[a-zA-Z0-9_$\-\/\.]+ { this.popState(); return 'PARTIAL_NAME'; }
<INITIAL,mu><<EOF>> { return 'EOF'; }
Something went wrong with that request. Please try again.