Improve anchors for ddoc (dlang.org)
Jacob Carlborg
doob at me.com
Sun Feb 19 08:55:52 PST 2012
On 2012-02-19 01:20, Adam D. Ruppe wrote:
> On Saturday, 18 February 2012 at 23:45:30 UTC, Jacob Carlborg wrote:
>> The compiler should try to provide as much information as possible
>> (that makes sense), anchors, cross-referencing, inheritance hierarchy,
>> and so on.
>
> Simple patch here:
> https://github.com/adamdruppe/dmd/commit/654d39fe17397e0a80c95ce500f09ae49130bf2d
>
>
> A problem with dmd is it always calls that macro, even
> if you just referenced the name in the description.
>
> So, the anchors will be repeated.... but they are right now too!
>
> Nevertheless, these little changes at least let the anchors
> be *correct*, provided that we fix the macros to use $2 instead
> of $0 with them.
>
>
> Automatic cross referencing would be great too, but we can
> do that with a link macro and I'm not sure how to make it
> automatic...
Both manual and automatic cross-referencing would be good. Automatic
cross-referencing, for example:
struct Foo {}
///
Foo bar ();
When the documentation is generated for "bar" it should automatically
create a link for "Foo" pointing to its documentation.
Manual cross-referencing, for example:
/// See_Also: $(ref getFoo)
void setFoo (int foo);
/// See_Also: $(ref setFoo)
int getFoo ();
When the documentation is generated for "setFoo" and "getFoo" it should
expand the macro "ref" (or whatever it should be called) to a link to
"setFoo" and "getFoo". This should handle the same function name in
different modules. I guess this is will be possible when anchors are
working properly.
BTW, Descent already handle both of these.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list