Show definition for constants
Similar to the fix for functions in 1a242e5
, we have to use a different
selector to query the definition for constants, "pre.const" instead of
".docblock.type-decl".
This commit is contained in:
parent
19398e340c
commit
f0245bada3
@ -12,6 +12,7 @@ SPDX-License-Identifier: MIT
|
||||
- Improve the documentation parser:
|
||||
- Fix the definition of methods to only contain the actual definition.
|
||||
- Remove spurious members in module documentation.
|
||||
- Show the definition for constants.
|
||||
|
||||
## v0.1.2 (2020-07-25)
|
||||
|
||||
|
@ -129,10 +129,10 @@ fn get_example(node: &kuchiki::NodeRef) -> doc::Example {
|
||||
pub fn parse_item_doc(item: &doc::Item) -> anyhow::Result<doc::Doc> {
|
||||
log::info!("Parsing item documentation for '{}'", item.name);
|
||||
let document = parse_file(&item.path)?;
|
||||
let definition_selector = if item.ty == doc::ItemType::Function {
|
||||
"pre.fn"
|
||||
} else {
|
||||
".docblock.type-decl"
|
||||
let definition_selector = match item.ty {
|
||||
doc::ItemType::Constant => "pre.const",
|
||||
doc::ItemType::Function => "pre.fn",
|
||||
_ => ".docblock.type-decl",
|
||||
};
|
||||
let definition = select_first(&document, definition_selector)?;
|
||||
let description = select_first(&document, "#main > .docblock:not(.type-decl)")?;
|
||||
|
Loading…
Reference in New Issue
Block a user