diff options
| author | Michael Howell <michael@notriddle.com> | 2023-02-23 13:26:00 -0700 |
|---|---|---|
| committer | Michael Howell <michael@notriddle.com> | 2023-02-23 13:53:27 -0700 |
| commit | 5a9a3df3125b13de25ba7d0c91efebf82e94c3f9 (patch) | |
| tree | 4b13c5830ab6be4ce1ba9845a85e06942734f0ff | |
| parent | 07c993eba8b76eae497e98433ae075b00f01be10 (diff) | |
| download | rust-5a9a3df3125b13de25ba7d0c91efebf82e94c3f9.tar.gz rust-5a9a3df3125b13de25ba7d0c91efebf82e94c3f9.zip | |
rustdoc: avoid including `<li>` tags in item table short desc
Fixes a bug seen at https://docs.rs/gl_constants/0.1.1/gl_constants/index.html
| -rw-r--r-- | src/librustdoc/html/markdown.rs | 5 | ||||
| -rw-r--r-- | tests/rustdoc/item-desc-list-at-start.item-table.html | 1 | ||||
| -rw-r--r-- | tests/rustdoc/item-desc-list-at-start.rs | 9 |
3 files changed, 11 insertions, 4 deletions
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 9ef0b501c08..89f1ad71134 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -552,10 +552,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> 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 00000000000..72bde573cea --- /dev/null +++ b/tests/rustdoc/item-desc-list-at-start.item-table.html @@ -0,0 +1 @@ +<ul class="item-table"><li><div class="item-name"><a class="constant" href="constant.MY_CONSTANT.html" title="constant item_desc_list_at_start::MY_CONSTANT">MY_CONSTANT</a></div><div class="desc docblock-short">Groups: <code>SamplePatternSGIS</code>, <code>SamplePatternEXT</code></div></li></ul> \ 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 00000000000..d88c61d333e --- /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; |
