在 ASDoc 注释中包含 @ 没有任何错误? [英] Include @ in ASDoc comments without any errors?

查看:25
本文介绍了在 ASDoc 注释中包含 @ 没有任何错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您的 ASDoc 中有 @ 符号,代码将被编译,但 ASDoc 的生成器会发出无法理解的错误消息.

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

有什么方法可以在你的 ASDoc 中包含 @ 符号而不抛出错误?

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

推荐答案

根据 Adobe 文档:

ASDoc 将注释中的所有 HTML 标签和标签实体传递给输出.因此,如果您想在注释中使用特殊字符,请使用等效的 HTML 代码输入它们.例如,要在注释中使用小于 (<) 或大于 (>) 符号,请使用 &lt;&gt;.要在注释中使用 at 符号 (@),请使用 &#64;. 否则,这些字符将被解释为文字 HTML输出中的字符.

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.

虽然文档中没有提到,但不允许使用的第四个符号是 &,并且必须替换为 &amp;.

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

因此,如果要按照示例 ASDoc 的这些说明进行操作:

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

在您的编辑器中查看注释时可能不清楚,但是一旦 ASDoc 被编译为 HTML,就会很清楚.也许人们可以用不使用特殊字符的方式来表达评论:

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;)

这篇关于在 ASDoc 注释中包含 @ 没有任何错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆