jaraco / jaraco/cssutils

Calc with internal parentheses being deleted.

Đang mở
#5 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
help wanted
Ngôn ngữ chính
Python
Star
92
Fork
30
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Pardon the unusually high specificity of this bug, but this has been a serious blocker for me, and has cost me most of a day.

Basically, from my research I've found that any line of CSS including parentheses _inside_ a calc statement will be removed. To test, all I'm doing with my CSS currently is parsing and printing it (Using the current v2.2.0 version, ofc):

```
stylesheet = cssutils.parseString(css_contents)
print(stylesheet.cssText.decode("utf-8"))
```

In my findings, even lengthy calcs like this will be left alone: `font-size: calc(15px * 100vw - 600px / 1320);`, but the moment any brackets are introduced it will fail, like this line: `font-size: calc((100vw - 600px) * 10);`.

Functions like this are supposedly meant to be handled according to the [documents linked in the README](https://drafts.csswg.org/css-values-4/#funcdef-calc), look at Example 29 for particulars. Regarding that same example, I've also tried nested calcs in the same fashion, to no avail: `font-size: calc(calc(100vw - 600px) * 10);`.

Basically what I'm asking, is if there's any way for this bug to be fixed or worked around? Ideally, I'd love something I can do today, to either skip validating these lines or to find a way to get them to pass without changing the meaning.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Start with the parseString entry point and reproduce the reported output using the two calc examples, including the nested calc. Compare the parser's handling of parentheses with the CSS Values Level 4 calc examples linked from the README; done means parsing and printing preserves the meaning of these declarations instead of deleting them.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
tooling
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.