Remove spurious members from module documentation

With this patch, we require that the identifier element for a member in
the module documentation is a direct child of the table cell.  This
fixes problems with spurious member elements if there are more elements
in the table cell, e. g. stability annotations.
This commit is contained in:
Robin Krahl 2020-07-26 11:04:13 +02:00
parent bc3f1552ef
commit 19398e340c
No known key found for this signature in database
GPG Key ID: 8E9B0870524F69D8
2 changed files with 2 additions and 1 deletions

View File

@ -11,6 +11,7 @@ SPDX-License-Identifier: MIT
instead of always using `/usr`. instead of always using `/usr`.
- Improve the documentation parser: - Improve the documentation parser:
- Fix the definition of methods to only contain the actual definition. - Fix the definition of methods to only contain the actual definition.
- Remove spurious members in module documentation.
## v0.1.2 (2020-07-25) ## v0.1.2 (2020-07-25)

View File

@ -493,7 +493,7 @@ fn get_members(
) -> anyhow::Result<Vec<doc::Doc>> { ) -> anyhow::Result<Vec<doc::Doc>> {
let mut members: Vec<doc::Doc> = Vec::new(); let mut members: Vec<doc::Doc> = Vec::new();
if let Some(table) = select_first(document, &format!("#{} + table", ty.group_id()))? { if let Some(table) = select_first(document, &format!("#{} + table", ty.group_id()))? {
let items = select(table.as_node(), "td:first-child :first-child")?; let items = select(table.as_node(), "td:first-child > :first-child")?;
for item in items { for item in items {
let item_name = item.as_node().text_contents(); let item_name = item.as_node().text_contents();
let docblock = item.as_node().parent().and_then(|n| n.next_sibling()); let docblock = item.as_node().parent().and_then(|n| n.next_sibling());