This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 235633 - Multiple files with parsing error on wordpress and prestashop CMS
Summary: Multiple files with parsing error on wordpress and prestashop CMS
Status: RESOLVED FIXED
Alias: None
Product: web
Classification: Unclassified
Component: HTML Editor (show other bugs)
Version: 7.3.1
Hardware: PC Windows 7
: P2 normal with 1 vote (vote)
Assignee: Marek Fukala
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-07 06:42 UTC by Zicguy
Modified: 2013-09-23 12:01 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zicguy 2013-09-07 06:42:46 UTC
Hello,
There is multiple files which have parsing errors (red icon) on wordpress and prestashop CMS. Most often are javascript errors. These parsing errors are not justified because source codes works without any problems. I have tested on Netbeans 7.3, 7.3.1 and 7.4 beta and the same behavior happens.

To reproduce, just open Netbeans, create a new PHP project and import original wordpress or prestashop CMS. Parsing errors will appears.

These errors doesn't appears on other IDE like Eclipse.
It's a shame to have these parsing errors because I can't use Netbeans if it shows some errors which doesn't exists.

Can you correct these issues for the next release of Netbeans please?
Comment 1 Tomas Mysik 2013-09-09 04:55:12 UTC
Reassigning, please evaluate. Thanks.
Comment 2 Petr Pisl 2013-09-09 07:39:09 UTC
I have downloaded wordpress 3.6 and opened in the NetBeans 7.4. In project navigator there is one file with red exclamation mark icon (wp-include/js/thickbox.css).

Please try with the latest build and let me know. You can download the latest NB 7.4 build here: http://bits.netbeans.org/download/trunk/nightly/latest/ . Thanks.
Comment 3 Zicguy 2013-09-09 11:48:48 UTC
Thanks for your feedback,
I just tried with the latest build. Effectively, a red exclamation mark icon appears on wp-include/js/thickbox.css. In my opinion, it shouldn't appears as an error cause "expression" is a function in CSS. It allows managing some cases on IE (mostly the version 6), that's why some jquery plugins uses it.
Another point, it seems you didn't test the latest Prestashop CMS version. Many errors appears with this CMS (mostly javascript errors in tpl file).

Thanks to take this comment in account. Have a good day.
Comment 4 Petr Pisl 2013-09-10 06:25:52 UTC
Marku, could you please look at the css part? I have seen that you solved recently similar issue. Thanks
Comment 5 Marek Fukala 2013-09-10 06:59:38 UTC
The wordpress problem is desrcibed in the issue 230042, unfortunately not yet fixed. Passing back to Petr.
Comment 6 Petr Pisl 2013-09-10 07:09:45 UTC
I have opened Prestashop CMS, there are some problem in css files again. Mareku, could you look at this as well?

But regarding the tpl files, there are some tpl files that have extension .php, which is wrong IMHO. These files are treated as php and not tpl files. If you want to threat them as tpl files you have to set up in Tools->Options->Miscellaneous->Files tab TPL mimetype for all php files. Then php files will be also tpl files, which is basically wrong, because the php files shouldn't have tpl syntax inside. 

I have notice one more issue in tpl: issue #235733
Comment 7 Petr Pisl 2013-09-10 07:34:12 UTC
I wen't trough all files that are marked with red icon in Prestashop CMS. The red marked files are html, css, php files that contains Smarty and tpl files that suffer with issue #235733 or there is issue in css, where is used Smarty. So from javascript point of view it's clean. 

So if you want to fix issue #235733, please increase the priority to P2. 

Marku the metioned problem in tpl file with css is this one:

<table
  {if $table_id} id={$table_id}{/if}
				class="table {if $table_dnd}tableDnD{/if} {$list_id}"
				cellpadding="0" cellspacing="0"
				style="width: 100%; margin-bottom:10px;">

It looks like the line with id cause the problem. Reassigning back to css.
Comment 8 Marek Fukala 2013-09-10 07:41:19 UTC
> So if you want to fix issue #235733, please increase the priority to P2. 
No, it is P3 on purpose.

> 
> Marku the metioned problem in tpl file with css is this one:
> 
> <table
>   {if $table_id} id={$table_id}{/if}
=> marfous
Comment 9 Martin Fousek 2013-09-11 07:36:41 UTC
(In reply to Marek Fukala from comment #8)
> > Marku the metioned problem in tpl file with css is this one:
> > 
> > <table
> >   {if $table_id} id={$table_id}{/if}
> => marfous

Sorry for the reassignment back, but Smarty is probably not able to do here more, the generated source:
  @@@ id=@@@
	class="table @@@tableDnD@@@ @@@"
	cellpadding="0" cellspacing="0"
	style="width: 100%; margin-bottom:10px;">

Once there are completed quotes around the ID attribute, CSS doesn't complain about any issue. This looks to me that CSS is not able to handle unquoted fake value @@@. Feel free to reassign back if I'm wrong, thanks.
Comment 10 Marek Fukala 2013-09-11 09:10:10 UTC
(In reply to Martin Fousek from comment #9)
> (In reply to Marek Fukala from comment #8)
> > > Marku the metioned problem in tpl file with css is this one:
> > > 
> > > <table
> > >   {if $table_id} id={$table_id}{/if}
> > => marfous

There's no problem with CSS, but the html lexing is incorrect for the sample code. 

The html lexer sees the input as continuous sequence of characters.  What appears in the sequence is determined (correctly) by the TPL lexer. 

The html lexer in this cases sees <table id= class="table... which means the class is considered as the value of the id attribute (correctly according to html spec). 

If there was a way how to detect the "gap" which is not visible in the html lexer input, then I could do some magic in the html lexer and lex the class as an attribute and not as the attribute value as it is now. However currently it seems to be impossible to detect that situation.

I've separated this problem in issue Bug 235794 - Incorrect html lexing of attribute if an upper level language construct present in the tag
Comment 11 Marek Fukala 2013-09-11 09:29:42 UTC
Another css issue I found is:

div {
min-height:80px !ie;
}

is not parseable: filed as Bug 235798 - !ie hack support
Comment 12 Marek Fukala 2013-09-11 09:43:48 UTC
Some of the parsing issue are valid code bugs like:

prestashop/admin/themes/default/css/admin.css:132:

.table{ background-color:#fff;border:1px solid #ccc;padding:0: border-radius:3px; -moz-border-radius:3px;-webkit-border-radius:3px;}

typo after padding:0 - colon instead of semicolon.
Comment 13 Marek Fukala 2013-09-11 09:47:01 UTC
Another issue:  <div id="#id"></div> ... #id marked as erroneous - filed as Bug 235799 - <div id="#id"></div>marked as erroneous
Comment 14 Marek Fukala 2013-09-11 10:01:04 UTC
Then finally plenty of errors in html files under prestashop/mails and modules. There are caused by presence of some {...} notation in both html and css code. For example in the prestashop/mails/en/account.html there's following code:

<td align="left">Hi <strong style="color: {color};">{firstname} {lastname}</strong>,</td>

The values delimited by the curly braces are not recognized by the html editor and hence causing issues mainly in the embedded css code.

The notation looks like smarty custom functions, and seems to be a part of some templating method. 

But I'm not sure about that, passing to Martin for further evaluation. You may refer to [1] for more information.

[1] http://doc.prestashop.com/display/PS15/English+documentation
Comment 15 Martin Fousek 2013-09-11 13:24:03 UTC
Reporter do you know whether the {string} statements are of any specific language?

BTW, I saw something like this in its sources:
$vars = array(
'{firstname}' => $this->datas->admin_firstname,
...
'{shop_url}' => Tools::getHttpHost(true).__PS_BASE_URI__,
);
$content = str_replace(array_keys($vars), array_values($vars), $content);

Which probably means that it's custom "templating system" used by the CMS and we are not easily able to handle it. In any case Smarty values must be prefixed as a common PHP variables with the "$". Switching rest of the issue to the enhancement to HTML.

Probably there could be general HTML support to disable validations at the file or even folder, but it has to be evaluated by Marek whether there is something like that possible.
Comment 16 Zicguy 2013-09-11 13:41:34 UTC
Martin,
In my opinion, {string} statements are not a specific language. In prestashop CMS, those are used to give some variables to email template for example. HTML files are just parsed and PHP replace {string} statements  by values.
So, {string} is not the smarty syntax (different of {$string}).
Let me know if you need more information.
Comment 17 Martin Fousek 2013-09-11 13:49:15 UTC
(In reply to Zicguy from comment #16)
> Martin,
> In my opinion, {string} statements are not a specific language. In
> prestashop CMS, those are used to give some variables to email template for
> example. HTML files are just parsed and PHP replace {string} statements  by
> values.
> So, {string} is not the smarty syntax (different of {$string}).
> Let me know if you need more information.

Thanks. That's exactly what I thought/wrote. So the only way I see would be to disable validation per file/folder probably.
Comment 18 Marek Fukala 2013-09-11 13:53:55 UTC
Closing the issue then. The individual issues were filed already.
Comment 19 Zicguy 2013-09-11 14:08:26 UTC
Martin,

Maybe HTML parser can also ignore {string} statement, no?
Else, is there an actual way to disable validation per file/folder?

Thanks.
Comment 20 Martin Fousek 2013-09-12 07:05:38 UTC
(In reply to Zicguy from comment #19)
> Maybe HTML parser can also ignore {string} statement, no?

But how would you like to generally specify something like this? ;) That's not proper way.

> Else, is there an actual way to disable validation per file/folder?

I don't think so, that should be subject of this RFE.
Comment 21 Marek Fukala 2013-09-12 08:31:50 UTC
(In reply to Martin Fousek from comment #20)
> (In reply to Zicguy from comment #19)
> > Maybe HTML parser can also ignore {string} statement, no?
> 
> But how would you like to generally specify something like this? ;) That's
> not proper way.
> 
> > Else, is there an actual way to disable validation per file/folder?
> 
> I don't think so, that should be subject of this RFE.
There's a way how to disable html validation, which doesn't trigger any errors in this case. As for the css validation - there's a RFE for that filed: Bug 141181 - it should be possible to enable/disable CSS warnings. The issue is added to the nb8 plan.
Comment 22 Zicguy 2013-09-13 16:41:06 UTC
(In reply to Martin Fousek from comment #20)

> But how would you like to generally specify something like this? ;) That's
> not proper way.

Maybe the HTML lexer can detect if there is a {string} statement and "validate it". {string} statements mostly significate the use of a template engine. So, in my opinion, HTML lexer has not to mark them as an error.

(In reply to Marek Fukala from comment #21)

> There's a way how to disable html validation, which doesn't trigger any
> errors in this case. As for the css validation - there's a RFE for that
> filed: Bug 141181 - it should be possible to enable/disable CSS warnings.
> The issue is added to the nb8 plan.

What is the "nb8 plan" and when will it be launched?
Comment 23 Martin Fousek 2013-09-16 04:27:40 UTC
(In reply to Zicguy from comment #22)
> Maybe the HTML lexer can detect if there is a {string} statement and
> "validate it". {string} statements mostly significate the use of a template
> engine. So, in my opinion, HTML lexer has not to mark them as an error.

But sometime templates can use {string} syntax, second time %%string%% one etc. Also hard to say whether {string} couldn't be i.e. a mistake for the #{string} which is Expression Language. In any case keeping the issue on Marek. It's his component and he knows the best what to do here.
Comment 24 Zicguy 2013-09-16 12:10:10 UTC
Can you tell me if corrections will be in the next release of netbeans?
Thanks.
Comment 25 Zicguy 2013-09-23 11:32:14 UTC
Hello,
I just try the 7.4 RC version. It seems this version not includes corrections of this topic. Can you tell me when they will be available? maybe in the 7.4 final version? Thanks.
Comment 26 Marek Fukala 2013-09-23 11:56:57 UTC
As you can see from the statuses of the individual bugs I've filled, not much is fixed yet, even in trunk.

I'm really sorry, but the issue was filled bit late in the development cycle to be fixed in 7.4. The issues will not be addressed sooner than in netbeans 8.0.

Thank you for your valuable feedback, it will not be lost!
Comment 27 Marek Fukala 2013-09-23 12:01:08 UTC
I've filed Bug 236266 [CSS/HTML: add some generic support for templating] for the last problem.