digitalmars.D - Cross-references in generated ddoc
- Ary Manzana (9/9) Apr 03 2012 Hi all,
- Jacob Carlborg (7/16) Apr 04 2012 That's awesome.
- Ary Manzana (9/27) Apr 04 2012 Ah, no. That's because I ran it against object.di, which doesn't have
- Jacob Carlborg (21/30) Apr 04 2012 Cool, but what I actually was referring to was template types, i.e. the
- Ary Manzana (31/61) Apr 04 2012 You are right!
- Ary Manzana (9/32) Apr 04 2012 Whoa!
- Jacob Carlborg (6/14) Apr 04 2012 Yeah, that would be great. Both a link that shows the complete source
- Jacob Carlborg (5/8) Apr 04 2012 BTW, I really like the filters in the Ruby documentation:
- Jacob Carlborg (17/47) Apr 04 2012 For example, Phobos uses XREF to reference symbols. The template
- Ary Manzana (2/35) Apr 05 2012 Yes, I think I will eventually do that, if the pull gets accepted.
- David Gileadi (4/13) Apr 04 2012 This looks good.
- Ary Manzana (13/30) Apr 04 2012 No, that's not a bug. The ddoc comment is:
- Jonathan M Davis (13/20) Apr 04 2012 ddoc is designed with the idea that you can provide a file with your own...
- Steven Schveighoffer (5/14) Apr 04 2012 Please, Please Walter, include this after 2.059 is released. This is a ...
- Jacob Carlborg (5/14) Apr 04 2012 This is maybe asking for a bit too much but, would it be possible to add...
Hi all, I just submitted a pull request that makes ddoc generate cross-references... even for templates! https://github.com/D-Programming-Language/dmd/pull/865 It would be awesome if you can try it with your projects, see if it's working properly and doesn't choke. I tried it with phobos and it worked fine. Also, if someone has ideas about how to solve the issues I describe, they are more than welcome.
Apr 03 2012
On 2012-04-04 07:38, Ary Manzana wrote:Hi all, I just submitted a pull request that makes ddoc generate cross-references... even for templates! https://github.com/D-Programming-Language/dmd/pull/865 It would be awesome if you can try it with your projects, see if it's working properly and doesn't choke. I tried it with phobos and it worked fine. Also, if someone has ideas about how to solve the issues I describe, they are more than welcome.That's awesome. Looking at http://pancake.io/1e79d0/array.html, none of the templates are cross-referenced, or was that one of the problems? Why are you not using the mangled name when creating anchors? -- /Jacob Carlborg
Apr 04 2012
On 4/4/12 6:35 PM, Jacob Carlborg wrote:On 2012-04-04 07:38, Ary Manzana wrote:Ah, no. That's because I ran it against object.di, which doesn't have ddoc comments at all. I don't generate cross-references to undocumented symbols. I uploaded a new version which I ran against an object.di which has empty ddocs for everything. Now you can see there are some cross-references. (if you find some is missing, please tell me).Hi all, I just submitted a pull request that makes ddoc generate cross-references... even for templates! https://github.com/D-Programming-Language/dmd/pull/865 It would be awesome if you can try it with your projects, see if it's working properly and doesn't choke. I tried it with phobos and it worked fine. Also, if someone has ideas about how to solve the issues I describe, they are more than welcome.That's awesome. Looking at http://pancake.io/1e79d0/array.html, none of the templates are cross-referenced, or was that one of the problems?Why are you not using the mangled name when creating anchors?I don't think there's need for the mangled name. It's also more natural to give a link like foo.html?Some.Class than a mangled name.
Apr 04 2012
On 2012-04-04 13:38, Ary Manzana wrote:Ah, no. That's because I ran it against object.di, which doesn't have ddoc comments at all. I don't generate cross-references to undocumented symbols. I uploaded a new version which I ran against an object.di which has empty ddocs for everything. Now you can see there are some cross-references. (if you find some is missing, please tell me).Cool, but what I actually was referring to was template types, i.e. the first declaration in http://pancake.io/1e79d0/array.html: ForeachType!(Range)[] array(Range)(Range r); "ForeachType" is not a link.Sure but then it won't be possible to reference different overloaded functions? If you're not creating your own human readable form of mangling, i.e. foo.html#Foo.bar(int) foo.html#Foo.bar(char) I think it's more important that the doc generator behaves correctly than outputting pretty URL's. I found a case where the fully qualified name is not used: http://pancake.io/1e79d0/complex.html#toString The name is just "toString" instead of "Complex.toString". BTW, why are adding an empty "a" tag for the anchor? Just add an "id" on the actual tag you want to refer to. The cross-referencing worked better in Descent, why are you doing it differently? -- /Jacob CarlborgWhy are you not using the mangled name when creating anchors?I don't think there's need for the mangled name. It's also more natural to give a link like foo.html?Some.Class than a mangled name.
Apr 04 2012
On 4/4/12 8:05 PM, Jacob Carlborg wrote:On 2012-04-04 13:38, Ary Manzana wrote:You are right! I was missing doing cross-reference for template instances. Now I did it, but I was actually forgetting to do cross-references for template instances inside templates. :-P So now I did it. Take a look, much better! :-) http://pancake.io/1e79d0/array.html#arrayAh, no. That's because I ran it against object.di, which doesn't have ddoc comments at all. I don't generate cross-references to undocumented symbols. I uploaded a new version which I ran against an object.di which has empty ddocs for everything. Now you can see there are some cross-references. (if you find some is missing, please tell me).Cool, but what I actually was referring to was template types, i.e. the first declaration in http://pancake.io/1e79d0/array.html: ForeachType!(Range)[] array(Range)(Range r); "ForeachType" is not a link.But you can't reference a function in the generated ddoc. You could do it manually, but then you'd have to figure out the mangling or something like that. Also, when guessing what an identifier resolves to, I can't possibly know which template parameters to use. Also, all overloads will have more or less the same documentation and they will be one next to the other. I don't think that's an issue for a documentation system.Sure but then it won't be possible to reference different overloaded functions? If you're not creating your own human readable form of mangling, i.e. foo.html#Foo.bar(int) foo.html#Foo.bar(char) I think it's more important that the doc generator behaves correctly than outputting pretty URL's.Why are you not using the mangled name when creating anchors?I don't think there's need for the mangled name. It's also more natural to give a link like foo.html?Some.Class than a mangled name.I found a case where the fully qualified name is not used: http://pancake.io/1e79d0/complex.html#toString The name is just "toString" instead of "Complex.toString".Thanks. I had a problem with template members. It's now fixed. http://pancake.io/1e79d0/complex.html#Complex.toStringBTW, why are adding an empty "a" tag for the anchor? Just add an "id" on the actual tag you want to refer to.I wanted to do that. But I have to deal with ddoc macros. Every declaration is put inside a <dt> tag. That is issued with a $(DT ...) macro. So I'd have to create another macro, say $DT_WITH_ID or something like that that outputs the id. I can't simply output an id attribute because I'm not generating html: I'm generating ddoc. I mean, what other formats was Walter thinking of? PDF? Just use an HTML to PDF converter. Ummm... plain text? Microsoft Doc? I don't know. Why can't we just generate html and that's it?The cross-referencing worked better in Descent, why are you doing it differently?Well, Descent kept a lot of information to be as precise as possible. DMD is not my code so I tried to modify it as least as possible, without adding too much overhead to the code or memory. I just added a member to the TypeIdentifier struct. I would need to change a lot more to make it work as Descent worked... but I think what I did now with DMD is good enough. :-)
Apr 04 2012
On 4/4/12 9:53 PM, Ary Manzana wrote:On 4/4/12 8:05 PM, Jacob Carlborg wrote:Whoa! And take a look at this: http://pancake.io/1e79d0/algorithm.html It's all colorful and linky, even for template if conditions! :-D Thanks for catching that, Jacob. By the way, I think a "show source" would be nice to have, like what they have in Ruby... no? It helps you find bugs faster, or understand the code better if the documentation is not precise enough...On 2012-04-04 13:38, Ary Manzana wrote:You are right! I was missing doing cross-reference for template instances. Now I did it, but I was actually forgetting to do cross-references for template instances inside templates. :-P So now I did it. Take a look, much better! :-) http://pancake.io/1e79d0/array.html#arrayAh, no. That's because I ran it against object.di, which doesn't have ddoc comments at all. I don't generate cross-references to undocumented symbols. I uploaded a new version which I ran against an object.di which has empty ddocs for everything. Now you can see there are some cross-references. (if you find some is missing, please tell me).Cool, but what I actually was referring to was template types, i.e. the first declaration in http://pancake.io/1e79d0/array.html: ForeachType!(Range)[] array(Range)(Range r); "ForeachType" is not a link.
Apr 04 2012
On 2012-04-04 15:59, Ary Manzana wrote:Whoa! And take a look at this: http://pancake.io/1e79d0/algorithm.html It's all colorful and linky, even for template if conditions! :-D Thanks for catching that, Jacob. By the way, I think a "show source" would be nice to have, like what they have in Ruby... no? It helps you find bugs faster, or understand the code better if the documentation is not precise enough...Yeah, that would be great. Both a link that shows the complete source code of the module (we're actually already have this, but it's done manually with a macro) and a "show source" link at each declaration. -- /Jacob Carlborg
Apr 04 2012
On 2012-04-04 15:59, Ary Manzana wrote:By the way, I think a "show source" would be nice to have, like what they have in Ruby... no? It helps you find bugs faster, or understand the code better if the documentation is not precise enough...BTW, I really like the filters in the Ruby documentation: http://www.ruby-doc.org/core-1.9.3/ -- /Jacob Carlborg
Apr 04 2012
On 2012-04-04 15:53, Ary Manzana wrote:You are right! I was missing doing cross-reference for template instances. Now I did it, but I was actually forgetting to do cross-references for template instances inside templates. :-P So now I did it. Take a look, much better! :-) http://pancake.io/1e79d0/array.html#arrayThanks, much better now :)But you can't reference a function in the generated ddoc. You could do it manually, but then you'd have to figure out the mangling or something like that. Also, when guessing what an identifier resolves to, I can't possibly know which template parameters to use.For example, Phobos uses XREF to reference symbols. The template parameter doesn't matter since that will refer to the same function.Also, all overloads will have more or less the same documentation and they will be one next to the other. I don't think that's an issue for a documentation system.I guess you're right.Thanks. I had a problem with template members. It's now fixed. http://pancake.io/1e79d0/complex.html#Complex.toStringGood.I wanted to do that. But I have to deal with ddoc macros. Every declaration is put inside a <dt> tag. That is issued with a $(DT ...) macro. So I'd have to create another macro, say $DT_WITH_ID or something like that that outputs the id. I can't simply output an id attribute because I'm not generating html: I'm generating ddoc.Ok, I see. But why don't you create $DT_WITH_ID then :)I mean, what other formats was Walter thinking of? PDF? Just use an HTML to PDF converter. Ummm... plain text? Microsoft Doc? I don't know. Why can't we just generate html and that's it?I think the original idea was to be able to directly output PDF or similar but I don't think that turned out so well. Now Walter also says he is way more productive when using ddoc instead of plain HTML. That's why dlang.org is written using ddoc.Well, Descent kept a lot of information to be as precise as possible. DMD is not my code so I tried to modify it as least as possible, without adding too much overhead to the code or memory. I just added a member to the TypeIdentifier struct. I would need to change a lot more to make it work as Descent worked... but I think what I did now with DMD is good enough. :-)Fair enough. I think it's great what you've done with the doc generator but it can become even better. Like listing methods from base classes, listing inherited classes and implemented interfaces inherit doc comments and so on, just like Descent does. -- /Jacob Carlborg
Apr 04 2012
On 4/4/12 11:11 PM, Jacob Carlborg wrote:On 2012-04-04 15:53, Ary Manzana wrote:Yes, I think I will eventually do that, if the pull gets accepted.You are right! I was missing doing cross-reference for template instances. Now I did it, but I was actually forgetting to do cross-references for template instances inside templates. :-P So now I did it. Take a look, much better! :-) http://pancake.io/1e79d0/array.html#arrayThanks, much better now :)But you can't reference a function in the generated ddoc. You could do it manually, but then you'd have to figure out the mangling or something like that. Also, when guessing what an identifier resolves to, I can't possibly know which template parameters to use.For example, Phobos uses XREF to reference symbols. The template parameter doesn't matter since that will refer to the same function.Also, all overloads will have more or less the same documentation and they will be one next to the other. I don't think that's an issue for a documentation system.I guess you're right.Thanks. I had a problem with template members. It's now fixed. http://pancake.io/1e79d0/complex.html#Complex.toStringGood.I wanted to do that. But I have to deal with ddoc macros. Every declaration is put inside a <dt> tag. That is issued with a $(DT ...) macro. So I'd have to create another macro, say $DT_WITH_ID or something like that that outputs the id. I can't simply output an id attribute because I'm not generating html: I'm generating ddoc.Ok, I see. But why don't you create $DT_WITH_ID then :)
Apr 05 2012
On 4/3/12 10:38 PM, Ary Manzana wrote:Hi all, I just submitted a pull request that makes ddoc generate cross-references... even for templates! https://github.com/D-Programming-Language/dmd/pull/865 It would be awesome if you can try it with your projects, see if it's working properly and doesn't choke. I tried it with phobos and it worked fine. Also, if someone has ideas about how to solve the issues I describe, they are more than welcome.This looks good. One bug: for http://pancake.io/1e79d0/array.html#insert it appears to have dropped the name/link for which function to use instead.
Apr 04 2012
On 4/4/12 10:00 PM, David Gileadi wrote:On 4/3/12 10:38 PM, Ary Manzana wrote:No, that's not a bug. The ddoc comment is: /++ $(RED Deprecated. It will be removed in May 2012. Please use $(LREF insertInPlace) instead.) Same as $(XREF array, insertInPlace). +/ The problem is, I didn't define the LREF and XREF macros when generating the docs. But when Walter and Andrei generate the docs they use this: https://github.com/D-Programming-Language/d-programming-language.org/blob/master/std.ddoc#L316 If you ask me, that's a bad smell. What if I want to make the docs in my own format? How can I know all the macros to use? Hmmm....Hi all, I just submitted a pull request that makes ddoc generate cross-references... even for templates! https://github.com/D-Programming-Language/dmd/pull/865 It would be awesome if you can try it with your projects, see if it's working properly and doesn't choke. I tried it with phobos and it worked fine. Also, if someone has ideas about how to solve the issues I describe, they are more than welcome.This looks good. One bug: for http://pancake.io/1e79d0/array.html#insert it appears to have dropped the name/link for which function to use instead.
Apr 04 2012
On Wednesday, April 04, 2012 22:15:10 Ary Manzana wrote:But when Walter and Andrei generate the docs they use this: https://github.com/D-Programming-Language/d-programming-language.org/blob/ma ster/std.ddoc#L316 If you ask me, that's a bad smell. What if I want to make the docs in my own format? How can I know all the macros to use? Hmmm....ddoc is designed with the idea that you can provide a file with your own macros rather than just having built-in ones (not to mention, then having to build in all macros into the compiler). It would be incredibly limiting. If you want to generate the docs in your own format, then you can provide your own ddoc file which defines the macros how you'd like, but it's very much on purpose that there be a ddoc file. If you had your own project with macros that helped you with your documentation, then anyone wanting to generate the documentation differently is going to need to have their own ddoc file with different versions of those macros. That's expecteed, and I don't see why it would be a code smell. Anything else would be saying that the very idea of user-defined macros is a bad idea, which very much goes against how ddoc works. - Jonathan M Davis
Apr 04 2012
On Wed, 04 Apr 2012 01:38:42 -0400, Ary Manzana <ary esperanto.org.ar> wrote:Hi all, I just submitted a pull request that makes ddoc generate cross-references... even for templates! https://github.com/D-Programming-Language/dmd/pull/865 It would be awesome if you can try it with your projects, see if it's working properly and doesn't choke. I tried it with phobos and it worked fine. Also, if someone has ideas about how to solve the issues I describe, they are more than welcome.Please, Please Walter, include this after 2.059 is released. This is a significant improvement. -Steve
Apr 04 2012
On 2012-04-04 07:38, Ary Manzana wrote:Hi all, I just submitted a pull request that makes ddoc generate cross-references... even for templates! https://github.com/D-Programming-Language/dmd/pull/865 It would be awesome if you can try it with your projects, see if it's working properly and doesn't choke. I tried it with phobos and it worked fine. Also, if someone has ideas about how to solve the issues I describe, they are more than welcome.This is maybe asking for a bit too much but, would it be possible to add cross-referencing in the examples? -- /Jacob Carlborg
Apr 04 2012