Skip to content

Comments

Issue 8794 - Add DDOC_ANCHOR macro for qualified anchor links#1174

Merged
WalterBright merged 5 commits intodlang:masterfrom
ntrel:ddoc-anchor
Oct 22, 2012
Merged

Issue 8794 - Add DDOC_ANCHOR macro for qualified anchor links#1174
WalterBright merged 5 commits intodlang:masterfrom
ntrel:ddoc-anchor

Conversation

@ntrel
Copy link
Contributor

@ntrel ntrel commented Oct 10, 2012

http://d.puremagic.com/issues/show_bug.cgi?id=8794

Currently there is no way to generate qualified anchor links in DDoc output - i.e. <a name="MyClass.myMember"></a> rather than just myMember.

This pull request adds a new DDoc macro, DDOC_ANCHOR, which is expanded wherever a symbol declaration appears in the documentation. The qualified symbol name is passed as argument $1. This is in contrast to DDOC_PSYMBOL, which only passes the current identifier without any context, and does so wherever the symbol name occurs in the document output, including text descriptions.

@ntrel ntrel mentioned this pull request Oct 10, 2012
@yebblies
Copy link
Contributor

The ddoc tests will need to be updated.

@andralex
Copy link
Member

As @yebblies said, after fixing those this diff LGTM.

@ntrel
Copy link
Contributor Author

ntrel commented Oct 11, 2012

Thanks for the comments. I've just now got the ddoc tests up & running on my system, so I will commit the *.html changes in the next few days.

@jpf91
Copy link
Contributor

jpf91 commented Oct 11, 2012

We just want the identifier, not overloads like TemplateDeclaration::toChars.
We don't want the template parameter list and constraints.

How does this work for function overloads? Will all overloads get the same anchor? We have to decide whether this is OK or whether we want unique anchors for all symbols (which probably means we'd have to use the mangled names as anchors)

@ntrel
Copy link
Contributor Author

ntrel commented Oct 12, 2012

@jpf91: All overloads get the same anchor. I quite like being able to easily guess the anchor name to use for links, which is harder to do when using the mangled name. I can see how using the mangled name neatly solves the overload problem though. If we merge this PR, we could still add the mangled name as argument $2 to the DDOC_ANCHOR macro. I expect even when using the mangled name for anchors, this pull's qualified name would still be useful as jump-to link text - maybe embedded somehow like <a name="__mangledname" id="qualified.name"></a>.

ntrel added 4 commits October 12, 2012 16:38
This prevents repetition, using anchor names like TemplateClass
instead of TemplateClass.TemplateClass, which is important for the
Jump-to link section.
@ntrel
Copy link
Contributor Author

ntrel commented Oct 16, 2012

After fixing some issues, I've now committed the ddoc test changes. Note that I've only run the ddoc tests, not all compilable tests as I've had some trouble with the test suite - but hopefully the ddoc tests are the only ones really needed here.

Test Results

Unfortunately I have found that template symbols that are themselves members of a template get null for their Dsymbol::parent field, at least at the stage that ddoc sees them. I'm not sure if that needs fixing before merging this pull, as it means such templates won't get a qualified anchor, and they occur quite frequently in Phobos.

WalterBright added a commit that referenced this pull request Oct 22, 2012
Issue 8794 - Add DDOC_ANCHOR macro for qualified anchor links
@WalterBright WalterBright merged commit 563195f into dlang:master Oct 22, 2012
WalterBright added a commit that referenced this pull request Oct 22, 2012
denis-sh added a commit to denis-sh/bootDoc that referenced this pull request Nov 4, 2012
dlang/dmd#1174 pull adds `DDOC_ANCHOR` macro for qualified anchor links which we don't need because it's buggy (e.g. it doesn't support templates members).

So we have to disable it for now and wait until it is fixed.
denis-sh added a commit to denis-sh/dlang.org that referenced this pull request Nov 4, 2012
denis-sh added a commit to denis-sh/dmd that referenced this pull request Nov 4, 2012
JakobOvrum pushed a commit to JakobOvrum/bootDoc that referenced this pull request Nov 4, 2012
alexrp pushed a commit to dlang/dlang.org that referenced this pull request Nov 4, 2012
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.

5 participants