How do you escape curly braces in javadoc inline tags, such as the {@code} tag

前端 未结 1 1793
日久生厌
日久生厌 2021-02-11 13:50
/**
 * Gets the meatball icon for a nincompoop.
 * 
 * 

* Example: {@code nincompoop=\"${person}\" />}

相关标签:
1条回答
  • 2021-02-11 13:56

    Not so much an answer as a workaround, but if you replace {@code ...} with the old version <code>...</code> it will render curly braces how you expect.

    <code>{person} == ${person}</code>
    

    Unfortunately, this breaks angle brackets, so to the original question you need to escape these:

    <code>&lt;custom:meatball color="&lt;%= Meatball.RED %&gt; nincompoop="${person}" /&gt;</code>
    

    You can even cheat here by getting Notepad++ to do that for you, with the handy TextFX -> convert -> Encode HTML (&<>").

    This does at least have the benefit that everything renders nicely both in the generated Javadoc and in Eclipse in the Javadoc view, which doesn't appear to understand &#125; and friends.

    0 讨论(0)
提交回复
热议问题