-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XML: Issue with spacing around <programlisting> #8590
Comments
Some analysis. Lets summarize the seen and not seen spaces based on the smaller line:
so we see here the following spaces :
what is the result in the doxygen xml output:
here we see the following:
Interesting to see here is also the result of doxygen's comment conversion, which results in:
i.e.
This is a difficult problem as it looks like the javadoc In the JavaDoc documentation we read:
and
A small experiment, replacing the
So we see that we now have an inline type of output (see the HTML output) and that we don't have a program listing anymore but computer output as output type and that most extra spaces are gone, just a space after the @doxygen should we replace the (The space before the |
I am not really sure (I was more concerned about the space before To make the issue clear more systematically, and make clear I don't bother about adding a white space or not, but rather about information loss.
becomes all the same (almost):
That is information loss. One cannot know which was the original text intended by the author.
I am fine, however, with normalizing double(or more?)-spaces to one, but that's up to you. I think this is the behavior that all other tags already have.
Changing the result to |
The change from replacing
so by introducing The remark: Changing the result to @ doxygen what is your opinion? |
@albert-github I agree that the current implementation is wrong and should not have used I also found an article describing the various ways code fragments can be written in Javadoc: https://reflectoring.io/howto-format-code-snippets-in-javadoc/ |
Would the |
I've created 3 variants based on the current master (1.9.2 (6200bc8*)):
The resulting conversion by means of When just looking at the HTML output the The results: results.tar.gz |
We could probably also treat |
@albert-github in the computeroutput variant there still appears to be a bug:
How does the asterisk in The preformatted/programlisting version looks good to me in terms of spacing! However one cannot distinguish
Nasty things like Would it be feasible to represent |
I did some experiments by myself (using a filter plus an alias) to check out the In the approach with the filter and alias I get issues with unescaped sharp brackets though, e.g. Another pitfall: if unescaped, certain tags may be recognized by doxygen and get tags on xml-level, e.g. |
You mention 3 problems here
I used the following:
And as implementation (commentcnv.l):
use:
and (in rule
use:
Which results in: and the following warnings:
Thus the asterisk problem is solved but the other tags are still interpreted. @doxygen should we use something like |
However, this should not affect autolink functionality (i.e. unlike |
We should then probably have a new internal command for javadoc style processing, i.e. map |
@Stewori |
@doxygen may I suggest to use a neutral name, i.e. not Java-specific, since a command for inline code is probably useful more generally. @albert-github Ithink I once read in the spec that the |
|
Unfortunately (or maybe fortunately) I cannot spot it any more. Probably it was in an old version of the spec. There appears to be a bug fix about this topic: https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4965490 Anyway, in the current spec, the balanced parsing of Stopping at the first While looking at the spec I found that Then, as a side effect this can support the This approach would allow to close #4953 as well. |
This remains a difficult problem. I think we should split the problem in a number of parts
Rationale:
|
+1 on the idea to do this via options, as it is the most modular solution. I am aware that the suggestion to do this in one go with adding |
|
In the JavaDoc documentation we see: ``` {@code text} Equivalent to <code>{@literal}</code>. ``` and ``` {@literal text} Displays text without interpreting the text as HTML markup or nested javadoc tags ``` These commands have been implemented by means of transforming them into doxygen commands. This implementation also: - the `{@literal ..}` command, doxygen#4953 JavaDoc @literal is not recognized (Origin: bugzilla #688386) - doxygen#4949 JavaDoc @code makes a block element instead of inline element (Origin: bugzilla #688381) - doxygen#4952 JavaDoc @code generates link (Origin: bugzilla #688385)
I've just pushed a proposed patch, pull request #8949 |
issue #8590 XML: Issue with spacing around <programlisting>
Code has been integrated in master on GitHub (please don't close the issue as this will be done at the moment of an official release). |
This issue was previously marked 'fixed but not released', |
Describe the bug
Processing Java code
results in the following xml snippet:
Observe that there is never put a space before
<programlisting>
, regardless of whether there originally was a space in the doc comment. In similar manner, there is always put a space after</programlisting>
, regardless of whether there originally was a space in the doc comment. This requires tedious postprocessing to avoid sloppy-looking results. To demonstrate this, consider we render the xml block completely as plain text (<sp/>
is turned into space). One would getNote that this is not due to handling of
<sp/>
. Leaving them in place would yield(I noticed there is also a synthetic space before
</para>
but that one is easy to deal with.)Expected behavior
I expect that the original space characters before and after
<(/)programlisting>
are preserved. No original spaces shall be omitted, no additional "synthetic" spaces shall be introduced.To Reproduce
Find a Java file and doxygen config attached. The issue is demonstrated like mentioned above.
After running doxygen on the example, the files in the subfolder
xml
contain the snippet shown above.issue_programlisting_spacing.zip
Version
Tested with doxygen clone from 2021-05-26:
lsb_release -a
:Additional context
Consider again the plaintext rendering:
In most cases one can repair the spacing based on heuristics. However look at
Path "foo/bar
. There is no way to tell whether it is originallyPath" foo/bar
orPath "foo/bar
, as both sides of"
have uncertain spacing (or lack of it) now. One would have to do an even/odd count on all"
to distinguish opening from closing ones. This can be error-prone on long and complex docstrings and even more so if it were single quotes.While maybe somehow feasible, solving this in postprocessing is a nontrivial and overly complex task.
The text was updated successfully, but these errors were encountered: