Skip to content

Commit ad6f71c

Browse files
committed
Merge pull request #86 from anttisalo/sectionMarkupFix
Fixed section.markup: false
2 parents 8d41fa4 + 9717dfb commit ad6f71c

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

lib/app/views/partials/section.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ <h4 class="sg name">{{ mod.name | decodeHtml }}</h4>
2929
ng-if="!section.modifiers.length && section.markup"
3030
ng-bind-html="section.markup | setVariables: config.settings | unsafe" dynamic-compile>
3131
</div>
32-
<div ng-if="section.markup && section.markup != 'false'">
32+
<div ng-if="section.markup">
3333
<pre class="sg" ng-show="section.showMarkup">
3434
<span class="toggle hide-markup" ng-show="section.showMarkup" ng-click="hideSingleMarkupBox($index)">Hide markup</span>
3535
<code hljs source="section.markup" class="html"></code>

lib/styleguide.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ function jsonSections(sections) {
243243
deprecated: section.deprecated(),
244244
experimental: section.experimental(),
245245
reference: section.reference(),
246-
markup: section.markup().toString()
246+
markup: section.markup() ? section.markup().toString() : null
247247
}
248248
});
249249
}
@@ -255,7 +255,7 @@ function jsonModifiers(modifiers) {
255255
name: modifier.name(),
256256
description: sanitize(modifier.description()),
257257
className: modifier.className(),
258-
markup: modifier.markup().toString()
258+
markup: modifier.markup() ? modifier.markup().toString() : null
259259
}
260260
});
261261
}

test/structure.js

+8
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,12 @@ describe('styleguide.json', function() {
157157
it('should not reveal outputPath', function() {
158158
should.not.exist(jsonData.config.outputPath);
159159
});
160+
161+
it('should print markup if defined', function() {
162+
jsonData.sections[1].markup.should.not.be.empty;
163+
});
164+
165+
it('should not print empty markup', function() {
166+
should.not.exist(jsonData.sections[2].markup);
167+
});
160168
});

0 commit comments

Comments
 (0)