AdaCore / gnatstudio

GNAT Studio is a powerful and lightweight IDE for Ada and SPARK.
399 stars 52 forks source link

gnatdoc: Unexpected reappearance of previous parameter for custom tags present in the same line #166

Closed mgrojo closed 5 months ago

mgrojo commented 1 year ago

Given this input:

--/ The @a pixel array is assumed to contain 32-bits RGBA pixels,
--/ and have the given @a width and @a height. If not, this is
--/ an undefined behaviour.
--/ If @a pixels is null, an empty image is created.

And this tag definition:


class ATagHandler(GPS.InlineTagHandler):
    def __init__(self):
        super(ATagHandler, self).__init__('a')

    def has_parameter(self):
        return True

    def to_markup(self, writer, parameter):
        writer.html(' <em>%s</em> ' % parameter)

The expected output is:

The pixel array is assumed to contain 32-bits RGBA pixels, and have the given width and height. If not, this is an undefined behaviour. If pixels is null, an empty image is created.

But the actual output is:

The pixel array is assumed to contain 32-bits RGBA pixels, and have the given width and width height. If not, this is an undefined behaviour. If pixels is null, an empty image is created.

Note the spurious inclusion of width where only height is placed in the source. It happens for all the custom tags that appear more than once in the same source line. This is why pixels and pixel are not repeated.

The problem can be observed here:

https://mgrojo.github.io/ASFML/doc/docs/sf__graphics__image___spec.html#L77C13

Reproduced with GNAT Studio 2021 and https://github.com/AdaCore/gnatstudio/releases/tag/gnatstudio-cr-20230501

AnthonyLeonardoGracio commented 5 months ago

Hello,

We have recently revamped GNATdoc: it's now based on Libadalang. We will have look, maybe this issue is not present anymore with the latest version. Keeping you posted.

Regards,

godunko commented 5 months ago

Hello,

We strongly recommend to use new generation of the GNATdoc tool. It will be available in the next GNAT Studio public release on GitHub, as well as Alire crate at some point.

New GNATdoc will support many Markdown formatting features, you don't need to use custom plugins for formatting of the italic/bold/monospace inline text, but can use corresponding Markdown features (emphasis/strong emphasis/code span).