diff --git a/CHANGELOG.md b/CHANGELOG.md index 948fae2..01ca2fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/src/parser.rs b/src/parser.rs index cf2af5d..3f23780 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -129,10 +129,10 @@ fn get_example(node: &kuchiki::NodeRef) -> doc::Example { pub fn parse_item_doc(item: &doc::Item) -> anyhow::Result { 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)")?;