Skip to content

Lost fails to parse fractions when the numerator and denominator are separated by spaces around the fraction bar. #435

@Lucassifoni

Description

@Lucassifoni

Bug report

What is the current behavior?
This code sample works fine

.Export {
  &__candidates {
    display: flex;
    flex-wrap: wrap;
    width: 100%;

    & > div {
      lost-column: 1/4;
    }
  }
}

Whereas this one fails to generate proper code.

.Export {
  &__candidates {
    display: flex;
    flex-wrap: wrap;
    width: 100%;

    & > div {
      lost-column: 1 / 4;
    }
  }
}

If it's a bug please provide the steps to reproduce it and maybe some code samples.
Add spaces around the fraction bar / in a lost-column declaration.

What is the desired behavior?
With the above code samples, output should be similar to :

.Export__candidates > div:nth-child(n) {
    margin-right: 8px;
    margin-left: 0;
}
.Export__candidates > div {
    flex-grow: 0;
    flex-shrink: 0;
    flex-basis: calc(99.9% * 1/4 - (8px - 8px * 1/4));
    max-width: calc(99.9% * 1/4 - (8px - 8px * 1/4));
    width: calc(99.9% * 1/4 - (8px - 8px * 1/4));
}

but is :

.Export__candidates > div:nth-child(n) {
    margin-right: 4;
    margin-left: 0;
}
.Export__candidates > div {
    flex-grow: 0;
    flex-shrink: 0;
    flex-basis: calc(99.9% * 1 - (4 - 4 * 1));
    max-width: calc(99.9% * 1 - (4 - 4 * 1));
    width: calc(99.9% * 1 - (4 - 4 * 1));
}

What's the motivation or use-case behind changing the behavior?
Correctness and general ease of use by suppressing syntax-related bugs.

What version of LostGrid, browser and browser version are affected by this issue? Did this happen in previous versions?
Lost 8.3.0, related to codegen, not browser interpretation.

Anything else?
I'd like to tackle this issue, since I enjoyed working on #418

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions