""" Debug script for add_icons_to_sky_btn """ import sys sys.path.insert(0, 'd:/ClaudeCode/frontend/src') import add_icons_to_sky_btn as fixer import re filepath = 'd:/ClaudeCode/frontend/src/views/app/SettingsView.vue' with open(filepath, 'r', encoding='utf-8') as f: content = f.read() template_start, template_end = fixer.find_template_section(content) print(f'template_start={template_start}, template_end={template_end}') if template_start is None: print("No template found!") sys.exit(1) template_text = content[template_start:template_end] print(f'template_text length = {len(template_text)}') # Find ALL NButton tags (not just sky-btn) count = 0 for match in re.finditer(r'<[Nn][-]?[Bb]utton\b', template_text): tag_start = match.start() if fixer.is_inside_quotes(template_text, tag_start): continue # Find end of opening tag pos = match.end() in_dq = False in_sq = False tag_end = -1 while pos < len(template_text): ch = template_text[pos] if ch == '\\': pos += 2 continue if ch == '"' and not in_sq: in_dq = not in_dq elif ch == "'" and not in_dq: in_sq = not in_sq elif ch == '>' and not in_dq and not in_sq: tag_end = pos + 1 break pos += 1 if tag_end < 0: continue tag_text = template_text[tag_start:tag_end] has_sky = 'sky-btn' in tag_text if not has_sky: continue has_text = fixer.has_text_prop(tag_text) size_match = re.search(r'\bsize\s*=\s*"(tiny|mini)"', tag_text) quart = re.search(r'\bquaternary\b', tag_text) if quart and (quart.start() == 0 or tag_text[quart.start()-1] != ':'): is_quart = True else: is_quart = False icon_tmpl = fixer.has_icon_template(tag_text, template_text, tag_end) btn_text = fixer.extract_button_text(tag_text, template_text, tag_end) has_emoj = fixer.has_emoji_content(btn_text) count += 1 print(f'\nButton #{count}:') print(f' has_sky={has_sky}') print(f' has_text={has_text}') print(f' size_match={bool(size_match)}') print(f' is_quart={is_quart}') print(f' has_icon_template={icon_tmpl}') print(f' btn_text={btn_text!r}') print(f' has_emoji={has_emoj}') print(f' tag_text={tag_text[:120]}') print(f'\nTotal sky-btn NButtons found: {count}')