-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow apidocs
helper to accept an array
#1
Comments
I think it's because of async helpers. might need @doowb to input on this |
I thought I responded to this last night... Using the native javascript You can pass values from a helper into another helper and the results will be resolved correctly, so you can do something like: register a custom // template-helpers has this, but I think it's implemented differently and may need to be updated
// or a new helper added that does this
app.helper('_if', function(condition, a, b) {
return condition ? a : b;
}); use it with the ## API
Review carefully the provided examples and the working [tests](./test.js).
{%= apidocs(_if(exists('src/index.js'), 'src/index.js', 'index.js')) %} |
Right. Thanks for the suggestion! :) But still.. i don't want one more new file (verbfile.js) for such easy thing - first; second, it still will output the section header ( |
yeah I agree, I think we can figure out a fix for this. |
Yea, one probably cool thing that I thought for, is that to allow access Ramda or Lodash (or why not both) through the templates, hm? :) |
Hi! I'm just trying to create a condition. If
src/index.js
exists call apidocs for it and then if not exists check ifindex.js
on root exists and call apidocs.I tried
ifExists
helper, but it not worked as expected. Even always returns (somehow) truthy value. I expect (as read the code too) to return empty string if file not exist.So the snippet in that if shouldn't be rendered, but it is.
Even with
.length
(which is surely falsey value, negative) it still renders the block that is inside theif
.But even if it worked, it still be better if apidocs support such feature by default. What i imagine
So when
src/index.js
not exist, it will continue to the next one until it find existing file.Also tried with
require
helper to require thefs
and callexistsSync
but it throws that it's not a functionThe text was updated successfully, but these errors were encountered: