39292-vm/test_match.py
2026-03-12 20:38:42 +00:00

25 lines
1.1 KiB
Python

import sys
import re
with open('tmp_home_current.html', 'r', encoding='utf-8') as f:
html = f.read()
img_block_str = """<!-- wp:group {"layout":{"type":"constrained","contentSize":"1100px"},"style":{"spacing":{"padding":{"top":"40px","bottom":"20px","left":"24px","right":"24px"}}}} -->
<div class="wp-block-group" style="padding-top:40px;padding-right:24px;padding-bottom:20px;padding-left:24px">
<!-- wp:image {"align":"center"} -->
<figure class="wp-block-image aligncenter"><img src="/wp-content/uploads/2026/03/pasted-20260312-192203-5bf6a392.png" alt="Kevin McKeand" style="border-radius:16px;max-width:100%;height:auto;"/></figure>
<!-- /wp:image -->
</div>
<!-- /wp:group -->"""
if img_block_str in html:
print("Found")
else:
print("Not Found")
m = re.search(r'<!-- wp:group \{"layout":\{"type":"constrained","contentSize":"1100px"\}\,"style":\{"spacing":\{"padding":\{"top":"40px".*?<!-- /wp:group -->', html, re.DOTALL)
if m:
print("Regex found:")
print(repr(m.group(0)))
print("Expected:")
print(repr(img_block_str))