Include @ in ASDoc comments without any errors?

谁说胖子不能爱 提交于 2019-12-13 02:13:02

问题


If you have the @ symbol in your ASDoc, the code will compile, but the generator for the ASDoc will yell out an unintelligible error message.

/**
 * Removes the following characters which are forbidden:
 *    @/\"#$%&'()*:;<=>!?
 */
public function removeForbiddenChars(str:String):String

Is there any way to include the @ symbol in your ASDoc without an error being thrown?


回答1:


According to documentation by Adobe:

ASDoc passes all HTML tags and tag entities in a comment to the output. Therefore, if you want to use special characters in a comment, enter them using HTML code equivalents. For example, to use a less-than (<) or greater-than (>) symbols in a comment, use &lt; and &gt;. To use the at-sign (@) in a comment, use &#64;. Otherwise, these characters are interpreted as literal HTML characters in the output.

Although not mentioned in the documentation,a fourth symbol that is not allowed is &, and must be replaced by &amp;.

So, if one were to follow these instructions for the example ASDoc:

/**
 * Removes the following characters which are forbidden:
 *    &#64;/\"#$%&amp;'()*:;&lt;=&gt;!?
 */
public function removeForbiddenChars(str:String):String

It may not be clear when looking at the comment in your editor, but it will be clear once the ASDoc has been compiled into HTML. Perhaps one could phrase the comment in such a way that the special characters aren't used:

Removes /\"#$%'()*:;=!? as well as the 'at' symbol (&#64;), the ampersand symbol (&amp;), the 'less than' symbol (&lt;), and the 'greater than' symbol (&lt;)


来源:https://stackoverflow.com/questions/23596310/include-in-asdoc-comments-without-any-errors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!