playframework / playframework/twirl

`@if` condition bring line feed in scala template

Open
#77 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status:backlog
Dominant language
Scala
Stars
561
Forks
118
Avg merge
1d 15h
Merged PRs (30d)
29

Description

Hi all,

I am facing issue with if conditions in scala template. In the following circumstance, the html will have white spaces and line breaks in between the two divs.

<div>
    content in previous div.
</div>
@if(condition) {
    <div>
        content in next div
    </div>

}

Contributor guide

Open the contributing guide

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.

Research direction

Start by reproducing the Scala template shown in the issue and inspect how Twirl handles whitespace around the @if condition. Confirm the generated HTML output and add coverage for the case; done means the conditional block does not introduce unintended spaces or line breaks between the divs.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.