ltabis / rhai-autodocs

Generate Markdown documentation from a `rhai::Engine` instance.
MIT License
3 stars 1 forks source link

If no sections are added then description is ignored #22

Closed Tired-Fox closed 6 months ago

Tired-Fox commented 6 months ago

At the end of parsing sections the last section defined is never added to the list of sections.

This causes the last section to be dropped; including the Description section if an additional section is never provided.

Could add a check at the end of the method and if there are lines in a the current_body add it.

if current_body.len() > 0 {
    sections.push(Self {
        name: std::mem::take(&mut current_name),
        body: Item::format_comments(&current_body[..]),
    })
}
ltabis commented 6 months ago

Nice catch. I always use the ItemsOrder::ByIndex option to test, and since there must be the # rhai-autodocs peprocessor set at the end of the comments it would work anyways ...