Skip to content

Commit

Permalink
Merge pull request #679 from pattern-lab/dev
Browse files Browse the repository at this point in the history
Pattern Lab Node 2.10.0
  • Loading branch information
bmuenzenmeyer authored Sep 1, 2017
2 parents 3f7093c + e8f2e8a commit 52e77bf
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 11 deletions.
46 changes: 46 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct

## Our Pledge

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.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

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.

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.

## Scope

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.

## Enforcement

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.

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.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ Pattern Lab Node wouldn't be what it is today without the support of the communi
**:100: Thanks for support from the following:**

* **[Brad Frost](http://bradfrost.com/)**
* Marcos Peebles
* [Marcos Peebles](https://twitter.com/marcospeebles)
* [Susan Simkins](https://twitter.com/susanmsimkins)

## Installation

Expand Down
6 changes: 6 additions & 0 deletions core/lib/pattern_assembler.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ var pattern_assembler = function () {
currentPattern.patternDescExists = true;
currentPattern.patternDesc = markdownObject.markdown;

//Add all markdown to the currentPattern, including frontmatter
currentPattern.allMarkdown = markdownObject;

//consider looping through all keys eventually. would need to blacklist some properties and whitelist others
if (markdownObject.state) {
currentPattern.patternState = markdownObject.state;
Expand All @@ -182,6 +185,9 @@ var pattern_assembler = function () {
if (markdownObject.tags) {
currentPattern.tags = markdownObject.tags;
}
if (markdownObject.title) {
currentPattern.patternName = markdownObject.title;
}
if (markdownObject.links) {
currentPattern.links = markdownObject.links;
}
Expand Down
11 changes: 9 additions & 2 deletions core/lib/patternlab.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* patternlab-node - v2.9.3 - 2017
* patternlab-node - v2.10.0 - 2017
*
* Brian Muenzenmeyer, Geoff Pursell, Raphael Okon, tburny and the web community.
* Licensed under the MIT license.
Expand Down Expand Up @@ -388,6 +388,13 @@ var patternlab_engine = function (config) {

// stringify this data for individual pattern rendering and use on the styleguide
// see if patternData really needs these other duped values

// construct our extraOutput dump
var extraOutput = Object.assign({}, pattern.extraOutput, pattern.allMarkdown);
delete(extraOutput.title);
delete(extraOutput.state);
delete(extraOutput.markdown);

pattern.patternData = JSON.stringify({
cssEnabled: false,
patternLineageExists: pattern.patternLineageExists,
Expand All @@ -410,7 +417,7 @@ var patternlab_engine = function (config) {
patternPartial: pattern.patternPartial,
patternState: pattern.patternState,
patternEngineName: pattern.engine.engineName,
extraOutput: {}
extraOutput: extraOutput
});

//set the pattern-specific footer by compiling the general-footer with data, and then adding it to the meta footer
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "patternlab-node",
"description": "Pattern Lab is a collection of tools to help you create atomic design systems. This is the node command line interface (CLI).",
"version": "2.9.3",
"version": "2.10.0",
"main": "./core/lib/patternlab.js",
"dependencies": {
"chalk": "^1.1.3",
Expand Down
2 changes: 2 additions & 0 deletions test/files/_patterns/00-test/01-bar.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
status: complete
title: An Atom Walks Into a Bar
joke: bad
---
## A Simple Bit of Markup

Expand Down
11 changes: 4 additions & 7 deletions test/parameter_hunter_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var CompileState = require('../core/lib/object_factory').CompileState;
var PatternGraph = require('../core/lib/pattern_graph').PatternGraph;

var fs = require('fs-extra');
var util = require('./util/test_utils.js');

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

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

//assert
test.equals(currentPattern.extendedTemplate,
`<b>c</b>
test.equals(util.sanitized(currentPattern.extendedTemplate),
util.sanitized(`<b>c</b>
<b>b</b>
<i>b!</i>
<b>a</b>
<i>a!</i>
`);

<i>a!</i>`));
test.end();
});

Expand Down
36 changes: 36 additions & 0 deletions test/pattern_assembler_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -768,3 +768,39 @@ tap.test('hidden patterns can be called by their nice names', function(test){
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');
test.end();
});

tap.test('parses pattern title correctly when frontmatter present', function(test){
var util = require('./util/test_utils.js');

//arrange
var testPatternsPath = path.resolve(__dirname, 'files', '_patterns');
var pl = util.fakePatternLab(testPatternsPath);
var pattern_assembler = new pa();

//act
var testPatternPath = path.join('00-test', '01-bar.mustache');
var testPattern = pattern_assembler.process_pattern_iterative(testPatternPath, pl);
pattern_assembler.process_pattern_recursive(testPatternPath, pl);

//assert
test.equals(testPattern.patternName, 'An Atom Walks Into a Bar','patternName not overridden');
test.end();
});

tap.test('parses pattern extra frontmatter correctly when frontmatter present', function(test){
var util = require('./util/test_utils.js');

//arrange
var testPatternsPath = path.resolve(__dirname, 'files', '_patterns');
var pl = util.fakePatternLab(testPatternsPath);
var pattern_assembler = new pa();

//act
var testPatternPath = path.join('00-test', '01-bar.mustache');
var testPattern = pattern_assembler.process_pattern_iterative(testPatternPath, pl);
pattern_assembler.process_pattern_recursive(testPatternPath, pl);

//assert
test.equals(testPattern.allMarkdown.joke, 'bad','extra key not added');
test.end();
});

0 comments on commit 52e77bf

Please sign in to comment.