Skip to content

javadoc HTML parser fails to parse libstdc++ javadoc comments #1125

@mizvekov

Description

@mizvekov

When analyzing source code which uses libstdc++, mrdocs chokes on some of the javadoc comments contained in libstdc++.

Snippet extracted from libstdc++ bits/random.h:

  /**
   * @brief An exponential continuous distribution for random numbers.
   *
   * The formula for the exponential probability density function is
   * @f$p(x|\lambda) = \lambda e^{-\lambda x}@f$.
   *
   * <table border=1 cellpadding=10 cellspacing=0>
   * <caption align=top>Distribution Statistics</caption>
   * <tr><td>Mean</td><td>@f$\frac{1}{\lambda}@f$</td></tr>
   * <tr><td>Median</td><td>@f$\frac{\ln 2}{\lambda}@f$</td></tr>
   * <tr><td>Mode</td><td>@f$zero@f$</td></tr>
   * <tr><td>Range</td><td>@f$[0, \infty]@f$</td></tr>
   * <tr><td>Standard Deviation</td><td>@f$\frac{1}{\lambda}@f$</td></tr>
   * </table>
   *
   * @headerfile random
   * @since C++11
   */
  template<typename _RealType = double>
    class exponential_distribution { /* ... */ }

Here mrdocs produces:

warning: HTML <table> tag not followed by end tag (src/lib/AST/ExtractDocComment.cpp:498) at /../lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/bits/random.h (4872)
warning: unsupported HTML tag <caption>
warning: unsupported HTML tag <td>
warning: unsupported HTML tag <td>

warning: unsupported HTML tag <td>
warning: unsupported HTML tag <td>
warning: unsupported HTML tag <td>
An issue occurred during execution.
If you believe this is a bug, please report it at https://github.com/cppalliance/mrdocs/issues
with the following details:
    MrDocs Version: 0.8.0 (Build: deb3ebfe197f7af887f7bb463e9010ca1a37a36c)
    Reported From: `src/lib/AST/ExtractDocComment.cpp` at line 631

warning: HTML <tr> tag not followed by end tag (src/lib/AST/ExtractDocComment.cpp:498) at /../lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/bits/random.h (4874)

An issue occurred during execution.
If you believe this is a bug, please report it at https://github.com/cppalliance/mrdocs/issues
with the following details:
    MrDocs Version: 0.8.0 (Build: deb3ebfe197f7af887f7bb463e9010ca1a37a36c)
    Reported From: `src/lib/AST/ExtractDocComment.cpp` at line 631

warning: unsupported HTML tag <tt>

So there is a list of issues:

  1. Can't find end tags in multi-line HTML blocks.
  2. Doesn't support <caption>, <td> and <tt> tags.

The first one is more serious since it is an error, as opposed to just a warning.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions