Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

css: improve RGB hex color and length matching #142

Merged
merged 2 commits into from Jul 1, 2022
Merged

css: improve RGB hex color and length matching #142

merged 2 commits into from Jul 1, 2022

Conversation

hochhaus
Copy link
Contributor

@hochhaus hochhaus commented Apr 9, 2022

  - Allow RGB hexadecimal colors in multiple formats per the spec. For
    example, all of the following formats are valid.

      #123
      #123456
      #12345678

    https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#rgb_colors

  - Allow decimal lengths without a leading zero. For example, the all of
    the following formats are valid.

      .5em
      0.5em
      0
      1em

    https://developer.mozilla.org/en-US/docs/Web/CSS/length#syntax
@buro9
Copy link
Member

buro9 commented Apr 19, 2022

I'm happy to merge this when the regexp's are made public (I see no reason that they're not public and I default public - see the ones in /helpers.go which are default public.

 - Perform regexp compilation only once by moving all regular
   expressions into global variables.
 - Update regexps to be written as `^...$` with `MatchString()` instead
   of using the `Longest()` with
   `FindString(value) == value && value != ""`.
@buro9
Copy link
Member

buro9 commented Jul 1, 2022

I'm going to merge and rename things 👍

@buro9 buro9 merged commit 5b4be04 into microcosm-cc:main Jul 1, 2022
@hochhaus
Copy link
Contributor Author

hochhaus commented Jul 1, 2022

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants