angular / dgeni-packages

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

fix(ngdoc/link filter): correctly handle missing title #315

Closed gkalpak closed 2 years ago

gkalpak commented 2 years ago

Previously, when the title argument passed to the link filter was undefined, it would be stringified and included in the returned @link annotation (for example, '{@link some/url undefined }'). This would result in the string 'undefined' being used as the link's text: <a href="some/url">undefined</a>.

This commit fixes the link filter behavior to omit the title when it is undefined. This results in @link annotations that do not include a "title" part (for example, {@link some/url }), which in turn allows the link text to be inferred based on the URL.

NOTE: This was accidentally broken in commit 32d3b9bcd by switching from lodash's _.template() (which treats undefined properties as empty strings) to a template literal (which stringifies undefined arguments).