I am developing a dojo application in Netbeans 7.1, however since dojo uses non standard HTML attributes, I have XHTML validation errors in every line.
Within Netbeans there is the option to completely ignore this errors for a specific line or for the whole document, bu I would like to keep basic html validation on.
Is it possible to have this errors ignored without loosing html validation ?
Dojo supports also valid data- HTML attributes, use those:
data-dojo-config not djConfig, e.g.: data-dojo-config="parseOnLoad:true,async:true"
data-dojo-type instead of dojoType
data-dojo-props e.g.: data-dojo-props="name:'start_date',required: true"
data-dojo-attach-point in widget templates
data-dojo-attach-event in widget templates
data-dojo-id instead of jsId
Edit: Since data-* attributes are valid only in HTML5 and NetBeans validates documents according to doctype you can also fine-tune validation via menu Tools » Options » Editor » Hints » HTML. There turn off or change Show As of Elements. You will need to reopen html documents to apply new validation rules
Related
My editors want to have an ability to edit raw html within editor.
For example, we can have simple list markup:
<ul>
<li>Some text<li>
</ul>
Or with custom classes and event tags:
<ul>
<li class="my_class">Some text
<span class="special">Some additional info</span>
<li>
</ul>
And so on.
I know that built-in Draftail doesnt support html editing.
But using third-party editor comes with problem:
Losing integration with system. For example, i cant just put image like with draftail. Or, preview mode cant handle all functionality of third-party editor.
So, maybe someone has working solution for this situation.
I thought about using special StreamField panels, but it seems to be overhead of blocks. Dont like this idea of having lots of blocks with little differences
Wagtail does not support raw HTML editing within the page editor out of the box intentionally. The philosophy (zen) of Wagtail is to help editors and developers 'wear the right hat' when working in Wagtail.
HTML editing is usually best provided to developers, where there is an expected knowledge of what is required for things like accessibility, security and the benefit of tooling (like git).
However, if HTML editing is a must, you will probably need to build your own editor field for that purpose or find a suitable package that works with HTML markup such as django-markupfield. Adding image/snippet/page chooser functionality however will have to be built for whatever you end up using. You may also want to look at the Wagtail markdown package either as an alternative to HTML or a starting point, it allows for a syntax of linking to pages/images.
Wagtail lets you use any kind of Django field or widget with the FieldPanel.
Please ensure you consider all the risks when implementing this feature, such as accessible HTML (e.g. heading levels), security (disallow some tags such as script tags), malformed HTML leaking into the rendered template and of course the end user experience.
At the end i made my own solution
Simple rewrite some methods in wagtail`s Html DbWhiteLister and HtmlConverter.
This gives me an opportunity to allow any tags with any attributes.
https://github.com/Chenger1/wagtailtinymce.-Full-Rich-Text-Editor
It seems sometime to work fine and sometimes not, so in should I use divs inside form or not?
and in general is there a guide for what HTML tags will not work inside other tags?
Divs do not cause any intrinsic problems inside forms. Any CSS rules or JS that might get applied to them may cause problems, but the same is true of any element.
The HTML 4.01 specification includes a guide on how to read DTDs. This is applicable for HTML 3.2 and 4.x as well as XHTML 1.x. HTML 5 does not have an official DTD, so you have to pay attention to the "Content model" for each element in the spec.
Is it possible to include gwt tags into gsp page. I've installed gwt grails plugin but I haven't been able to achieve this yet.
Its possible to include dojo tags into gsp page after u install the dojo grails plugin
I think you're mixing up the context where these tags are supposed to be used.
GSP tags are for creating a server-side template that will be rendered and sent to the browser as completed HTML. GWT's ui:binder tags are for creating a template that's compiled by GWT and used to generate a page on the client-side within the browser. They operate in two different realms.
I use Eclipse and I write jsp files with HTML5 content.
So I have for example this line:
<div class="test" data-role="test123">
In Eclipse I get the warning:
Undefined attribute name (data-role)
What needed to be done so these warnings won't appear anymore? In HTML5 this attribute is allowed (data-*) as you can see here: http://ejohn.org/blog/html-5-data-attributes/
It seems like Eclipse still has some problems validating HTML5 elements and attributes even now.
I'm running Mars 4.5.1 and I have had warnings about the <main> element, despite the fact that there are no warnings about the <section> element.
But there is a solution!
Window > Preferences > Web > HTML Files > Validation
Here you can tick the Ignore specified element names in validation checkbox and enter the names of any elements which Eclipse is incorrectly warning you about.
In your case, you will want to tick the Ignore specified attribute names in validation checkbox and enter the data-role attribute.
After you click 'Apply', Eclipse will ask you to do a full validation of the project. Select 'Yes' and the changes will take effect.
No more squiggly yellow lines YAY! :D
Your doctype
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
is for HTML 4.01.
data-* attributes were added in HTML 5. The doctype for HTML 5 is basically either
<!DOCTYPE html SYSTEM "about:legacy-compat">
or
<!DOCTYPE html>
Newer versions of Eclipse support HTML5 tags and the data-* attributes allowed in HTML5. However, when using the role attribute the proper syntax according to the ARIA Roles Model and XHTML Role Attribute Module is not to prefix the role attribute with data-* leaving just role and not data-role.
So <ul role="menubar"> is more correct than <ul data-role="menubar">. The validity of the syntax can be checked using the (X)HTML5 Validator. jQuery Mobile uses quite extensively the data-role attribute, though I'm not sure why.
Note: If you upgrade and you're still getting warnings on data-* attributes you may want to consider updating or removing any installed syntax-checkers such as JTidy. As of Indigo Service Release 1 the role attribute continues to trigger an undefined attribute warning in Eclipse by default.
I used this one with Aptana 3.6 when I'am coding AngularJS
Window > Preferences
I use the Aptana Studio plugin on Mac OS X; if I go Eclipse > Preferences > Aptana Studio > Validation > HTML, and create the filter *data-role* I no longer get this warning.
I believe on Windows it is Window > Preferences > Aptana Studio > Validation > HTML
Eclipse 3.6 introduced a new field under:
Validation -> HTML Syntax: Ignore specified attribute names in validation
Add the OpenGraph, RDFa or other non-HTML5 attributes you want the validator to ignore:
You will need to re-validate the project, then the warnings will be gone.
Eclipse observes the DOCTYPE declaration. In my case, the solution was using the code above at the first line of the files containing HTML code:
<!DOCTYPE html>
Related to that, there's this other question, already answered:
Why do we need DOCTYPE to the HTML/JSP pages?
I'm working on a Website with Struts2 and Freemarker.
Whenever I add form tags such as:
<#s.form action="foo">
<#s.combobox (...)/>
It generates a bunch of html/css/javascript that I don't need.
Is there any way I can specify that no extra elements should be generated or do I really need to go into Freemarker.jar and edit the templates to my liking?
Have you read about "themes" in struts2 tags ?
http://struts.apache.org/2.x/docs/why-do-the-form-tags-put-table-tags-around-controls.html
http://struts.apache.org/2.x/docs/themes-and-templates.html