Fix white space in generated API docs

This commit is contained in:
David Rowe 2019-09-20 08:09:51 +12:00
parent dff37a71eb
commit 78b7c04457
9 changed files with 49 additions and 28 deletions

View file

@ -143,6 +143,14 @@ td {
border: solid #c7cccb 1px;
}
td > p:first-child, td > ul:first-child {
margin-top: 0;
}
td > p:last-child, td > ul:last-child {
margin-bottom: 0;
}
article table thead tr th, article table tbody tr td, article table tbody tr td p {
font-size: .89rem;
line-height: 20px;
@ -596,11 +604,6 @@ header {
font-size: 100%;
}
.params td.description > p:first-child, .props td.description > p:first-child {
margin-top: 0;
padding-top: 0;
}
span.param-type, .params td .param-type, .param-type dd {
color: #606;
font-family: Consolas, Monaco, 'Andale Mono', monospace

View file

@ -0,0 +1,15 @@
<?js
var description = obj;
var self = this;
var descriptionRegExp = new RegExp('<(p|ul|div|table)[^>]*>', 'i');
var descriptionIndex = description.search(descriptionRegExp);
?>
<?js if (descriptionIndex === -1) { ?>
<p><?js= description ?></p>
<?js } else if (descriptionIndex !== 0) { ?>
<p><?js= description.slice(0, descriptionIndex) ?></p>
<?js= description.slice(descriptionIndex) ?>
<?js } else { ?>
<?js= description ?>
<?js } ?>

View file

@ -16,7 +16,7 @@ var self = this;
<tr>
<td>
<?js if (data.description) { ?>
<div><?js= data.description ?></div>
<?js= self.partial('description.tmpl', data.description) ?>
<?js } else { ?>
<p style="color:red;">&nbsp;</p>
<?js } ?>

View file

@ -25,10 +25,10 @@ var self = this;
<tr>
<td>
<?js if (data.kind !== 'module' && !data.hideconstructor) { ?>
<div>
<?js= data.description ?>
<?js= this.partial('details.tmpl', data) ?>
</div>
<?js if (data.description) { ?>
<?js= self.partial('description.tmpl', data.description) ?>
<?js } ?>
<?js= this.partial('details.tmpl', data) ?>
<?js } else { ?>
<p style="color:red;">&nbsp;</p>
<?js } ?>

View file

@ -29,11 +29,9 @@ var self = this;
</td>
<td>
<?js if (data.description) { ?>
<?js= description ?>
<?js= this.partial('details.tmpl', data) ?>
<?js } else { ?>
<?js= this.partial('details.tmpl', data) ?>
<?js= this.partial('description.tmpl', data.description) ?>
<?js } ?>
<?js= this.partial('details.tmpl', data) ?>
</td>
</tr>
<?js } ?>

View file

@ -120,10 +120,15 @@
</td>
<?js } ?>
<td class="description last"><?js= param.description ?><?js if (param.subparams) { ?>
<h6>Properties</h6>
<?js= self.partial('params.tmpl', param.subparams) ?>
<?js } ?></td>
<td class="description last">
<?js if (param.description) { ?>
<?js= self.partial('description.tmpl', param.description) ?>
<?js } ?>
<?js if (param.subparams) { ?>
<h6>Properties</h6>
<?js= self.partial('params.tmpl', param.subparams) ?>
<?js } ?>
</td>
</tr>
<?js }); ?>

View file

@ -87,7 +87,9 @@
<?js } ?>
<td class="description last">
<?js= prop.description ?>
<?js if (prop.description) { ?>
<?js= self.partial('description.tmpl', prop.description) ?>
<?js } ?>
<?js if (props.hasDefault) {?>
<?js if (typeof prop.defaultvalue !== 'undefined') { ?>
<p><b>Default Value:</b> <?js= self.htmlsafe(prop.defaultvalue) ?> </p>

View file

@ -25,10 +25,10 @@ var self = this;
<tr>
<td>
<?js if (data.kind !== 'module' && !data.hideconstructor) { ?>
<div>
<?js= data.description ?>
<?js= this.partial('details.tmpl', data) ?>
</div>
<?js if (data.description) { ?>
<?js= self.partial('description.tmpl', data.description) ?>
<?js } ?>
<?js= this.partial('details.tmpl', data) ?>
<?js } else { ?>
<p style="color:red;">&nbsp;</p>
<?js } ?>

View file

@ -13,12 +13,10 @@ var self = this;
<code><?js= (kind === 'class' ? 'new ' : '') + name + (data.signatureHead || '') ?></code></a>
</td>
<td>
<?js if (data.description) { ?>
<?js= description ?>
<?js= this.partial('details.tmpl', data) ?>
<?js } else { ?>
<?js if (data.description) { ?>
<?js= this.partial('description.tmpl', description) ?>
<?js } ?>
<?js= this.partial('details.tmpl', data) ?>
<?js } ?>
</td>
</tr>
<?js } ?>