_html: Refine python script

This commit is contained in:
Stig-Ørjan Smelror 2024-02-01 13:49:29 +01:00
parent e9a6804c98
commit 8f87e41867

8
qsgen2
View File

@ -877,12 +877,14 @@ def replace_qstags(match):
}
return qstag_dict.get(qstag, qstag) # Replace or return unchanged
# Define the regular expression pattern for QStags
pattern = r'(?<=^|\s)(#(?!link|image|ytvideo|updated|version)\w+)'
# Define the regular expression pattern for QStags, excluding specific ones
pattern = r'(?<=\s)(#(?!link|image|ytvideo|updated|version)\w+)'
# Replace QStags using the defined function
result = re.sub(pattern, replace_qstags, '''$content''', flags=re.MULTILINE)
# Handle QStags at the beginning of lines separately
result = re.sub(r'^(#(?!link|image|ytvideo|updated|version)\w+)', replace_qstags, result, flags=re.MULTILINE)
print(result)
EOF
)