-
Notifications
You must be signed in to change notification settings - Fork 407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PatternEngines ongoing work, round 4 #208
Merged
bmuenzenmeyer
merged 25 commits into
pattern-lab:pattern-engines
from
geoffp:pattern-engines
Dec 14, 2015
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
3dfe791
resolve issue with not hiding underscored patterns.
bmuenzenmeyer 4faa3fa
Fix wrong class name for Error Input
johngerome f6ff240
Merge pull request #200 from johngerome/master
ed4f8dd
- ADD: Added a note in the README during installation to run with ele…
bmuenzenmeyer cfedea6
Merge branch 'dev' of https://github.com/pattern-lab/patternlab-node …
bmuenzenmeyer 800f3b9
added two patternState unit tests as part of #97
bmuenzenmeyer 277fdff
delete this file, it's an artifact and should not be included
bmuenzenmeyer bb47678
Generate the list of supported pattern engines based on the presence to
geoffp a66d0a8
Made pseudopattern_hunter a bit less hardcoded
bmuenzenmeyer e4b73e8
further streamline engine loading process and logging
geoffp d80df26
clean up require()s
geoffp c7adf8a
slight polish to engine loader console output
geoffp 5cab80b
clean up eslintrc a bit
geoffp fe6206b
make process_pattern_iterative() return the oPattern to make it a little
geoffp 865b38d
Handlebars engine, plus unit tests and proposed pattern tree for
geoffp c741d18
I am now realizing that I called an atom from inside an atom. The
geoffp 5302a4d
oops, add molecules directory and pattern
geoffp 5c745c2
add Handlebars as an npm dependency (for now)
geoffp ddfd363
Support for pattern link.* shortcut inside pattern data objects.
bmuenzenmeyer 3f2efa9
Merge pull request #207 from pattern-lab/dev
6b22356
Merge remote-tracking branch 'upstream/master' into pattern-engines
geoffp 8ac9b6e
(mostly?) working handlebars rendering on a real tree -- there's a
geoffp 82c76ed
Fix the circular reference problem in the log file, which occurred when
geoffp 6693ee2
remove speculative alternate pattern data structures
geoffp a2c6c71
Add pattern-engines branch to .travis.yml
geoffp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
{ | ||
"env": { | ||
"jasmine": true, | ||
"node": true, | ||
"mocha": true, | ||
"browser": true, | ||
"builtin": true | ||
}, | ||
"globals": {}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,4 @@ branches: | |
only: | ||
- master | ||
- dev | ||
- pattern-engines |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* handlebars pattern engine for patternlab-node - v0.15.1 - 2015 | ||
* | ||
* Geoffrey Pursell, Brian Muenzenmeyer, and the web community. | ||
* Licensed under the MIT license. | ||
* | ||
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice. | ||
* | ||
*/ | ||
|
||
(function () { | ||
"use strict"; | ||
|
||
var Handlebars = require('handlebars'); | ||
|
||
var engine_handlebars = { | ||
engine: Handlebars, | ||
engineName: 'handlebars', | ||
engineFileExtension: '.hbs', | ||
|
||
// regexes, stored here so they're only compiled once | ||
// GTP warning: unchanged copypasta from mustache engine | ||
// findPartialsRE: /{{>\s*((?:\d+-[\w-]+\/)+(\d+-[\w-]+(\.\w+)?)|[A-Za-z0-9-]+)(\:[\w-]+)?(\(\s*\w+\s*:\s*(?:'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*")\))?\s*}}/g, | ||
findPartialsRE: /{{#?>\s*([\w-\/.]+)(?:.|\s+)*?}}/g, | ||
findPartialsWithStyleModifiersRE: /{{>([ ])?([\w\-\.\/~]+)(?!\()(\:[A-Za-z0-9-_|]+)+(?:(| )\(.*)?([ ])?}}/g, | ||
findPartialsWithPatternParametersRE: /{{>([ ])?([\w\-\.\/~]+)(?:\:[A-Za-z0-9-_|]+)?(?:(| )\(.*)+([ ])?}}/g, | ||
findListItemsRE: /({{#( )?)(list(I|i)tems.)(one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty)( )?}}/g, | ||
|
||
// render it | ||
renderPattern: function renderPattern(template, data, partials) { | ||
if (partials) { | ||
Handlebars.registerPartial(partials); | ||
} | ||
var compiled = Handlebars.compile(template); | ||
return compiled(data); | ||
}, | ||
|
||
registerPartial: function (oPattern) { | ||
Handlebars.registerPartial(oPattern.key, oPattern.template); | ||
}, | ||
|
||
// find and return any {{> template-name }} within pattern | ||
findPartials: function findPartials(pattern) { | ||
var matches = pattern.template.match(this.findPartialsRE); | ||
return matches; | ||
}, | ||
findPartialsWithStyleModifiers: function(pattern) { | ||
var matches = pattern.template.match(this.findPartialsWithStyleModifiersRE); | ||
return matches; | ||
}, | ||
// returns any patterns that match {{> value(foo:"bar") }} or {{> | ||
// value:mod(foo:"bar") }} within the pattern | ||
findPartialsWithPatternParameters: function(pattern) { | ||
var matches = pattern.template.match(this.findPartialsWithPatternParametersRE); | ||
return matches; | ||
}, | ||
findListItems: function(pattern) { | ||
var matches = pattern.template.match(this.findListItemsRE); | ||
return matches; | ||
}, | ||
// given a pattern, and a partial string, tease out the "pattern key" and | ||
// return it. | ||
getPartialKey: function(pattern, partialString) { | ||
var partialKey = partialString.replace(this.findPartialsRE, '$1'); | ||
return partialKey; | ||
} | ||
}; | ||
|
||
module.exports = engine_handlebars; | ||
})(); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a super great idea. 💯