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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: webcode-tk
3
- Version: 1.1.1
3
+ Version: 1.1.3
4
4
  Summary:
5
5
  Home-page: https://github.com/HundredVisionsGuy/webcode-tk
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "webcode-tk"
3
- version = "1.1.1"
3
+ version = "1.1.3"
4
4
  description = ""
5
5
  authors = ["hundredvisionsguy <cwinikka@gmail.com>"]
6
6
  keywords = ["html", "validation", "css", ]
@@ -18,4 +18,4 @@ Modules exported by this package:
18
18
  - `validator_tools`: sends HTML or CSS code to the W3C Validator to check
19
19
  for errors.
20
20
  """
21
- __version__ = "1.1.1"
21
+ __version__ = "1.1.3"
@@ -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" and not is_link_selector:
1259
- break
1260
- elif is_type_selector:
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