webcode-tk 1.0.1__tar.gz → 1.0.2__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.0.1 → webcode_tk-1.0.2}/PKG-INFO +1 -1
- {webcode_tk-1.0.1 → webcode_tk-1.0.2}/pyproject.toml +1 -1
- {webcode_tk-1.0.1 → webcode_tk-1.0.2}/webcode_tk/__init__.py +1 -1
- {webcode_tk-1.0.1 → webcode_tk-1.0.2}/webcode_tk/cascade_tools.py +7 -2
- {webcode_tk-1.0.1 → webcode_tk-1.0.2}/webcode_tk/validator_tools.py +19 -5
- {webcode_tk-1.0.1 → webcode_tk-1.0.2}/LICENSE.rst +0 -0
- {webcode_tk-1.0.1 → webcode_tk-1.0.2}/README.rst +0 -0
- {webcode_tk-1.0.1 → webcode_tk-1.0.2}/webcode_tk/color_keywords.py +0 -0
- {webcode_tk-1.0.1 → webcode_tk-1.0.2}/webcode_tk/color_tools.py +0 -0
- {webcode_tk-1.0.1 → webcode_tk-1.0.2}/webcode_tk/css_tools.py +0 -0
- {webcode_tk-1.0.1 → webcode_tk-1.0.2}/webcode_tk/font_tools.py +0 -0
- {webcode_tk-1.0.1 → webcode_tk-1.0.2}/webcode_tk/html_tools.py +0 -0
- {webcode_tk-1.0.1 → webcode_tk-1.0.2}/webcode_tk/sample_report.json +0 -0
- {webcode_tk-1.0.1 → webcode_tk-1.0.2}/webcode_tk/ux_tools.py +0 -0
|
@@ -1493,7 +1493,7 @@ def update_contrast_results(
|
|
|
1493
1493
|
|
|
1494
1494
|
|
|
1495
1495
|
def get_color_contrast_details(tree: CSSAppliedTree, rating="AAA") -> list:
|
|
1496
|
-
"""returns a list of all
|
|
1496
|
+
"""returns a list of all failures or a pass based on rating
|
|
1497
1497
|
|
|
1498
1498
|
We'll create a recursive inner nested function to traverse the DOM. We will
|
|
1499
1499
|
target only the styles that are applied directly so as to not overwhelm the
|
|
@@ -1567,7 +1567,12 @@ def get_color_contrast_details(tree: CSSAppliedTree, rating="AAA") -> list:
|
|
|
1567
1567
|
|
|
1568
1568
|
for element in elements:
|
|
1569
1569
|
check_element(element, rating, filename)
|
|
1570
|
-
if
|
|
1570
|
+
if results:
|
|
1571
|
+
adjusted = []
|
|
1572
|
+
for result in results:
|
|
1573
|
+
adjusted.append("fail: " + result)
|
|
1574
|
+
results = adjusted
|
|
1575
|
+
else:
|
|
1571
1576
|
# It's a success! Let's let them know
|
|
1572
1577
|
msg = f"success: {filename} passes color contrast for {rating} Normal"
|
|
1573
1578
|
msg += " and Large."
|
|
@@ -262,6 +262,7 @@ def get_project_validation(project_dir: str, type="html") -> list:
|
|
|
262
262
|
will return a list of per-files errors
|
|
263
263
|
"""
|
|
264
264
|
report = []
|
|
265
|
+
passing_files = []
|
|
265
266
|
all_files = clerk.get_all_project_files(project_dir)
|
|
266
267
|
for file in all_files:
|
|
267
268
|
errors = []
|
|
@@ -274,24 +275,37 @@ def get_project_validation(project_dir: str, type="html") -> list:
|
|
|
274
275
|
f"fail: {filename} has {len(errors)} validation errors."
|
|
275
276
|
)
|
|
276
277
|
else:
|
|
277
|
-
|
|
278
|
+
passing_files.append(filename)
|
|
278
279
|
else:
|
|
279
|
-
if file_type == "html":
|
|
280
|
+
if file_type == "html" and type == "css":
|
|
280
281
|
style_tag = html.get_elements("style", file)
|
|
281
282
|
if style_tag:
|
|
282
283
|
code = html.get_element_content(style_tag)
|
|
283
284
|
result = validate_css(code)
|
|
284
|
-
|
|
285
|
+
errors_list = get_css_errors_list(result)
|
|
286
|
+
if errors_list:
|
|
287
|
+
errors += errors_list
|
|
288
|
+
else:
|
|
289
|
+
passing_files.append(filename)
|
|
285
290
|
if file_type == "css":
|
|
286
291
|
code = clerk.file_to_string(file)
|
|
287
292
|
result = validate_css(code)
|
|
288
|
-
|
|
293
|
+
errors_list = get_css_errors_list(result)
|
|
294
|
+
if errors_list:
|
|
295
|
+
errors += errors_list
|
|
296
|
+
else:
|
|
297
|
+
passing_files.append(filename)
|
|
289
298
|
if errors:
|
|
290
299
|
report.append(
|
|
291
300
|
f"fail: {filename} has {len(errors)} css errors."
|
|
292
301
|
)
|
|
293
302
|
if not report:
|
|
294
|
-
|
|
303
|
+
if passing_files:
|
|
304
|
+
for passing_file in passing_files:
|
|
305
|
+
msg = f"pass: {passing_file} passes {type.upper()} validation"
|
|
306
|
+
report.append(msg)
|
|
307
|
+
if not passing_files:
|
|
308
|
+
report.append("fail: no files present to validate")
|
|
295
309
|
# TODO - make sure this covers all scenarios
|
|
296
310
|
return report
|
|
297
311
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|