Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ddoc: add class "simple-cheatsheet" #4397

Closed
wants to merge 2 commits into from
Closed

Conversation

aG0aep6G
Copy link
Contributor

@aG0aep6G aG0aep6G commented Jun 3, 2016

So that DDOX can choose not to display them.

.simple-cheatsheet tables play the same role as the listings that DDOX
generates. Having them both, and right after another, is confusing for
the reader, and doesn't add any value.

There are similar tables in

  • std.experimental.ndslice.{iteration,selection},
  • std.format,
  • std.net.curl, and
  • std.range.primitives,
    but they contain additional information or are embedded in text. So their
    presence should be less confusing.

So that DDOX can choose not to display them.

.simple-cheatsheet tables play the same role as the listings that DDOX
generates. Having them both, and right after another, is confusing for
the reader, and doesn't add any value.

There are similar tables in
* std.experimental.ndslice.{iteration,selection},
* std.format,
* std.net.curl, and
* std.range.primitives,
but they contain additional information or are embedded in text. So their
presence should be less confusing.
@aG0aep6G
Copy link
Contributor Author

aG0aep6G commented Jun 3, 2016

Companion pull request for dlang.org: dlang/dlang.org#1323

@CyberShadow
Copy link
Member

How about a CHEATSHEET macro?

@aG0aep6G
Copy link
Contributor Author

aG0aep6G commented Jun 3, 2016

How about a CHEATSHEET macro?

Sure. Added it in the dlang.org PR (dlang/dlang.org#1323), and here. I've called it SIMPLE_CHEATSHEET, though, as more complex ones may add value over the DDOX listings.

@CyberShadow
Copy link
Member

Hmm, on second thought I'm not sure about this.

I only realized this when looking at the final diff: the cheatsheets include minimal examples that provide a much better overview of the functions than the first paragraph of their DDoc. Keeping in mind that some day we might throw away the Phobos DDoc documentation and use DDox exclusively, it would mean throwing away the cheat sheets completely.

Perhaps we should instead go in the other direction (hide the automatically-generated DDoc overview in the modules with cheat sheets)? That has its disadvantages too, e.g. forgetting to update the cheat sheet would mean that a symbol is not reachable via HTML links.

@aG0aep6G
Copy link
Contributor Author

aG0aep6G commented Jun 3, 2016

Perhaps we should instead go in the other direction (hide the automatically-generated DDoc overview in the modules with cheat sheets)? That has its disadvantages too, e.g. forgetting to update the cheat sheet would mean that a symbol is not reachable via HTML links.

My thoughts exactly. We're pretty bad at keeping things in sync manually.

Also, the other way seems to be more difficult. My idea would be to define a macro DISABLE_AUTOINDEX and react to it in the template file. But I can't find a way to access macros there.

@aG0aep6G
Copy link
Contributor Author

aG0aep6G commented Jun 5, 2016

Here's an experience report from a new user who didn't like the cheat cheet for std.algorithm.comparison:
http://forum.dlang.org/post/ixpujamnyhguuqiflvom@forum.dlang.org

@CyberShadow
Copy link
Member

FWIW I disagree very strongly with that assessment. Perhaps longer English descriptions are more useful for people new to programming, but as you acquire experience across multiple programming languages, reading the documentation becomes more of a task of "finding the name of the function which I already know what it does". This is also the use case for people who already are familiar with Phobos' repertoire, but just don't remember the exact names for all functions. Having small examples is a much simpler way to confirm that the function does what you think it does, and removes the ambiguities of English phrasing or the need to parse English at all.

@aG0aep6G
Copy link
Contributor Author

aG0aep6G commented Jun 5, 2016

Having small examples is a much simpler way to confirm that the function does what you think it does, and removes the ambiguities of English phrasing or the need to parse English at all.

Makes sense, but the DDOX listing may need more meat to be useful.

I've been toying with the idea of changing the actual summaries of the functions to something more similar to the cheat sheet snippet. I.e., make the summary one sentence + one small example. The more complete description would follow, and then the rest as usual.

That would eliminate the schism between cheat sheet and generated listing, but is it
a) acceptable in the actual function documentation (not just the cheat sheet), and
b) enough information for the generated listing?

@CyberShadow
Copy link
Member

It's one solution. IIRC Sönke suggested more options in another thread.

@aG0aep6G
Copy link
Contributor Author

aG0aep6G commented Jun 5, 2016

IIRC Sönke suggested more options in another thread.

Yeah, over here: http://forum.dlang.org/post/niv2tl$2lqb$1@digitalmars.com. He suggests a special section or macro that DDOX would recognize and extract for the listing. He also mentions the problem: Another instance of duplication, because Ddoc wouldn't be able to build the cheat sheet that way.

Copy link
Member

@wilzbach wilzbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should instead go in the other direction (hide the automatically-generated DDoc overview in the modules with cheat sheets)? That has its disadvantages too, e.g. forgetting to update the cheat sheet would mean that a symbol is not reachable via HTML links.

I also think that hiding the automatically-generated DDoc overview is the way to go.
@aG0aep6G are you still interested in pushing SIMPLE_CHEATSHEET?

Moreover, I think I think the table looks nicer without "Cheat Sheet" heading, but that could be easily adjusted at dlang.org:

@aG0aep6G
Copy link
Contributor Author

@aG0aep6G are you still interested in pushing SIMPLE_CHEATSHEET?

Uhh, no. I had pretty much forgotten about this. If anyone decides that this PR here is the way to go, I'm up for fixing any issues it might have. But I don't care either way. If you want to go the other direction, by all means, go ahead.

@wilzbach
Copy link
Member

wilzbach commented Mar 4, 2017

Uhh, no. I had pretty much forgotten about this. If anyone decides that this PR here is the way to go, I'm up for fixing any issues it might have.

Hmm when I look at http://dlang.org/library/std/range.html, it still looks ugly due to the duplicated information. If there's an easy way to disable the listing with Ddox when a cheatsheet macro is present, I would say we go for it (we have to maintain the cheatsheets anyways).
If it turns out to be difficult to teach Ddox about the existing cheatsheets, I am also ok with the approach to disable the macros instead which is taken here.

But I don't care either way. If you want to go the other direction, by all means, go ahead.

Same here. I am going to make the decision easier for you as I am closing this PR - it's full of merge conflicts and submitting a new PR wouldn't be an overhead and would highly increase the chances of it being merged.
With the hopefully upcoming DDox transition this topic needs to be revisited again anyways, so maybe the future is more gentle to us.

@wilzbach wilzbach closed this Mar 4, 2017
@aG0aep6G
Copy link
Contributor Author

aG0aep6G commented Mar 5, 2017

I am going to make the decision easier for you as I am closing this PR

You should probably revert dlang/dlang.org#1323 as it doesn't make sense without the PR here.

@adamdruppe
Copy link
Contributor

You might actually just want to change the cheatsheet to embrace the idea of duplicated information, like caption it "Most common functions organized by category" (well, maybe not literally say that but word it somehow) then at the end be like "Complete listing follows".

So yes, it duplicates in some sense, but it also reorganizes and prioritizes the information in the table. In ddoc, the complete listing is the all on one page stuff, and in ddox it is a more detailed navigation, but still shows all functions alphabetized rather than categorized/prioritized by hand.

I mean, as it is, the cheatsheets don't show everything.... and indeed, I don't think they should, it is a "cheatsheet", not a "textbook"!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants