@kinti/a11y-toolkit 5.26.0 → 5.27.0

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.
Files changed (44) hide show
  1. package/README.md +1 -1
  2. package/a11y_toolkit/a11y.py +27 -4
  3. package/a11y_toolkit/a11yact.py +9 -1
  4. package/a11y_toolkit/a11yannotate.py +185 -0
  5. package/a11y_toolkit/a11yaudit.py +853 -193
  6. package/a11y_toolkit/a11ybadge.py +24 -17
  7. package/a11y_toolkit/a11ybudget.py +145 -1
  8. package/a11y_toolkit/a11ycorpus.py +58 -24
  9. package/a11y_toolkit/a11ycrit.py +110 -53
  10. package/a11y_toolkit/a11ydiff.py +104 -34
  11. package/a11y_toolkit/a11ydisprove.py +15 -8
  12. package/a11y_toolkit/a11ydocx.py +8 -6
  13. package/a11y_toolkit/a11ydom.py +425 -95
  14. package/a11y_toolkit/a11yen301549.py +53 -1
  15. package/a11y_toolkit/a11yengines.py +157 -0
  16. package/a11y_toolkit/a11yevidence.py +81 -33
  17. package/a11y_toolkit/a11yfix.py +131 -52
  18. package/a11y_toolkit/a11yinit.py +30 -5
  19. package/a11y_toolkit/a11yjourney.py +110 -4
  20. package/a11y_toolkit/a11yledger.py +119 -12
  21. package/a11y_toolkit/a11ylocate.py +247 -0
  22. package/a11y_toolkit/a11yopenacr.py +10 -3
  23. package/a11y_toolkit/a11ypatches.py +154 -0
  24. package/a11y_toolkit/a11ypatterns.py +344 -0
  25. package/a11y_toolkit/a11ypdf.py +109 -53
  26. package/a11y_toolkit/a11yrgaa.py +60 -0
  27. package/a11y_toolkit/a11yroute.py +34 -12
  28. package/a11y_toolkit/a11ysarif.py +45 -18
  29. package/a11y_toolkit/a11yscope.py +67 -15
  30. package/a11y_toolkit/a11yscroll.py +7 -5
  31. package/a11y_toolkit/a11ystatement.py +30 -6
  32. package/a11y_toolkit/a11ytrace.py +293 -0
  33. package/a11y_toolkit/a11yvalidate.py +21 -15
  34. package/a11y_toolkit/a11yvpat.py +34 -7
  35. package/a11y_toolkit/a11yvtt.py +22 -6
  36. package/a11y_toolkit/a11ywiz.py +121 -0
  37. package/a11y_toolkit/contrast.py +62 -24
  38. package/a11y_toolkit/locales/en.json +177 -20
  39. package/a11y_toolkit/locales/es.json +178 -21
  40. package/a11y_toolkit/rgaa.json +2661 -0
  41. package/a11y_toolkit/server.py +149 -50
  42. package/package.json +2 -2
  43. package/a11y_toolkit/a11yplan.py +0 -214
  44. package/a11y_toolkit/a11ywcagem.py +0 -237
@@ -42,9 +42,12 @@ def _recheck_static(url, findings, timeout=30, lang='en'):
42
42
  h['status'] = 'confirmed'
43
43
  else:
44
44
  h['status'] = 'rejected'
45
- h['reject_reason'] = (
46
- f"signal '{h.get('signal', '?')}' no longer fires on re-audit — "
47
- "the page may have changed, or the finding was a false positive")
45
+ _rj = ('la señal {s!r} ya no dispara al re-auditar — la página '
46
+ 'puede haber cambiado, o el hallazgo era un falso positivo'
47
+ if lang == 'es' else
48
+ "signal {s!r} no longer fires on re-audit — the page may "
49
+ 'have changed, or the finding was a false positive')
50
+ h['reject_reason'] = _rj.format(s=h.get('signal', '?'))
48
51
  verified.append(h)
49
52
  return verified, None
50
53
 
@@ -65,10 +68,14 @@ def _recheck_rendered(url, findings, timeout=45, lang='en'):
65
68
  h['status'] = 'confirmed'
66
69
  else:
67
70
  h['status'] = 'rejected'
68
- h['reject_reason'] = (
69
- f"signal '{h.get('signal', '?')}' no longer fires in the rendered "
70
- "re-audit — the element may have changed, been fixed, or the "
71
- "first finding was a false positive")
71
+ _rj = ('la señal {s!r} ya no dispara en la re-auditoría renderizada '
72
+ '— el elemento puede haber cambiado o arreglarse, o el primer '
73
+ 'hallazgo era un falso positivo'
74
+ if lang == 'es' else
75
+ "signal {s!r} no longer fires in the rendered re-audit — the "
76
+ 'element may have changed, been fixed, or the first finding '
77
+ 'was a false positive')
78
+ h['reject_reason'] = _rj.format(s=h.get('signal', '?'))
72
79
  verified.append(h)
73
80
  return verified, None
74
81
 
@@ -91,7 +98,7 @@ def disprove(url, report=None, timeout=30, lang='en'):
91
98
  # evidence. Honest path: not-rechecked per page, with the pointer to
92
99
  # re-verify each page properly.
93
100
  every_finding = []
94
- for page in (report.get('pages') or report.get('reports') or []):
101
+ for page in (report.get('reports') or []): # 'pages' es un CONTEO, no una lista
95
102
  for h in page.get('findings', []):
96
103
  every_finding.append(dict(h, disprover_status='not-rechecked',
97
104
  page=page.get('url', '')))
@@ -87,7 +87,10 @@ def docx_screen(path, lang='en'):
87
87
  for para in re.findall(r'<w:p\b.*?</w:p>', body, re.S):
88
88
  if 'w:val="Heading' in para:
89
89
  continue
90
- has_bold = '<w:b/>' in para or '<w:b ' in para
90
+ # bold real: <w:b> presente SIN val de apagado explícito (0/false)
91
+ # — `<w:b w:val="0"/>` es bold-OFF y no cuenta
92
+ has_bold = any(not re.search(r'w:val="(?:0|false)"', tag)
93
+ for tag in re.findall(r'<w:b\b[^>]*>', para))
91
94
  m_sz = re.search(r'<w:sz w:val="(\d+)"', para)
92
95
  large = bool(m_sz) and int(m_sz.group(1)) >= 28
93
96
  text = ''.join(re.findall(r'<w:t[^>]*>([^<]*)</w:t>', para)).strip()
@@ -102,16 +105,15 @@ def docx_screen(path, lang='en'):
102
105
  order = {'high': 0, 'medium': 1, 'low': 2}
103
106
  findings.sort(key=lambda h: order[h['severity']])
104
107
 
105
- def score(hs):
106
- return max(0, 100 - 25 * sum(1 for h in hs if h['severity'] == 'high')
107
- - 10 * sum(1 for h in hs if h['severity'] == 'medium')
108
- - 5 * sum(1 for h in hs if h['severity'] == 'low'))
108
+ # misma puntuación que pdf/vtt: compute_score compartido (12/6/2) — los
109
+ # scores cross-mode son comparables
110
+ from .a11yaudit import compute_score
109
111
 
110
112
  return {
111
113
  'mode': 'docx', 'file': str(path).rsplit('/', 1)[-1],
112
114
  'language': language, 'images': len(docprs),
113
115
  'tables': n_tables, 'tables_with_header': n_tblheader,
114
- 'score': score(findings),
116
+ 'score': compute_score(findings),
115
117
  'findings': findings,
116
118
  'summary': {s2: sum(1 for h in findings if h['severity'] == s2)
117
119
  for s2 in ('high', 'medium', 'low')},