Skip to content

Commit 52e77bf

Browse files
Merge pull request #679 from pattern-lab/dev
Pattern Lab Node 2.10.0
2 parents 3f7093c + e8f2e8a commit 52e77bf

File tree

8 files changed

+106
-11
lines changed

8 files changed

+106
-11
lines changed

CODE_OF_CONDUCT.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
## Our Standards
8+
9+
Examples of behavior that contributes to creating a positive environment include:
10+
11+
* Using welcoming and inclusive language
12+
* Being respectful of differing viewpoints and experiences
13+
* Gracefully accepting constructive criticism
14+
* Focusing on what is best for the community
15+
* Showing empathy towards other community members
16+
17+
Examples of unacceptable behavior by participants include:
18+
19+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
20+
* Trolling, insulting/derogatory comments, and personal or political attacks
21+
* Public or private harassment
22+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
23+
* Other conduct which could reasonably be considered inappropriate in a professional setting
24+
25+
## Our Responsibilities
26+
27+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28+
29+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30+
31+
## Scope
32+
33+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34+
35+
## Enforcement
36+
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38+
39+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40+
41+
## Attribution
42+
43+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44+
45+
[homepage]: http://contributor-covenant.org
46+
[version]: http://contributor-covenant.org/version/1/4/

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ Pattern Lab Node wouldn't be what it is today without the support of the communi
1515
**:100: Thanks for support from the following:**
1616

1717
* **[Brad Frost](http://bradfrost.com/)**
18-
* Marcos Peebles
18+
* [Marcos Peebles](https://twitter.com/marcospeebles)
19+
* [Susan Simkins](https://twitter.com/susanmsimkins)
1920

2021
## Installation
2122

core/lib/pattern_assembler.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ var pattern_assembler = function () {
166166
currentPattern.patternDescExists = true;
167167
currentPattern.patternDesc = markdownObject.markdown;
168168

169+
//Add all markdown to the currentPattern, including frontmatter
170+
currentPattern.allMarkdown = markdownObject;
171+
169172
//consider looping through all keys eventually. would need to blacklist some properties and whitelist others
170173
if (markdownObject.state) {
171174
currentPattern.patternState = markdownObject.state;
@@ -182,6 +185,9 @@ var pattern_assembler = function () {
182185
if (markdownObject.tags) {
183186
currentPattern.tags = markdownObject.tags;
184187
}
188+
if (markdownObject.title) {
189+
currentPattern.patternName = markdownObject.title;
190+
}
185191
if (markdownObject.links) {
186192
currentPattern.links = markdownObject.links;
187193
}

core/lib/patternlab.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* patternlab-node - v2.9.3 - 2017
2+
* patternlab-node - v2.10.0 - 2017
33
*
44
* Brian Muenzenmeyer, Geoff Pursell, Raphael Okon, tburny and the web community.
55
* Licensed under the MIT license.
@@ -388,6 +388,13 @@ var patternlab_engine = function (config) {
388388

389389
// stringify this data for individual pattern rendering and use on the styleguide
390390
// see if patternData really needs these other duped values
391+
392+
// construct our extraOutput dump
393+
var extraOutput = Object.assign({}, pattern.extraOutput, pattern.allMarkdown);
394+
delete(extraOutput.title);
395+
delete(extraOutput.state);
396+
delete(extraOutput.markdown);
397+
391398
pattern.patternData = JSON.stringify({
392399
cssEnabled: false,
393400
patternLineageExists: pattern.patternLineageExists,
@@ -410,7 +417,7 @@ var patternlab_engine = function (config) {
410417
patternPartial: pattern.patternPartial,
411418
patternState: pattern.patternState,
412419
patternEngineName: pattern.engine.engineName,
413-
extraOutput: {}
420+
extraOutput: extraOutput
414421
});
415422

416423
//set the pattern-specific footer by compiling the general-footer with data, and then adding it to the meta footer

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "patternlab-node",
33
"description": "Pattern Lab is a collection of tools to help you create atomic design systems. This is the node command line interface (CLI).",
4-
"version": "2.9.3",
4+
"version": "2.10.0",
55
"main": "./core/lib/patternlab.js",
66
"dependencies": {
77
"chalk": "^1.1.3",

test/files/_patterns/00-test/01-bar.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
22
status: complete
3+
title: An Atom Walks Into a Bar
4+
joke: bad
35
---
46
## A Simple Bit of Markup
57

test/parameter_hunter_tests.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ var CompileState = require('../core/lib/object_factory').CompileState;
77
var PatternGraph = require('../core/lib/pattern_graph').PatternGraph;
88

99
var fs = require('fs-extra');
10+
var util = require('./util/test_utils.js');
1011

1112
var ph = require('../core/lib/parameter_hunter');
1213

@@ -112,16 +113,12 @@ tap.test('parameter hunter finds partials with their own parameters and renders
112113
parameter_hunter.find_parameters(currentPattern, pl);
113114

114115
//assert
115-
test.equals(currentPattern.extendedTemplate,
116-
`<b>c</b>
116+
test.equals(util.sanitized(currentPattern.extendedTemplate),
117+
util.sanitized(`<b>c</b>
117118
<b>b</b>
118119
<i>b!</i>
119120
<b>a</b>
120-
<i>a!</i>
121-
122-
123-
`);
124-
121+
<i>a!</i>`));
125122
test.end();
126123
});
127124

test/pattern_assembler_tests.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,3 +768,39 @@ tap.test('hidden patterns can be called by their nice names', function(test){
768768
test.equals(util.sanitized(testPattern.render()), util.sanitized('Hello there! Here\'s the hidden atom: [This is the hidden atom]'), 'hidden pattern rendered output not as expected');
769769
test.end();
770770
});
771+
772+
tap.test('parses pattern title correctly when frontmatter present', function(test){
773+
var util = require('./util/test_utils.js');
774+
775+
//arrange
776+
var testPatternsPath = path.resolve(__dirname, 'files', '_patterns');
777+
var pl = util.fakePatternLab(testPatternsPath);
778+
var pattern_assembler = new pa();
779+
780+
//act
781+
var testPatternPath = path.join('00-test', '01-bar.mustache');
782+
var testPattern = pattern_assembler.process_pattern_iterative(testPatternPath, pl);
783+
pattern_assembler.process_pattern_recursive(testPatternPath, pl);
784+
785+
//assert
786+
test.equals(testPattern.patternName, 'An Atom Walks Into a Bar','patternName not overridden');
787+
test.end();
788+
});
789+
790+
tap.test('parses pattern extra frontmatter correctly when frontmatter present', function(test){
791+
var util = require('./util/test_utils.js');
792+
793+
//arrange
794+
var testPatternsPath = path.resolve(__dirname, 'files', '_patterns');
795+
var pl = util.fakePatternLab(testPatternsPath);
796+
var pattern_assembler = new pa();
797+
798+
//act
799+
var testPatternPath = path.join('00-test', '01-bar.mustache');
800+
var testPattern = pattern_assembler.process_pattern_iterative(testPatternPath, pl);
801+
pattern_assembler.process_pattern_recursive(testPatternPath, pl);
802+
803+
//assert
804+
test.equals(testPattern.allMarkdown.joke, 'bad','extra key not added');
805+
test.end();
806+
});

0 commit comments

Comments
 (0)