Apidoc special comment closing symbols.
minn-mann opened this issue · 1 comments
Hi,
I've a problem and trust some of you can help me solve. I need to mix code and documentation in order to make my life easier. I'll explain further if needed but in few words what I need is something like php does when you mix it with html.
/**
* @api {js} users Schema
* @apiName Schema
* @apiGroup User
* @apiExample {js} Entity schema:
<*/ // "fake" bracket closing. if I use the <*/ closing apidoc continues reading as if I haven't closed the comment
{
[json pseuschema]
}
/* */ // real apidoc "segment" closingThe effect should be that the uncommented section is still considered part of the apidoc even if it is not comment, so I can include my schema without copy pasting. There might be some straightforward ways to do so, but I've found none.
What I've done though has been to overwrite the default language (I use Javascript) with the parameter --parse-languages default=custom.js, defining new regular expression. I have failed to come up with regular expression that might work in my case. My current custom.js file looks like this:
module.exports = {
// here i try to do not match */ if preceded by <
docBlocksRegExp: /\/\*\*\uffff?(.+?)\uffff?(?:\s*)?(\*\/)(?!<)/g,
// remove not needed ' * ', '<*/', '/*' (for reopening comment sections) and tabs at the beginning. I don't know if it works
inlineRegExp: /^(\s*)?(\*|(\/\*>))[ ]?/gm
}Has any of you had my same need? What solution did you came up with? Do you have some suggestion for my regex (I'm very bad at it)?
Runs fine now with:
@apiExample {js} Entity schema:
{
"json": true
}