_html: Refine python script
This commit is contained in:
parent
e9a6804c98
commit
8f87e41867
8
qsgen2
8
qsgen2
@ -877,12 +877,14 @@ def replace_qstags(match):
|
|||||||
}
|
}
|
||||||
return qstag_dict.get(qstag, qstag) # Replace or return unchanged
|
return qstag_dict.get(qstag, qstag) # Replace or return unchanged
|
||||||
|
|
||||||
# Define the regular expression pattern for QStags
|
# Define the regular expression pattern for QStags, excluding specific ones
|
||||||
pattern = r'(?<=^|\s)(#(?!link|image|ytvideo|updated|version)\w+)'
|
pattern = r'(?<=\s)(#(?!link|image|ytvideo|updated|version)\w+)'
|
||||||
|
|
||||||
# Replace QStags using the defined function
|
# Replace QStags using the defined function
|
||||||
result = re.sub(pattern, replace_qstags, '''$content''', flags=re.MULTILINE)
|
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)
|
print(result)
|
||||||
EOF
|
EOF
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user