You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "junichi11 (via GitHub)" <gi...@apache.org> on 2023/03/12 03:41:20 UTC

[GitHub] [netbeans] junichi11 commented on issue #4869: Twig Indenting code format, not indenting correctly

junichi11 commented on issue #4869:
URL: https://github.com/apache/netbeans/issues/4869#issuecomment-1465083975

   Unfortunately, we can't fix this case from the twig module.
   ```twig
   <div class="container">
       {% if nextmemberid == ''%}
           <form action="{{ route('accmember',{_memberid:currentmember.memberid}) }}" method="POST">
               <input type="hidden" name="memberid" value="{{ currentmember.memberid }}">
       {% else %}
           <form action="{{ route('accmember',{_memberid:nextmemberid}) }}" method="POST">
               <input type="hidden" name="memberid" value="{{ nextmemberid }}">
       {% endif %}
           </form>
   </div>
   ``` 
   
   If you close the HTML tag, maybe it works correctly. 
   e.g.
   ```twig
   <div class="container">
       {% if nextmemberid == ''%}
           <form action="{{ route('accmember',{_memberid:currentmember.memberid}) }}" method="POST">
               <input type="hidden" name="memberid" value="{{ currentmember.memberid }}">
           </form>
       {% else %}
           <form action="{{ route('accmember',{_memberid:nextmemberid}) }}" method="POST">
               <input type="hidden" name="memberid" value="{{ nextmemberid }}">
           </form>
       {% endif %}
   </div>
   ``` 
   As a workaround:
   Please use variables. **NOTE** I'm not an expert of twig.
   ```twig
   {% if nextmemberid == ''%}
       {% set example = 'foo' %}
       {% set value = 'a' %}
   {% else %}
       {% set example = 'bar' %}
       {% set value = 'b' %}
   {% endif %}
   
   <form action="{{ example }}" method="POST">
       <input type="hidden" name="memberid" value="{{ value }}">
   </form>
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists