Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

Rewriting annotation links #237

Open
mhevery opened this issue Jul 5, 2015 · 1 comment
Open

Rewriting annotation links #237

mhevery opened this issue Jul 5, 2015 · 1 comment

Comments

@mhevery
Copy link

mhevery commented Jul 5, 2015

In Angular documentation we often write: See {@link Component}
Which generates a link to: <a href='/angular2/angular2.api/Component'><code>Component</code>. But this is not quite right. It should generate a link to <a href='/angular2/angular2.api/ComponentAnnotation'><code>Component</code>. No we could just change the source to say See {@link ComponentAnnotation} but that would break the Dart documentation, since Dart does not have decorators only components.

Two solutions:

  1. Have a list of annotations which the dgeni would automatically append Annotation too. So ``See {@link Component}becomes: Component`
  2. Have the source always say Annotation suffix and then have dgeni auto remove it in Dart and in the link. So See {@link ComponentAnnotation} becomes: <a href='/angular2/angular2.api/ComponentAnnotation'><code>Component</code> (note that we want to keep the text as Component in both cases)

Solution no. 1: (Preffered)

Algorithm

  1. Detect if a symbol is in a set of annotations: Component, View, Directive, Query, Attribute, Injectable
  2. If it is annotation, then generate URL to: <a href='/angular2/angular2.api/FooAnnotation'><code>Foo</code>

Solution no. 2 is simpler to implement, but requires both ts2dart and dgeni collaboration, so I don't think we should do it.

Algorithm

  1. Docs always say: {@link FooAnnotation}
  2. Dgeni generates: <a href='/angular2/angular2.api/FooAnnotation'><code>Foo</code> where
  3. it always strips out Annotation suffix in the title.
  4. strips out Annotation suffix in the URL only for Dart generation
@petebacondarwin
Copy link

Docs in dgeni can have aliases that are used in link matching. I think it will be enough to add the name stripped of the Annotation postfix as alias for ea check of those.

E.g.

id: 'ComponentAnnotation',
aliases: ['ComponentAnnotation', 'Component']

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants