diff --git a/src/parser.rs b/src/parser.rs index af9c9a1..4e9408e 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -137,8 +137,14 @@ fn get_members( // On module pages, the members are listed in tables let items = select(table.as_node(), "td:first-child :first-child")?; for item in items { - let item_name = get_html(item.as_node())?; - members.push(doc::Doc::new(base_name.child(&item_name))) + let item_name = item.as_node().text_contents(); + let docblock = item.as_node().parent().and_then(|n| n.next_sibling()); + + let mut doc = doc::Doc::new(base_name.child(&item_name)); + // We would like to use inner_html() here, but that is currently not implemented in + // kuchiki + doc.description = docblock.map(|n| n.text_contents()); + members.push(doc); } } Ok(members) diff --git a/src/viewer/text/mod.rs b/src/viewer/text/mod.rs index e51cb45..a0fea46 100644 --- a/src/viewer/text/mod.rs +++ b/src/viewer/text/mod.rs @@ -40,7 +40,13 @@ impl TextViewer

{ if !items.is_empty() { self.printer.println()?; self.printer.print_heading(2, heading)?; - self.print_list(items.iter())?; + self.print_list(items.iter().map(|i| { + if let Some(description) = &i.description { + format!("{}
{}", i.name.last(), description) + } else { + i.name.last().to_owned() + } + }))?; } } Ok(())