如何在Javadoc内联标签(例如{@code}标签)中转义花括号 [英] How do you escape curly braces in javadoc inline tags, such as the {@code} tag
问题描述
/**
* Gets the meatball icon for a nincompoop.
*
* <p>
* Example: {@code <custom:meatball color="<%= Meatball.RED %> nincompoop="${person}" />}
*
* @author King Cong
*
*/
"$ {person}"部分使用花括号将文档注释打乱.
The "${person}" part breaks the doc comment because it uses curly braces.
推荐答案
答案不算是解决方法,但如果将{@code ...}
替换为旧版本<code>...</code>
,它将使花括号呈现您的期望./p>
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><custom:meatball color="<%= Meatball.RED %> nincompoop="${person}" /></code>
您甚至可以通过使用便利的TextFX-> convert-> Encode HTML(&<>)来让Notepad ++为您做到这一点来作弊.
You can even cheat here by getting Notepad++ to do that for you, with the handy TextFX -> convert -> Encode HTML (&<>").
这至少具有这样的好处,即所有东西都可以在生成的Javadoc和Eclipse的Javadoc视图中很好地呈现,这似乎无法理解}
和朋友.
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 }
and friends.
这篇关于如何在Javadoc内联标签(例如{@code}标签)中转义花括号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!