webcode-tk 1.1.1__tar.gz → 1.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {webcode_tk-1.1.1 → webcode_tk-1.1.3}/PKG-INFO +1 -1
- {webcode_tk-1.1.1 → webcode_tk-1.1.3}/pyproject.toml +1 -1
- {webcode_tk-1.1.1 → webcode_tk-1.1.3}/webcode_tk/__init__.py +1 -1
- {webcode_tk-1.1.1 → webcode_tk-1.1.3}/webcode_tk/cascade_tools.py +15 -3
- {webcode_tk-1.1.1 → webcode_tk-1.1.3}/webcode_tk/color_tools.py +5 -0
- {webcode_tk-1.1.1 → webcode_tk-1.1.3}/webcode_tk/html_tools.py +10 -0
- {webcode_tk-1.1.1 → webcode_tk-1.1.3}/LICENSE.rst +0 -0
- {webcode_tk-1.1.1 → webcode_tk-1.1.3}/README.rst +0 -0
- {webcode_tk-1.1.1 → webcode_tk-1.1.3}/webcode_tk/color_keywords.py +0 -0
- {webcode_tk-1.1.1 → webcode_tk-1.1.3}/webcode_tk/css_tools.py +0 -0
- {webcode_tk-1.1.1 → webcode_tk-1.1.3}/webcode_tk/font_tools.py +0 -0
- {webcode_tk-1.1.1 → webcode_tk-1.1.3}/webcode_tk/sample_report.json +0 -0
- {webcode_tk-1.1.1 → webcode_tk-1.1.3}/webcode_tk/ux_tools.py +0 -0
- {webcode_tk-1.1.1 → webcode_tk-1.1.3}/webcode_tk/validator_tools.py +0 -0
|
@@ -726,6 +726,8 @@ class CSSAppliedTree:
|
|
|
726
726
|
|
|
727
727
|
def __get_filename(self):
|
|
728
728
|
"""Extracts filename from path"""
|
|
729
|
+
if isinstance(self.file_path, dict):
|
|
730
|
+
self.file_path = self.file_path.get("file")
|
|
729
731
|
self.filename = clerk.get_file_name(self.file_path)
|
|
730
732
|
|
|
731
733
|
def __get_font_rules(self):
|
|
@@ -1255,9 +1257,19 @@ def does_selector_apply(element: Element, selector: str) -> bool:
|
|
|
1255
1257
|
|
|
1256
1258
|
# If the tag is an anchor, but the selector is not - doesn't apply
|
|
1257
1259
|
# link color can only be changed by a link selector
|
|
1258
|
-
if element_name == "a"
|
|
1259
|
-
|
|
1260
|
-
|
|
1260
|
+
if element_name == "a":
|
|
1261
|
+
# NOTE: turns out a descendant selector targetting an anchor won't
|
|
1262
|
+
# show as a link_selector
|
|
1263
|
+
if is_descendant_selector:
|
|
1264
|
+
selector_list = selector.split()
|
|
1265
|
+
|
|
1266
|
+
# Check the descendant to see if it is a link
|
|
1267
|
+
last_item = selector_list[-1]
|
|
1268
|
+
if "a" != last_item[0]:
|
|
1269
|
+
break
|
|
1270
|
+
elif not is_link_selector:
|
|
1271
|
+
break
|
|
1272
|
+
if is_type_selector:
|
|
1261
1273
|
applies = element_name == sel
|
|
1262
1274
|
if applies:
|
|
1263
1275
|
break
|
|
@@ -244,6 +244,11 @@ def hex_to_rgb(hex_code: str) -> tuple:
|
|
|
244
244
|
"""
|
|
245
245
|
hex_code = hex_code.lower()
|
|
246
246
|
if "#" in hex_code[0]:
|
|
247
|
+
if len(hex_code) == 4:
|
|
248
|
+
r = hex_code[1] * 2
|
|
249
|
+
g = hex_code[2] * 2
|
|
250
|
+
b = hex_code[3] * 2
|
|
251
|
+
hex_code = f"#{r}{g}{b}"
|
|
247
252
|
hex_code = hex_code[1:]
|
|
248
253
|
r = hex_code[:2]
|
|
249
254
|
g = hex_code[2:4]
|
|
@@ -434,6 +434,16 @@ def get_number_of_elements_per_file(
|
|
|
434
434
|
return elements_per_file
|
|
435
435
|
|
|
436
436
|
|
|
437
|
+
def has_text_content(el: Tag) -> bool:
|
|
438
|
+
"""returns whether an element contains text content
|
|
439
|
+
|
|
440
|
+
The test is to see if there is raw text inside the element as its
|
|
441
|
+
content. It must be text that is not inside of a nested tag but
|
|
442
|
+
is the direct text outside of any other HTML elements"""
|
|
443
|
+
has_text_content = False
|
|
444
|
+
return has_text_content
|
|
445
|
+
|
|
446
|
+
|
|
437
447
|
if __name__ == "__main__":
|
|
438
448
|
file_with_inline_styles = "tests/test_files/sample_with_inline_styles.html"
|
|
439
449
|
markup = clerk.file_to_string(file_with_inline_styles)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|