Skip to content

Fix bugzilla 14413: Spurious newline in ddoc JSON output for multiple…#4745

Merged
CyberShadow merged 1 commit intodlang:masterfrom
Abscissa:issue-14413
Feb 13, 2017
Merged

Fix bugzilla 14413: Spurious newline in ddoc JSON output for multiple…#4745
CyberShadow merged 1 commit intodlang:masterfrom
Abscissa:issue-14413

Conversation

@Abscissa
Copy link
Contributor

… successive line doc comments

Fixes: https://issues.dlang.org/show_bug.cgi?id=14413

When one doc comment ends, and the next doc comment starts on exactly the same or the next line, no extra newline (ie, paragraph break) is added between them when they're merged by Lexer::combineComments.

@Abscissa
Copy link
Contributor Author

I have no idea why the autotester is failing this on Win32. It's saying "Error - file 'lexer.c' contains trailing whitespace", but the file very clearly doesn't (aside from the standard trailing \n):

https://github.com/Abscissa/dmd/blob/issue-14413/src/lexer.c#L2504

https://github.com/D-Programming-Language/dmd/pull/4745/files#diff-92587e94259bcadd0c463ae6237c5ecfL2447

src/lexer.c Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

Trailing whitespace.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, it didn't give a line number so I thought it meant "at the end of the entire file". Never seen indentation in a blank line be an issue before. None of my editors eliminate or highlight that sort of thing by default. Will fix.

@CyberShadow
Copy link
Member

Looks good! Though in some places we need to replace newline-delimited lists with proper DDoc ($(UL ...)), mainly core.cpuid (for example see web/library-prerelease/core/cpuid/prefer_athlon.html in autotester results).

@jacob-carlborg
Copy link
Contributor

I suggest cleaning up the commits.

src/doc.d Outdated
Copy link
Member

Choose a reason for hiding this comment

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

Please use a book, or even better a NewParagraph.yes/no enum flag .

@MartinNowak
Copy link
Member

Why does your change only affect the json output?

@Abscissa Abscissa force-pushed the issue-14413 branch 3 times, most recently from e774155 to a581d0e Compare October 9, 2015 17:56
@Abscissa
Copy link
Contributor Author

Abscissa commented Oct 9, 2015

I suggest cleaning up the commits.

Done

Please use a bool,

Done

Why does your change only affect the json output?

Hmm? It affects -D's html output for me, in addition to the json output. Try it on this:

///This should
///be one
///paragraph.

///Separate paragraph.
void a() {}

@yebblies
Copy link
Contributor

@MartinNowak
Copy link
Member

Mmh, half of the doc changes are fixes, the other half now has broken formatting.
We'd at least need someone to fixup druntime/phobos before we can pull this. Any estimate on the impact for other projects? I don't use /// for multiline doc comments myself.

@Abscissa
Copy link
Contributor Author

Mmh, half of the doc changes are fixes, the other half now has broken formatting. We'd at least need someone to fixup druntime/phobos before we can pull this.

Many of them also seem to be semi-arbitrary judgment calls which could work either way. I've mainly left those alone.

I've make PRs to fixup druntime/phobos: dlang/phobos#3722 and dlang/druntime#1408

Any estimate on the impact for other projects? I don't use /// for multiline doc comments myself.

I really doubt it would be a problem. (I do use /// for multiline doc comments). If you're using /// for multiline doc comments, then chances are you're already using a blank line as a paragraph break anyway. If you're not, then it already looks wrong in the code anyway (or, as was occasionally the case of phobos/druntime., you may be forgetting to use proper UL/LI list macros where appropriate). Ex:

/// Hello, this function does some
/// cool stuff.
/// This is really supposed to be
/// another paragraph?
/// It looks wrong even in here,
/// doesn't it?

vs:

/// Hello, this function does some
/// cool stuff.
///
/// This really is supposed to be
/// another paragraph.
///
/// It looks correct even in here,
/// doesn't it?

I think the fact that this has already caught "spurious newline" formatting errors in both druntime and phobos docs is a good sign that this is worthwhile. Plus, the very few breakages that did occur (not counting cases where it can work fine either way, I'd argue those aren't actual "breaking") were things that were arguably (IMO) already written wrong in the doc comments anyway. And even those were mostly in the curl bindings which really needs it's doc comments cleaned up a bit anyway.

Hackerpilot pushed a commit to dlang/phobos that referenced this pull request Oct 17, 2015
@Abscissa
Copy link
Contributor Author

Jesus, it broke again? Getting tired of this...

@Abscissa
Copy link
Contributor Author

Rebased again.

@Abscissa
Copy link
Contributor Author

Would it be bad form to ping this?

@MetaLang
Copy link
Member

More or less the only way to get something merged is to constantly hound people

@Abscissa
Copy link
Contributor Author

This has been collecting dust since DMDFE was in C. I'll fix the merge failures that keep cropping in whenever someone's interested in actually merging. I'm done babysitting an endlessly ignored PR in the meantime.

@Abscissa
Copy link
Contributor Author

This has been rotting in limbo for about a year, can it get some attention?

@Abscissa
Copy link
Contributor Author

Abscissa commented Sep 23, 2016

Again, anytime somebody's interested in actually merging, I'll be glad to cleanup any conflicts and failed checks. Just sayin'. Hello? Is this thing on? tap tap tap...This is why I don't normally contribute to the base dlang projects anymore.

@andralex
Copy link
Member

@adamdruppe of course! I don't have the time to get into the PR, just skimmed the chat. Yes, if it's appropriate please pull.

@CyberShadow
Copy link
Member

Ok, crazy heretical idea here, but it's all getting stuck inside a <p class="para">...</p> right? Just make the "paragraph break" be </p><p class="para">.

Pretty sure we tried that at some point... it didn't work.

@andralex
Copy link
Member

@CyberShadow I just tried it and runs of <p></p> are also merged together. So we should be able to generate paired <p>s. Cool!

@andralex
Copy link
Member

@CyberShadow actually I think it can be made to work. The trick is to insert a <p> at the beginning of the doc and a </p> at the end of the doc.

Overall: let's focus on getting beautiful documentation first, less aggravation to doc writers (e.g. no more need for the silly $(P ...)s) second, and generating paired <p>s third. The worst we can do is debate this to death and conclude no progress can be made. The second worst is develop a really convoluted solution for a small benefit. Thanks!

@CyberShadow
Copy link
Member

@CyberShadow actually I think it can be made to work. The trick is to insert a <p> at the beginning of the doc and a </p> at the end of the doc.

No, that's exactly what we tried.

Unfortunately I don't remember what went wrong :(

@andralex
Copy link
Member

@CyberShadow Then let's forego pairing of <p>s until we have a solution. The priority is formatting and doc writer experience. Thanks!

@andralex
Copy link
Member

looked over the code and looks reasonable and quite what I'd expected. All tests pass, too. @CyberShadow @adamdruppe @MartinNowak anything stopping this from getting merged?

@CyberShadow
Copy link
Member

Hmm, the documentation tester didn't report in. Let me look at that.

@CyberShadow
Copy link
Member

Hmm, the documentation tester didn't report in. Let me look at that.

Found the problem - we have over 100 open pull requests open for DMD, and this pull request is below the 100 line. GitHub has a limit of 100 items per page in API calls. I may have been a bit too hopeful that we'll never need to test more than 100 open pull requests per repo :)

Implementing paging real quick.

@CyberShadow
Copy link
Member

Done!

Though, unless someone did something about the error in std.random, the build will fail as before.

@andralex
Copy link
Member

@adamdruppe yah, now I remember my old PR addressed this matter.

@CyberShadow thanks!

@JackStouffer
Copy link
Contributor

Though, unless someone did something about the error in std.random, the build will fail as before.

I would love to, but the error isn't reproducible locally.

@CyberShadow
Copy link
Member

I would love to, but the error isn't reproducible locally.

Note that it occurs in 2.073.0's Phobos, not master. It's possible that it will (or can only) be fixed by a 2.073.1 release.

If you have time to dig into this, let me know and I'll give you access to the machine/account.

@CyberShadow
Copy link
Member

I would love to, but the error isn't reproducible locally.

BTW, how did you try to reproduce it?

I haven't tried but digger build --with=website should do mostly the same thing as the documentation tester.

@CyberShadow
Copy link
Member

I haven't tried but digger build --with=website should do mostly the same thing as the documentation tester.

OK, that does work on my machine :/

Perhaps it could be something like a difference in gcc versions exposing a DMD bug or something...

@adamdruppe
Copy link
Contributor

adamdruppe commented Feb 10, 2017 via email

@adamdruppe
Copy link
Contributor

adamdruppe commented Feb 10, 2017 via email

@CyberShadow
Copy link
Member

CyberShadow commented Feb 10, 2017

anything stopping this from getting merged?

I would like to see a doc tester diff...

@jacob-carlborg
Copy link
Contributor

You might be able to hack that up with css

I would rather not output the macro to begin with.

@JackStouffer
Copy link
Contributor

If you have time to dig into this, let me know and I'll give you access to the machine/account.

If it's not an issue with Phobos I don't know where I'd start :/. I don't really use ddoc.

@CyberShadow
Copy link
Member

If it's not an issue with Phobos I don't know where I'd start :/. I don't really use ddoc.

Well, looking at the logs, it is an issue that's at least related to Phobos, since the errors occur there. I don't know what the root cause is, though...

@CyberShadow
Copy link
Member

I would like to see a doc tester diff...

Well, we got diffs back, and it looks great!

What is the significance of the codecov failures? Would merging with those failures break master?

@Abscissa Could you please rebase and squash the fixups into one commit?

@Abscissa
Copy link
Contributor Author

Abscissa commented Feb 13, 2017 via email

@CyberShadow CyberShadow merged commit 4c12f76 into dlang:master Feb 13, 2017
@CyberShadow
Copy link
Member

CyberShadow commented Feb 13, 2017

And so the squeaky wheel got its oil, eh :) Thanks!

@andralex
Copy link
Member

woo-hoo what a victory for the process and the folks who made this happen!

@Abscissa
Copy link
Contributor Author

Awesome, thanks all!

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.