如何让 Eclipse 接受画布标签?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1216762/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to let Eclipse accept the canvas tag?
提问by DNB5brims
I installed the Aptana plugin in my Eclipse, and I use canvas tag in my html file. I find that the Eclipse can't recognize the canvas tag, it highlight my canvas tags, and display follow msg:
我在 Eclipse 中安装了 Aptana 插件,并在我的 html 文件中使用了 canvas 标签。我发现 Eclipse 无法识别画布标签,它突出显示了我的画布标签,并显示了以下信息:
< canvas > is not recognized
<画布>无法识别
How can I fix this problem? thx in advance.
我该如何解决这个问题?提前谢谢。
回答by Malaxeur
This is most likely coming from the Tidy HTML validator packaged with Aptana's version of Eclipse. If you open the preferences for your HTML browser within Aptana, you can add a regular expression to filter the validation errors.
这很可能来自与 Aptana 的 Eclipse 版本一起打包的 Tidy HTML 验证器。如果您在 Aptana 中打开 HTML 浏览器的首选项,您可以添加正则表达式来过滤验证错误。
This can be done by going to the Window > Preferences dialog window. Then, expand Aptana > HTML and select 'Validation'.
这可以通过转到“窗口”>“首选项”对话框窗口来完成。然后,展开 Aptana > HTML 并选择“验证”。
The filter would probably look like this:
过滤器可能看起来像这样:
.*<canvas> is not recognized.*
.*<canvas> 无法识别。*
回答by kwv
The specific rule under the Aptana>Editors>HTML>Validation filter is
Aptana>Editors>HTML>Validation 过滤器下的具体规则是
.*<\s*canvas\s*> is not recognized.*
.*<\s*canvas\s*> is not recognized.*
Doing something more generic like .* is not recognized.*
lets any Bad Tag in
做一些更通用的事情,比如.* is not recognized.*
让任何坏标签进入
回答by naterkane
The answer, in clear terms, is to go to the HTML>Validation view under preferences as Malaxeursaid (for Aptana2 on OSX it was Aptana Studio>Preferences, then Aptana>Editors>HTML>Validation), and createa newrule that resembles the following.
答案,在明确的条款,是去HTML>下的喜好验证视图MALAXEUR说(为Aptana2 OSX上它的Aptana Studio的>首选项,然后集锦>编辑> HTML>验证),并创建一个新的规则类似于下列。
.* is not recognized.*
that's what worked for me. how or why it works, i can't explain.
这对我有用。它如何或为什么起作用,我无法解释。
回答by Josh Habdas
The error will disappear if using the HTML5 doctype and a more recent version of Eclipse. I'm running Eclipse IDE for Java EE Developers (Build id: 20110218-0911) and do not have this issue.
如果使用 HTML5 文档类型和更新版本的 Eclipse,该错误将消失。我正在为 Java EE 开发人员运行 Eclipse IDE(构建 ID:20110218-0911)并且没有这个问题。
回答by mallo
I think it's already fixed in the current Aptana 3 beta. But in Aptana 2 it's still a problem. To allow not all, but multiple HTML5 Tags you could do it with a filter rule like that:
我认为它已经在当前的 Aptana 3 beta 中修复了。但是在 Aptana 2 中它仍然是一个问题。要允许不是全部而是多个 HTML5 标签,您可以使用这样的过滤规则:
<(nav|header|section|article|canvas)> is not recognized.
Of course there are some more tags to consider. Just add the ones you need.
当然还有更多的标签需要考虑。只需添加您需要的那些。