From 32f62607c3142dfc9eb56a0bd72dee298ca43358 Mon Sep 17 00:00:00 2001 From: Jacob Hoffman-Andrews Date: Tue, 1 Feb 2022 22:11:36 -0800 Subject: Emit valid HTML from rustdoc Previously, tidy-html5 (`tidy`) would complain about a few things in our HTML. The main thing is that `` tags can't contain `
`s. That's easily fixed by changing out the `
`s for ``s with `display: block`. However, there's also a rule that ``s can't contain heading elements. `` permits only "phrasing content" https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span, and `

` (and friends) are "Flow content, heading content, palpable content". https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements We have a wrapping `
` that goes around each `

`/`

`, etc. We turn that into a `
` rather than a `` because `
` permits "flow content". https://developer.mozilla.org/en-US/docs/Web/HTML/Element/section After this change we get only three warnings from tidy, run on struct.String.html: line 6 column 10790 - Warning: trimming empty line 1 column 1118 - Warning: proprietary attribute "disabled" line 1 column 1193 - Warning: proprietary attribute "disabled" The empty `` is a known issue - there's a span in front of the search box to work around a strange Safari issue. The `` attributes are the non-default stylesheets. We can probably refactor theme application to avoid using this proprietary "disabled" attribute. --- src/test/rustdoc/version-separator-without-source.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/test/rustdoc/version-separator-without-source.rs') diff --git a/src/test/rustdoc/version-separator-without-source.rs b/src/test/rustdoc/version-separator-without-source.rs index bffe5030a84..ae866deba1e 100644 --- a/src/test/rustdoc/version-separator-without-source.rs +++ b/src/test/rustdoc/version-separator-without-source.rs @@ -16,8 +16,8 @@ pub fn foo() {} pub struct Bar; impl Bar { - // @has - '//div[@id="method.bar"]/*[@class="rightside"]' '2.0' - // @!has - '//div[@id="method.bar"]/*[@class="rightside"]' '2.0 ·' + // @has - '//*[@id="method.bar"]/*[@class="rightside"]' '2.0' + // @!has - '//*[@id="method.bar"]/*[@class="rightside"]' '2.0 ·' #[stable(feature = "foobar", since = "2.0")] pub fn bar() {} } -- cgit 1.4.1-3-g733a5