Custom indentation rules - netbeans

I develop website on Netbeans IDE.
Currently I'm working with Laravel Framework, and I use the Blade template engine which allow to create loop or conditional statement in HTML views without having to jump from HTML to PHP, then to HTML again, ...
However each of Blade's statement aren't recognize as HTML or PHP object, and so Netbeans doesn't make any indentation of them:
#if($isConnected)
<div id="aDiv">...
#else
<div>...
I'd prefer it looks like:
#if($isConnected)
<div id="aDiv">...
#else
<div>...
Is there a way to teach new indentation rules to Netbeans?

Related

Wagtail. Ability to edit html within editor

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

Netbeans: Syntax Highlighting -- multiple languages per file

The majority of the pages I author contain both HTML and PHP. It would appear that in Netbeans you can have syntax highlighting for one or the other by setting the associated file types.
Coming from Notepad++, I've always taken for granted the fact that I could use php, css, html, javascript all in one file and retain syntax highlighting for all of them.
Is this possible in Netbeans?
I think the answer here is that Netbeans DOES support multiple language, but it will only get it right if there's something hinting at the "inner" language. When I exit PHP with ?> NetBeans tends to format what comes before the next <?php as HTML automatically. Not sure if that is working for you. Maybe you were trying to get highlighting in a string like $output = "<some><html";. I think you can imagine why that second one wouldn't work.
For JS, for example, it seems to look for the <script type="text/javascript">, and stuff inside gets the JS highlighting even if the file type is PHP.
This other question has a great solution for "tricking" Netbeans into rendering your JS output by PHP into being formatted, even when your code doesn't have a <script type="text/javascript"> tag.

Handlebars formatting in NetBeans

I'm using NetBeans as my IDE for a Ember.js project. When I create handlebars templates in my app like below the code highlighting doesn't work correctly.
<script type="text/x-handlebars">
<div>
</div>
</script>
Normally, when I'd select the first div, it and its matching end tag would highlight yellow, but this doesn't work. Since its inside the handlebars script tag both are highlighted red as errors and don't match together. This makes writing complex templates kinda annoying as it can be difficult to pinpoint syntax errors.
Is there anyway to get NetBeans to highlight inside the handlebars tag as if its regular html?
One option, until Netbeans implements this enhancement, is to add the following script tag in index.html immediately after your reference to jQuery:
<script src="js/libs/jquery.js"></script>
<!-- use following line to change script type to 'text/x-handlebars' -->
<script>jQuery('script[type="text/html"]').attr('type', 'text/x-handlebars');</script>
This is a variation of the answer provided by GCoda.
I had the same problem and tried various non satisfying fixes.
In the end I figured the best solution is simply to change the script's type attribute to text/html:
<script type="text/html">
<div>
</div>
</script>
I got same problem. And i just used a some kind of postprocessing, i am using node.js, so i did res.send(data.replace(/type="text\/html"/g,'type="text/x-handlebars"')); on my / page.
I think you can do something similar in you language, and ofcource this is not a fix, just an ugly trick to make developing more easy. Dont keep it in production.

Disable XHTML validation in Netbeans for dojo developing

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

Avoiding struts 2 generated Java scripting and HTML code in <s: form> tag

I'm using struts 2 <s:form> tag. Now I want use design prepared by our design team. So I have to intrigate my struts specific code with normal HTML design. The problem is that the <s:form> tag generates the <table> HTML code and <s:textfield> generating <tr><td><input type='text'></td></tr>.
So my question is how to avoid the generating the HTML code form struts.
if you want avoid struts 2 generated java script or HTML code then use the simple theme.like below
<s:form action="loginAction" theme="simple">
struts2 have different theme and template. you can design your own theme and template by extending the simple theme and providing you own free marker template.