Use only direct childs of #main for description

Some elements, for example std::io::ErrorKind, have nested docblocks in
their type-decl docblock.  This would lead to a wrong description
because we pick the first non-type-decl docblock for the description.

With this patch, we require that the description docblock is a direct
child of #main to fix this issue.
This commit is contained in:
Robin Krahl 2020-07-22 17:19:23 +02:00
parent f799d860ca
commit 9f0497932f
No known key found for this signature in database
GPG Key ID: 8E9B0870524F69D8

View File

@ -80,7 +80,7 @@ pub fn parse_item_doc<P: AsRef<path::Path>>(path: P, name: &doc::Fqn) -> anyhow:
let document = parse_file(path)?;
let heading = select_first(&document, ".fqn .in-band")?.context("Could not find heading")?;
let definition = select_first(&document, ".docblock.type-decl")?;
let description = select_first(&document, ".docblock:not(.type-decl)")?;
let description = select_first(&document, "#main > .docblock:not(.type-decl)")?;
let mut doc = doc::Doc::new(name.clone());
doc.title = Some(get_html(heading.as_node())?);