angular / dgeni-packages

A collection of dgeni packages for generating documentation from source code.
MIT License
142 stars 106 forks source link

[typescript] idTemplate and pathTemplate still use `classDoc` property #254

Closed dherges closed 6 years ago

dherges commented 6 years ago

The idTemplate and pathTemplate in the typescript package still reference the classDoc property.

pathTemplate: '${classDoc.path}#${name}',

https://github.com/angular/dgeni-packages/blob/master/typescript/src/index.ts#L57

idTemplate: '${classDoc.id}.${name}',

https://github.com/angular/dgeni-packages/blob/master/typescript/src/api-doc-types/MemberDoc.ts#L44

This causes the lodash template to trigger a ReferenceError:

ReferenceError: classDoc is not defined
    at eval (lodash.templateSources[5]:9:10)
    at <..>/node_modules/dgeni-packages/base/processors/computePaths.js:56:26
    at Array.forEach (<anonymous>)
    at Object.$process (<..>/node_modules/dgeni-packages/base/processors/computePaths.js:47:12)

Should the template be changed to reference containerDoc instead?

https://github.com/angular/dgeni-packages/blob/master/typescript/src/api-doc-types/MemberDoc.ts#L44


edit and the property docs should reference container ?

pathTemplate: '${callableDoc.path}#${name}',

https://github.com/angular/dgeni-packages/blob/master/typescript/src/index.ts#L65

https://github.com/angular/dgeni-packages/blob/master/typescript/src/api-doc-types/ParameterDoc.ts#L23

petebacondarwin commented 6 years ago

Thanks for spotting this @dherges - it wasn't causing problems in angular.io because we filter such docs before the path and id processor runs.

Do you want to put together a PR?

dherges commented 6 years ago

Hi @petebacondarwin,

yes, the PR is about to come :smile:

I can also confirm that by overriding the templates the error goes away. So it's just these defaults.

Also, a big thanks for all the time and effort! In particular, the typescript packages, the TsParser and re-writing it in TypeScript! The big bunch of features on top of the typescript APIs is fantastic! :bowing_man: :church: