Fix example indentation

This commit is contained in:
Tom MacWright 2015-04-08 16:45:21 -07:00
parent c0128f1055
commit ced80fbb16
3 changed files with 11 additions and 9 deletions

View File

@ -37,7 +37,7 @@
<div class='sm-col sm-col-9 md-col-10 flex flex-column'>
<div class='flex-auto full-width'>
{{#each docs}}
{{> section}}
{{> section}}
{{/each}}
</div>
</div>

View File

@ -53,15 +53,13 @@
{{#if examples}}
<h4>Examples</h4>
{{#each examples}}
<pre>{{{.}}}</pre>
{{/each}}
{{#each examples}}<pre>{{{.}}}</pre>{{/each}}
{{/if}}
{{#if members.instance}}
{{#each members.instance}}
<div class='section-indent'>
{{> section}}
{{> section}}
</div>
{{/each}}
{{/if}}
@ -69,7 +67,7 @@
{{#if members.static}}
{{#each members.static}}
<div class='section-indent'>
{{> section}}
{{> section}}
</div>
{{/each}}
{{/if}}

View File

@ -155,14 +155,18 @@ module.exports = function (opts) {
if (type.type === 'NameExpression') {
return html ? '<code>' + autolink(type.name) + '</code>' : type.name;
} else if (type.type === 'UnionType') {
return type.elements.map(formatType).join(' or ');
return type.elements.map(function (element) {
return formatType(element, html);
}).join(' or ');
} else if (type.type === 'AllLiteral') {
return 'Any';
} else if (type.type === 'OptionalType') {
return '<code>[' + formatType(type.expression) + ']</code>';
return '<code>[' + formatType(type.expression, html) + ']</code>';
} else if (type.type === 'TypeApplication') {
return formatType(type.expression) + '<' +
type.applications.map(formatType).join(', ') + '>';
type.applications.map(function (application) {
return formatType(application, html);
}).join(', ') + '>';
}
}