webcode-tk 1.2.8__tar.gz → 1.2.11__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.4
2
2
  Name: webcode-tk
3
- Version: 1.2.8
3
+ Version: 1.2.11
4
4
  Summary: A set of tools for inspecting HTML and CSS code
5
5
  License: MIT
6
6
  License-File: LICENSE.rst
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "webcode-tk"
3
- version = "1.2.8"
3
+ version = "1.2.11"
4
4
  description = "A set of tools for inspecting HTML and CSS code"
5
5
  authors = ["hundredvisionsguy <cwinikka@gmail.com>"]
6
6
  keywords = ["html", "validation", "css", ]
@@ -40,4 +40,4 @@
40
40
  - **`validator_tools`**: sends HTML or CSS code to the W3C Validator to check
41
41
  for errors.
42
42
  """
43
- __version__ = "1.2.8"
43
+ __version__ = "1.2.11"
@@ -2675,6 +2675,7 @@ def get_properties_applied_report(project_dir: str, goals: dict) -> list:
2675
2675
  )
2676
2676
  if selector_type == "grouped_selector":
2677
2677
  sel_split = selector.split(",")
2678
+ sel_split = [s.strip() for s in sel_split]
2678
2679
  if element in sel_split:
2679
2680
  take_targetted_properties(
2680
2681
  properties_found,
@@ -50,6 +50,29 @@ def get_all_html_files(dir_path: str) -> list:
50
50
  return html_files
51
51
 
52
52
 
53
+ def get_image_hotlinks(soup: BeautifulSoup) -> list:
54
+ """Returns a list of all img src values that are external (hotlinked) URLs.
55
+
56
+ Hotlinked images are those with src attributes pointing to external
57
+ domains rather than local/relative paths. I ask that all students avoid
58
+ hotlinking images, as it's bad form and generally frowned upon.
59
+
60
+ Args:
61
+ soup: html soupt object.
62
+
63
+ Returns:
64
+ hotlinks: a list of hotlinked image srcs"""
65
+ hotlinks = []
66
+ # Get all img urls
67
+ image_elements = soup.find_all("img")
68
+ image_srcs = [img["src"] for img in image_elements]
69
+ for src in image_srcs:
70
+ if "http" in src[:4]:
71
+ hotlinks.append(src)
72
+
73
+ return hotlinks
74
+
75
+
53
76
  def get_html(file_path: str) -> BeautifulSoup:
54
77
  """Returns an html document (from file_path) as a BeautifulSoup object
55
78
 
@@ -360,18 +360,3 @@ if __name__ == "__main__":
360
360
  print("report is a {}.".format(type(report)))
361
361
  for item in report:
362
362
  print(item)
363
- num_errors = get_num_markup_errors(report)
364
- # how many html files in project directory?
365
- html_files = get_html_file_names()
366
-
367
- # test getting number of errorsz
368
- print(get_num_errors(report))
369
-
370
- css_code = clerk.file_to_string("tests/test_files/css_for_testing.css")
371
- css_validator_results = validate_css(css_code)
372
- is_valid = is_css_valid(css_validator_results)
373
- print(is_valid)
374
- css_validator_results = validate_css("p } color: #336699; }")
375
- print(css_validator_results)
376
- is_valid = is_css_valid(css_validator_results)
377
- print(is_valid)
File without changes
File without changes