Skip to content

Dedent reports false positive (?) for Inconsistent indentation #413

@Gappa

Description

@Gappa

Version: 3.1.3

Bug Description

I'm currently using a custom template for Contributte/Datagrid, that contains this code:

Note: the exception occurs even if the code below is the only code in the whole template.

{define columnsSummary}

	{foreach $columns as $key => $column}
		{var $td = $column->getElementForRender('td', $key)}
		{do $td->class[] = 'datagrid-table-td'}
		{do $td->class[] = 'datagrid-table-tbody-td'}
		{$td->startTag()|noescape}
			{$columnsSummary->render($key)}
		{$td->endTag()|noescape}
	{/foreach}

{/define}

Screenshot of the exception:

Image

Screenshot of the highlighted code, it uses tabs for indentation:

Image

This code compiles fine:

{define columnsSummary}

	{foreach $columns as $key => $column}
		{var $td = $column->getElementForRender('td', $key)}
		{do $td->class[] = 'datagrid-table-td'}
		{do $td->class[] = 'datagrid-table-tbody-td'}
		{$td->startTag()|noescape}
			{$columnsSummary->render($key)}
{$td->endTag()|noescape}
	{/foreach}

{/define}

This is also ok:

{define columnsSummary}

	{foreach $columns as $key => $column}
		{var $td = $column->getElementForRender('td', $key)}
		{do $td->class[] = 'datagrid-table-td'}
		{do $td->class[] = 'datagrid-table-tbody-td'}
		{$td->startTag()|noescape}
		{$columnsSummary->render($key)}
		{$td->endTag()|noescape}
	{/foreach}

{/define}

Steps To Reproduce

Try to compile the code above with Dedent enabled.

Expected Behavior

Latte code successfully compiles.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions