Skip to content

Fix ReferenceError in default theme #576

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

Merged
merged 1 commit into from
Oct 26, 2016
Merged

Fix ReferenceError in default theme #576

merged 1 commit into from
Oct 26, 2016

Conversation

chadxz
Copy link
Contributor

@chadxz chadxz commented Oct 22, 2016

There does not seem to be any test suite for the theme. This fixes an uncaught exception when you are using the html output with the default theme and your code has nested attributes.

i.e.

$ documentation build -f html -o docs
lodash.templateSources[1]:136
__e( name) +
     ^

ReferenceError: name is not defined
    at eval (lodash.templateSources[1]:136:6)
    at Array.forEach (native)
    at eval (lodash.templateSources[1]:134:22)
    at Array.forEach (native)
    at eval (lodash.templateSources[1]:113:21)
    at eval (lodash.templateSources[3]:84:11)
    at Array.forEach (native)
    at eval (lodash.templateSources[3]:80:7)
    at /Users/cmcelligott/.nvm/versions/node/v6.9.1/lib/node_modules/documentation/default_theme/index.js:86:30
    at ConcatStream.<anonymous> (/Users/cmcelligott/.nvm/versions/node/v6.9.1/lib/node_modules/documentation/node_modules/concat-stream/index.js:36:43)

Closes #559.

@tmcw
Copy link
Member

tmcw commented Oct 24, 2016

The theme is tested by the nested.input.js fixture - https://github.com/documentationjs/documentation/blob/master/test/fixture/html/nested.input.js and the html test - could you add a nested attribute to that fixture to replicate this error and use UPDATE=true npm test to update the fixture? Thanks!

@chadxz
Copy link
Contributor Author

chadxz commented Oct 26, 2016

looking into this now

@chadxz
Copy link
Contributor Author

chadxz commented Oct 26, 2016

OK I added an example to nested.input.js. The default template only supports one level of nesting, and this patch fixes that so it doesn't throw the ReferenceError. The example in #559 shows two levels of nesting- the default template doesn't support rendering that, but will not throw a ReferenceError either. So I think it'd be fine to still close that ticket.

@tmcw
Copy link
Member

tmcw commented Oct 26, 2016

👍 Thanks! In the spirit of our contributing policy, I've invited you as a collaborator so you can push & merge branches without my approval, if you'd like to!

@tmcw tmcw merged commit 7c7d56c into documentationjs:master Oct 26, 2016
@chadxz chadxz deleted the fix-reference-error-default-theme branch October 26, 2016 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nested Properties throw lodash errors.
2 participants