Skip to content

doc: wrong layout in static constants that span more than one line in its definition #13198

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

Closed
japaric opened this issue Mar 29, 2014 · 1 comment
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@japaric
Copy link
Member

japaric commented Mar 29, 2014

Example: UserDir in std::io
Image for future reference

The UserDir variable, which spans two lines in its definition, gets a boxed layout,

/// A set of permissions for user owned directories, this is equivalent to 0755
/// on unix-like systems.
pub static UserDir: FilePermission = UserRWX | GroupRead | GroupExecute |
                                     OtherRead | OtherExecute;

whereas the one line UserFile definition looks correct

/// A set of permissions for user owned files, this is equivalent to 0644 on
/// unix-like systems.
pub static UserFile: FilePermission = UserRead | UserWrite | GroupRead | OtherRead;
@ipetkov
Copy link
Contributor

ipetkov commented Apr 17, 2014

Seems like the culprit is wrapping the static value in a pre tag if it has a line break.

Removing wouldn't be a complete solution since for multi-line values it makes sense for a pre html tag to be used over code such as here or here.

Although in certain situations displaying the literal code in a pre tag isn't correct either because the whitespace can get messed up when the code declaration is indented. I think rustdoc should take into account the length of the declaration before the equals sign and trim it from subsequent lines if it is there.

screen shot 2014-04-16 at 8 41 47 pm

Maybe a simple fix for the above mentioned issue would be for rustdoc to strip out any newlines immediately following an operator (other than a comma)? That way we would remove ambiguity from a short declaration that wraps on a new line from an actual large declaration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants