First newline after verbatim and endverbatim tags is not removed

Open
#3,071 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
php
Domain
web-dev

Research direction

Start by reproducing the example in the linked TwigFiddle, comparing the verbatim/endverbatim behavior with autoescape and the documented newline rule. Trace the template-tag handling involved and confirm the fix by matching the expected output shown in the issue, including the newline after the verbatim tag.

Written by the indexing model from the issue text.

Description

Investigate before 4.x

The documentation of Twig says:

The first newline after a template tag is removed automatically (like in PHP).

But this does not work with the verbatim and endverbatim tag:

bar{% verbatim %}
foo{% endverbatim %}
bar
bar{% autoescape %}
foo{% endautoescape %}
bar

=>

bar
foo
bar
barfoobar

https://twigfiddle.com/vtsetc

Dominant language
PHP
Stars
8.4k
Forks
1.3k
Avg merge
1d 13h
Merged PRs (30d)
37

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from twigphp/Twig

All issues in twigphp/Twig

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.