23 lines
1.2 KiB
Python
23 lines
1.2 KiB
Python
import re
|
|
|
|
with open('tmp_home_current4.html', 'r') as f:
|
|
content = f.read()
|
|
|
|
# The text to add: Kevin McKeand Coaching, centered, #316263, 54px, bold.
|
|
new_heading = """<!-- wp:heading {"textAlign":"center","level":1,"style":{"typography":{"fontSize":"54px","lineHeight":"1.05"},"color":{"text":"#316263"}}} -->
|
|
<h1 class="wp-block-heading has-text-align-center has-text-color" style="font-size:54px;line-height:1.05;color:#316263"><strong>Kevin McKeand Coaching</strong></h1>
|
|
<!-- /wp:heading -->\n\n"""
|
|
|
|
target_regex = r'(<!-- wp:heading \{"textAlign":"center","level":1,"style":\{"typography":\{"fontSize":"54px","lineHeight":"1.05"\},\"color\":\{"text":"#000000"\}\},"textColor":"black"\} -->\n<h1 class="wp-block-heading has-text-align-center has-black-color has-text-color" style="font-size:54px;line-height:1.05;color:#000000"><strong>Enabling Others To Achieve Their Potential</strong></h1>\n<!-- /wp:heading -->)'
|
|
|
|
new_content = re.sub(target_regex, new_heading + r'\1', content)
|
|
|
|
if content == new_content:
|
|
print("Warning: Content was not updated. Regex might have failed.")
|
|
else:
|
|
print("Content successfully updated.")
|
|
|
|
with open('tmp_home_updated.html', 'w') as f:
|
|
f.write(new_content)
|
|
|