How to make Netbeans recognize custom HTML attributes? - html

In netbeans (7.1.2) when adding a custom attribute to an HTML element, for example data-dismiss="modal I get a warning 'data-dismiss not allowed on element...'. Is it possible to add custom HTML attributes to Netbeans, making it aware of these attributes and not give a warning?
I've looked thoroughly through all menu options and configuration. I would expect something like 'add attribute to dictionary'

Related

Is it possible to use custom elements with .Net Web Forms controls?

When creating a custom element with a '-' in the tag name and using the attribute runat="server", the server tag is not well formed error appears when loading the page.
This is using Asp.Net 4.7. When you remove the hyphen in the tag, you have no issues or if you remove the runat="server" you have no issues.
<depth-chart runat="server" ></depth-chart>
I would expect this to run as is but .NET is not having that hyphen, a requirement for a custom element to be recognized by the browser. I'd like to be able to keep the dash and the runat attribute so that this custom element can be fiddled with on the .ascx and the .ascx.cs.
I ended up solving this by working around the parser on the .ascx file.
In the .ascx.cs file you can create a generic element with you own custom tag and the parser will not complain.
HtmlGenericControl depthChart = new HtmlGenericControl("depth-chart")
I added this control to the front with a <asp:Placeholder> as the parent.

VS Code - How to enable Html tag attribute display

I am new to VS Code and using it for Html editing. Is there a way to have the IDE show me a list of the attributes available for an Html tag? I do get Intellisense when I am typing a tag name and it will auto-close the tag, but there doesn't seem to be support for displaying the attributes specific to the tag. I can use Ctrl-Space to display a universe of attributes, but I'm looking for a list of the attributes from the official Html reference. Or maybe a tag-level help pane where it would display the tag information, including purpose, usage, attributes, etc.
Without installing an extension, I am getting a list of attributes when I press Ctrl+Space while inside an open tag like this <p.
There must be a space after the <p, so the tag name must be complete and the cursor separated from it by a space. If the cursor is still on the tag name, VSCode tries to autocomplete the tag name when pressing Ctrl+Space.
In VS Code it is showing attributes available in an HTML tag but it fails when showing/suggesting values for a specific tag. For that purpose, I am using this extension called "HTML CSS Support" by ecmel. But for the scenario mentioned in this question, You can get it done with #C14L 's answer. There may be other good extensions but this is the one I have tried and it works perfectly.

Fixing a PDF Accessibility Issue (Alternative description missing for an annotation) when converting an HTML Page to PDF

Currently, I am working on a program that converts an html page into a PDF using the iText Library.
The Checker that I am using is PAC3 -->PDF Accessibility Checker 3 which is described by the following link (https://section508.gov/blog/check-pdf).
One of the issues is the “Alternate description missing for an Annotation”
An excerpt from the following link explains it:
http://www.uottawa.ca/respect/sites/www.uottawa.ca.respect/files/fss-fixing-accessibility-errors-in-pdfs.pdf
Alternative description missing for an annotation This usually happens when the link is not clear enough. To fix this error, add alternative text to the link tags. To add the alternative text, please do the following;
In the tag tree, select the tag for the link, and select Properties
from the options menu.
In the Touchup Properties dialog box, select
the Tag Tab.
Type alternate text for the link, and click close
I have been trying to use iText to fix this problem, but googling, looking at the source and reading the documentation does not help.
Does anybody have any suggestions on how to either write the HTML or use the itext problem to get rid of the “Alternate description missing for an Annotation”
Thank you for your help
You did not specify whether you using old code (XMLWorker, HTMLWorker) or new iText code (pdfHTML).
This of course impacts the proposed solution.
In my answer I am going to assume you are using pdfHTML
There are several options:
edit the incoming HTML using a library like JSoup
convert the incoming HTML to iText IElement objects, and edit those, setting properties where needed
write your own custom TagWorker that handles all instances of a specific tag, and write custom logic to deal with the missing annotations.
An example of a custom tag worker can be found here:
https://developers.itextpdf.com/content/itext-7-examples/converting-html-pdf/pdfhtml-custom-tagworker-example

How to register custom html tags in Resharper?

I would like to use custom tags in my html files to include custom knockout components [1]:
<like-widget params="value: userRating"></like-widget>
I added the tag to the VisualStudio html formatting settings:
Tools > Options > Text Editor > HTML (Web Forms) > Formatting > Tag
Specific Options
Resharper still does not recognize the custom tag and gives the warning
Cannot resolve tag "like-widget"
How do I tell Resharper to allow that specific tag without disabling the unknown tag warning? Is there some sort of setting file where I can register custom html tags?
Related article:
How to add custom HTML Tags to Visual Studio and Avoid Squiggly Lines
It is not possible right now - there is a related ticket https://youtrack.jetbrains.com/issue/RSRP-434190.
I would suggest to Disable the Inspection for Unknown HTML Tags as I indicated here:
Can I stop ReSharper objecting to Ionic HTML tags?

Eclipse - how to extend HTML editor to add custom tags?

I write an application and inside of HTML code I have custom tags (of course these tags are parsed on server side and end user gets them as valid HTML code). Example of custom tag usage:
<html>
<body>
...
<Gallery type="grid" title="My Gallery" />
...
</body>
</html>
1.) How can I have eclipse recognize my custom tags inside of HTML code and add syntax highlighting to them?
2.) How can I add auto-suggestions to my custom tags? For example if I type "<Gallery " press "Ctrl+Space" - in the list of available attributes it shows me "type" and "title" and if I type "<Gallery type=" press "Ctrl+Space" I would see list of available values only for tag "Gallery" and its attribute "type".
Thanks in advance!
Not really what you want, but maybe it helps you:
You can try the Aptana Plug-in for Eclipse. It allows to write your own regular expression for HTML validation, so a custom tag would be ignored by the validator.
E.g.:
.gallery.
Eclipse allows you to add simple auto-suggestions via Templates. On
Eclipse 3.7.1 (Indigo) + PHP Dev Tools (PDT) 3.0.0: Window > Preferences > Web > HTML Files > Editor > Templates
Sadly, there is no easy way: you have to roll your own parser for this, and then add both your extra elements and the base grammar (HTML) to it.
If you have your parser, you could use it to do syntax highlighting (strictly speaking, for that simple lexing is enough); and a good parser can support content assist (auto-suggestions in your terminology).
Caveats:
Creating a parser for HTML is not an easy task. Maybe by aiming at a more often used subset is feasible.
If a parser exists, the editor parts are still hard to get well.
Some help on the other hand: you could use some text editor generators to ease your work:
Eclipse IMP http://www.eclipse.org/imp/ can in theory handle any type of parser, but currently it is most optimized for LPG. The documentation is scarce, but the developers are helpful in the forums.
Xtext http://www.eclipse.org/Xtext/ got quite a hype for creating text editors for DSLs. The generated editors are quite nice out of the box, but is not the best solution for large files. Has a really helpful developer community.
EMFText http://www.emftext.org/index.php/EMFText is a lesser known entity - I don't know it in details, but I guess, it is similar to Xtext.
I know its been a long time since this Q was asked,
but I hope this might help others like myself that reach this in search of a solution.
So, When using Eclipse (Mars.1 Release (4.5.1) - and possibly earlier - I did not check).
Go to Window - Prefrences
Then in the dialog that opens go to Web - HTML Files - Editor - Validation.
On the right side:
under Ignore specified element names in validation and enter the list of custom elements you use. (e.g. Gallery,tab,tabset,my-element-directives-*)
you might also like to go under Ignore specified attribute names in validation do the same for your custom attributes.(e.g. ng-*,my-attr-directives-*)
Two things to note:
After letting eclipse do a full validation you must also close the file and reopen it to have the warnings removed from the source code.
Using this method would ignore those attributes under any element. I don't think there is a simple way to tell it to ignore some-attribute only if its a child of some-element.
I find templates are an ok alternative but let's see if we can encourage a more robust solution; please take a moment and vote for this: https://bugs.eclipse.org/bugs/show_bug.cgi?id=422584
You need to add a new HTML template.To add a new template, complete the following steps:
1) From the Window menu, select Preferences.
2) In the Preferences page, select Web and XML > HTML Files > HTML Templates.
3) Click New.
4) Enter the new template name and a brief description of the template.
5) Using the Context drop-down list, specify the context in which the template is available.
6) In the Pattern field, enter the appropriate tags, attributes, or attribute values (the content of the template) to be inserted by content assist.
7) If you want to insert a variable, click the Variable button and select the variable to be inserted. For example, the word_selection variable indicates the word that is selected at the beginning of template insertion, and the cursor variable determines where the cursor will be after the template is inserted in the HTML document.
8) Click OK to save the new template.
You can edit, remove, import, or export a template by using the same Preferences page.
Reference : http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.wst.sse.doc.user%2Ftopics%2Ftsrcedt024.html