mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-19 08:32:52 +08:00
chore(docs): parse optional
This commit is contained in:
parent
072fe8df94
commit
87916aec20
@ -16,11 +16,12 @@ module.exports = function(currentVersion) {
|
||||
return new Package('ionic-v2-docs', [jsdocPackage, nunjucksPackage, typescriptPackage, linksPackage])
|
||||
|
||||
// .processor(require('./processors/latest-version'))
|
||||
.processor(require('./processors/jekyll'))
|
||||
.processor(require('./processors/remove-private-members'))
|
||||
.processor(require('./processors/hide-private-api'))
|
||||
.processor(require('./processors/collect-inputs-outputs'))
|
||||
.processor(require('./processors/npm-id'))
|
||||
.processor(require('./processors/jekyll'))
|
||||
.processor(require('./processors/remove-private-members'))
|
||||
.processor(require('./processors/hide-private-api'))
|
||||
.processor(require('./processors/collect-inputs-outputs'))
|
||||
.processor(require('./processors/npm-id'))
|
||||
.processor(require('./processors/parse-optional'))
|
||||
|
||||
// for debugging docs
|
||||
// .processor(function test(){
|
||||
|
21
scripts/docs/processors/parse-optional.js
Normal file
21
scripts/docs/processors/parse-optional.js
Normal file
@ -0,0 +1,21 @@
|
||||
module.exports = function parseOptional() {
|
||||
return {
|
||||
$runBefore: ['rendering-docs'],
|
||||
$process: function(docs) {
|
||||
docs.forEach(function(doc) {
|
||||
if(doc.members && doc.members.length) {
|
||||
for (var i in doc.members) {
|
||||
if(doc.members[i].params && doc.members[i].params.length) {
|
||||
for (var ii in doc.members[i].params) {
|
||||
if(doc.members[i].params[ii].optional){
|
||||
doc.members[i].params[ii].description += '<strong class="tag">Optional</strong>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return docs;
|
||||
}
|
||||
}
|
||||
};
|
3
scripts/docs/templates/common.template.html
vendored
3
scripts/docs/templates/common.template.html
vendored
@ -33,7 +33,7 @@ docType: "<$ doc.docType $>"
|
||||
</td>
|
||||
<td>
|
||||
<$ param.description | marked $>
|
||||
<@ if param.optional @><strong class="tag">Optional</strong><@ endif @>
|
||||
<@ if param.optional @><em>(optional)</em><@ endif @>
|
||||
</td>
|
||||
</tr>
|
||||
<@ endfor @>
|
||||
@ -77,7 +77,6 @@ docType: "<$ doc.docType $>"
|
||||
</td>
|
||||
<td>
|
||||
<$ param.description | marked $>
|
||||
<@ if param.optional @><strong class="tag">Optional</strong><@ endif @>
|
||||
<@ if param.defaultValue @><p><em>(default: <$ param.defaultValue $>)</em></p><@ endif @>
|
||||
</td>
|
||||
</tr>
|
||||
|
Loading…
Reference in New Issue
Block a user