diff options
| author | Yuki Okushi <jtitor@2k36.org> | 2022-07-30 07:39:56 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-30 07:39:56 +0900 |
| commit | cfbf7be7d03faa55219a9f6d08e90687a3000d1b (patch) | |
| tree | edab3bc17102f238d44a7b2e767f68f3f643070d /src/librustdoc/html/render | |
| parent | 735969eacdc8eecc16eb9b646f994518188fb9fd (diff) | |
| parent | 6149cf982c6c275d73345bc3d476ded733e7bc2f (diff) | |
| download | rust-cfbf7be7d03faa55219a9f6d08e90687a3000d1b.tar.gz rust-cfbf7be7d03faa55219a9f6d08e90687a3000d1b.zip | |
Rollup merge of #99904 - GuillaumeGomez:cleanup-html-whitespace, r=notriddle
Cleanup html whitespace I realized while looking at the raw HTML that we generated some unwanted white space characters. This PR cleans up the one coming directly from rustdoc. I'll check from `pulldown-cmark` for the remaining ones. Some numbers now: the difference is small, it goes from `63009` to `62859`. But multiplied by the number of files, it becomes quite interesting overall. r? `@notriddle`
Diffstat (limited to 'src/librustdoc/html/render')
| -rw-r--r-- | src/librustdoc/html/render/print_item.rs | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index 69d66693f75..547d6696a43 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -311,7 +311,7 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items: w, "<h2 id=\"{id}\" class=\"small-section-header\">\ <a href=\"#{id}\">{name}</a>\ - </h2>\n{}", + </h2>{}", ITEM_TABLE_OPEN, id = cx.derive_id(my_section.id().to_owned()), name = my_section.name(), @@ -415,10 +415,10 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items: write!( w, "<div class=\"item-left {stab}{add}module-item\">\ - <a class=\"{class}\" href=\"{href}\" title=\"{title}\">{name}</a>\ - {visibility_emoji}\ - {unsafety_flag}\ - {stab_tags}\ + <a class=\"{class}\" href=\"{href}\" title=\"{title}\">{name}</a>\ + {visibility_emoji}\ + {unsafety_flag}\ + {stab_tags}\ </div>\ <div class=\"item-right docblock-short\">{docs}</div>", name = myitem.name.unwrap(), @@ -1126,7 +1126,8 @@ fn item_union(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, s: &clean: write!( w, "<h2 id=\"fields\" class=\"fields small-section-header\">\ - Fields<a href=\"#fields\" class=\"anchor\"></a></h2>" + Fields<a href=\"#fields\" class=\"anchor\"></a>\ + </h2>" ); for (field, ty) in fields { let name = field.name.expect("union field name"); @@ -1238,7 +1239,8 @@ fn item_enum(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, e: &clean:: write!( w, "<h2 id=\"variants\" class=\"variants small-section-header\">\ - Variants{}<a href=\"#variants\" class=\"anchor\"></a></h2>", + Variants{}<a href=\"#variants\" class=\"anchor\"></a>\ + </h2>", document_non_exhaustive_header(it) ); document_non_exhaustive(w, it); @@ -1294,9 +1296,9 @@ fn item_enum(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, e: &clean:: w, "<div class=\"sub-variant-field\">\ <span id=\"{id}\" class=\"variant small-section-header\">\ - <a href=\"#{id}\" class=\"anchor field\"></a>\ - <code>{f}: {t}</code>\ - </span>", + <a href=\"#{id}\" class=\"anchor field\"></a>\ + <code>{f}: {t}</code>\ + </span>", id = id, f = field.name.unwrap(), t = ty.print(cx) |
