Closed bbottema closed 2 years ago
I suspect this is because the source string contains a % which should be escaped by your library:
Indeed in older versions this is escaped properly:
For completion sake, here's the relevant source Javadoc:
I cannot reproduce the reported behavior of %
being escaped as %%
in 0.9.0 or 0.10.0. Could it be something the custom comment formatter was doing?
The percent character (%) has no special meaning in Javadoc or HTML. The library has no way of knowing the comment will be passed to String.format(), so escaping %
by replacing it with %%
is the application's responsibility.
I found the issue and indeed it's on my side. I escape %s so that it works with Picocli (CLI library), but Therapi calls formatting methods a little differently from 0.9.0 and later versions.
For example Some sentence {@code blah} rest of sentence.
is formatted completely as a CommentText renderText() (if you replace the code element manually, which I do), but in later versions I suppose this changed and the various types of text are extracted before passing the CommentText in chopped up blocks so that now a {@code xxx} block is always parsed and formatted as InlineTag with name "code". And in this formatting function I did not apply the escaping (yet).
Everything works now after I fixed my code formatting implementation.
I suppose that means I can clean up my renderText implementation as well, so it doesn't try to format inline code anymore.
Almost, I can leave out {@code xxx}
but not <code>ccc</code>
. Why are these treated differently?
I understand that these are different Javadoc constructs from a syntax point of view, but from user perspective they should be treated equally, no?
Version 0.11.0 introduces bug.
I'm printing the usage of a command, which works fine up until 0.10.0, but breaks in 0.11.0:
Which results in:
Please let me know if you need anything else. It's not trivial though to show you how the command is produced in my code, which is all automatic with reflection.