From 5a9a3df3125b13de25ba7d0c91efebf82e94c3f9 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Thu, 23 Feb 2023 13:26:00 -0700 Subject: [PATCH] rustdoc: avoid including `
  • ` tags in item table short desc Fixes a bug seen at https://docs.rs/gl_constants/0.1.1/gl_constants/index.html --- src/librustdoc/html/markdown.rs | 5 +---- tests/rustdoc/item-desc-list-at-start.item-table.html | 1 + tests/rustdoc/item-desc-list-at-start.rs | 9 +++++++++ 3 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 tests/rustdoc/item-desc-list-at-start.item-table.html create mode 100644 tests/rustdoc/item-desc-list-at-start.rs diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 9ef0b501c0850..89f1ad71134ca 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -552,10 +552,7 @@ impl<'a, I: Iterator>> SummaryLine<'a, I> { } fn check_if_allowed_tag(t: &Tag<'_>) -> bool { - matches!( - t, - Tag::Paragraph | Tag::Item | Tag::Emphasis | Tag::Strong | Tag::Link(..) | Tag::BlockQuote - ) + matches!(t, Tag::Paragraph | Tag::Emphasis | Tag::Strong | Tag::Link(..) | Tag::BlockQuote) } fn is_forbidden_tag(t: &Tag<'_>) -> bool { diff --git a/tests/rustdoc/item-desc-list-at-start.item-table.html b/tests/rustdoc/item-desc-list-at-start.item-table.html new file mode 100644 index 0000000000000..72bde573cead3 --- /dev/null +++ b/tests/rustdoc/item-desc-list-at-start.item-table.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/tests/rustdoc/item-desc-list-at-start.rs b/tests/rustdoc/item-desc-list-at-start.rs new file mode 100644 index 0000000000000..d88c61d333e87 --- /dev/null +++ b/tests/rustdoc/item-desc-list-at-start.rs @@ -0,0 +1,9 @@ +// @has item_desc_list_at_start/index.html +// @count - '//ul[@class="item-table"]/li/div/li' 0 +// @count - '//ul[@class="item-table"]/li' 1 +// @snapshot item-table - '//ul[@class="item-table"]' + +// based on https://docs.rs/gl_constants/0.1.1/src/gl_constants/lib.rs.html#16 + +/// * Groups: `SamplePatternSGIS`, `SamplePatternEXT` +pub const MY_CONSTANT: usize = 0;