Skip to content
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

Replace inserts in wrappers #847

Merged
merged 3 commits into from
Nov 26, 2015
Merged

Replace inserts in wrappers #847

merged 3 commits into from
Nov 26, 2015

Conversation

simkall
Copy link
Contributor

@simkall simkall commented Nov 26, 2015

This pr should fix #748

Previously the sectionRefrence.replaceReferences function only replaced sg-includes in the markup variable of the given sections. Now includes are replaced in the 'sg-wrapper' variable as well.

This test input:

// List item
//
// markup:
// <li>Item</li>
//
// Styleguide 4.0.1
li {
  color: red;
}

// List footer
//
// markup:
// <div>
//   <p>hej</p>
// </div>
//
// sg-wrapper:
// <ul>
//   <li>hop</li>
//   <sg-insert>4.0.1</sg-insert>
// </ul>
// <sg-wrapper-content/>
//
// Styleguide 4.0.2

Without the fix the styles are rendered like this:
broken

When the contents in the sg-wrapper is replaced the same styles are rendered like this:
fixed

function reduceModifiers (previousValue, currentValue) {
return previousValue + currentValue[property].replace(modifierPlaceholder, currentValue.className);
}
while ((result = sectionContentVariable.exec(section[property]))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can it be one ( less from each side?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jsHint complains if the extra ( ) is missing

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yeah. Because it's expression inside.

varya added a commit that referenced this pull request Nov 26, 2015
@varya varya merged commit ce75cee into SC5:master Nov 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sg-insert doesn't work inside of sg-wrapper
2 participants