-
Notifications
You must be signed in to change notification settings - Fork 13.3k
rustdoc: migrate document_type_layout
to askama
#109949
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
Conversation
r? @jsha (rustbot has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since I implemented the original version of this function, I thought reviewing this PR could be a good way to start getting familiar with Askama. :)
@@ -0,0 +1,45 @@ | |||
<h2 id="layout" class="small-section-header"> {# #} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the meaning of the {# #}
here and below? According to Askama's docs, it's a block comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a block comment, yes.
The point of it is to eat the whitespace between the end of this tag and the start of the one on the next line (it would normally be preserved).
{% when Ok(ty_layout) %} | ||
<div class="warning"> {# #} | ||
<p> {# #} | ||
<strong>Note:</strong> Most layout information is <strong>completely {#+ #} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Askama's docs, the {#+ #}
keeps whitespace, but don't we want to suppress it to reduce page size?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it was {# #}
, I'd wind up with <strong>completelyunstable</strong>
. If it was completely absent, I'd wind up with the newline and several spaces in a row between the two words.
☔ The latest upstream changes (presumably #109925) made this pull request unmergeable. Please resolve the merge conflicts. |
ae57609
to
08f204e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this! Sorry I was slow to get back to you.
ab8ea2b
to
e26ae95
Compare
@jsha These all seem like good ideas, and I've pushed a new version of the commit that makes these changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks great! Just a style question about nesting let
s in scopes. And, relatedly: why nest the struct
definitions inside document_type_layout
? It winds up making the function body harder to navigate. If we're concerned about polluting scopes, maybe it would be better to use a module? That is, have render/type_layout.rs
, with document_type_layout
as the only public item, and with struct TypeLayout
and struct TypeLayoutSize
at the top level of that module.
The nested The nested rust/src/librustdoc/html/sources.rs Lines 294 to 312 in 4212c1b
|
This comment has been minimized.
This comment has been minimized.
097a299
to
e6664c0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. r=me when tests pass. Thanks!
@bors r=jsha rollup |
Rollup of 7 pull requests Successful merges: - rust-lang#109949 (rustdoc: migrate `document_type_layout` to askama) - rust-lang#110622 (Stable hash tag (discriminant) of `GenericArg`) - rust-lang#110635 (More `IS_ZST` in `library`) - rust-lang#110640 (compiler/rustc_target: Raise m68k-linux-gnu baseline to 68020) - rust-lang#110657 (nit: consistent naming for SimplifyConstCondition) - rust-lang#110659 (rustdoc: clean up JS) - rust-lang#110660 (Print ty placeholders pretty) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
No description provided.