Bug 191557 - Smarty code formatting
Smarty code formatting
Status: VERIFIED FIXED
Product: php
Classification: Unclassified
Component: Smarty
7.0
PC Windows 7
: P2 (vote)
: 7.0
Assigned To: Martin Fousek
issues@php
: 70_HR_FIX
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-11-02 11:25 UTC by MrDutchy
Modified: 2011-09-06 10:39 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description MrDutchy 2010-11-02 11:25:01 UTC
Code formatting breaks if a {foreach}{/foreach} is involved (maybe more, possibly all block tags). Closing tag is indented one further then its opening tag. The bug affects all html tag indents for the remainder of the file.

<!-- Expected result: !-->
<table>
   {foreach from=$source item=item}
   <tr>
      <td>
         {$item.var}
      </td>
   </tr>
   {/foreach}
</table>

<h1>HTML after</h1>
<p>
  A paragraph
</p>

<!-- Actual result: !-->
<table>
   {foreach from=$source item=item}
   <tr>
      <td>
         {$item.var}
      </td>
   </tr>
     {/foreach}
  </table>

  <h1>HTML after</h1>
  <p>
    A paragraph
  </p>
Comment 1 Martin Fousek 2010-11-26 15:42:10 UTC
Hi MrDutchy, troubles with code formating in Smarty are good known. It's because there wasn't still implemented CodeFormater at all for now. At least I can hide the "Format" button until will be code formating implemented.
Comment 2 Martin Fousek 2010-11-26 17:00:25 UTC
Ok, I removed Format action from the context menu at least for now, you can see it in next dev build: http://hg.netbeans.org/main/contrib/rev/11bd2356ad7b
Comment 3 Martin Fousek 2011-03-27 14:18:19 UTC
Ok, I finally implemented at least some basic indentation support, so your code will be formated properly now...

http://hg.netbeans.org/main/contrib/rev/07429a4ce259
BTW, works since version 1.50 - in dev build for now.


See...
<table>
    {foreach from=$source item=item}
        <tr>
            <td>
                {$item.var}
            </td>
        </tr>
    {/foreach}
</table>

<h1>HTML after</h1>
<p>
    A paragraph
</p>

<!-- Actual result: !-->
<table>
    {foreach from=$source item=item}
        <tr>
            <td>
                {$item.var}
            </td>
        </tr>
    {/foreach}
</table>

<h1>HTML after</h1>
<p>
    A paragraph
</p>
Comment 4 Martin Fousek 2011-03-28 07:53:15 UTC
php.smarty added as a friend of css.editor: http://hg.netbeans.org/web-main/rev/e68e5bfc48af

For proper functionality in NB 7.0 would be needed to transplant this patch into release70 branch.
Comment 5 Marek Fukala 2011-03-28 08:09:14 UTC
reviewed, feel free to integrate
Comment 6 Martin Fousek 2011-03-29 08:11:13 UTC
Integrated into release70:
http://hg.netbeans.org/releases/rev/c27d0c6270a1
Comment 7 Quality Engineering 2011-03-29 08:44:01 UTC
Integrated into 'main-golden', will be available in build *201103290400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/e68e5bfc48af
User: Martin Fousek <marfous@netbeans.org>
Log: added php.smarty as a friend of css.editor - #191557, #188124
Comment 8 Vladimir Riha 2011-04-05 14:30:16 UTC
v.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo