feat: implement swiper slider, tabbed livestream, and table extension plugins with schema updates for settings content
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import re
|
||||
|
||||
with open('/home/x79/sisvietnamvn_01/sisvietnamvn_Trang chính thức hiện tại/Đào tạo tại UMC.html', 'r', encoding='utf-8') as f:
|
||||
html = f.read()
|
||||
|
||||
body_match = re.search(r'<body[^>]*>(.*?)</body>', html, re.IGNORECASE | re.DOTALL)
|
||||
content = body_match.group(1) if body_match else html
|
||||
|
||||
# Remove header and footer
|
||||
content = re.sub(r'<header.*?</header>', '', content, flags=re.IGNORECASE | re.DOTALL)
|
||||
content = re.sub(r'<footer.*?</footer>', '', content, flags=re.IGNORECASE | re.DOTALL)
|
||||
|
||||
# Swiper 1: Gallery
|
||||
# Find: <div class="relative md:flex md:items-center md:gap-x-2 plugin-swiper-slider plugin-swiper-slider-gallery"> ... </div> (or similar)
|
||||
# Since the original HTML doesn't have plugin classes, let's look for btn-navigation-cap-chung-chi-prev
|
||||
# Wait, the first swiper has `swiper-pagination-training-gallery`.
|
||||
# Its container is `<div class="relative ...">` containing it.
|
||||
# Let's replace the whole block by splitting.
|
||||
|
||||
def replace_block(text, marker, replacement):
|
||||
# Find the block containing the marker
|
||||
parts = text.split(marker)
|
||||
if len(parts) > 1:
|
||||
before = parts[0]
|
||||
# backtrack to the nearest <div class="relative md:flex
|
||||
start_idx = before.rfind('<div class="relative md:flex')
|
||||
if start_idx == -1:
|
||||
start_idx = before.rfind('<div class="relative')
|
||||
|
||||
after = parts[1]
|
||||
# find the end of this div block. This is hard without a parser.
|
||||
# But we can just use a regex if we know the structure.
|
||||
return text
|
||||
return text
|
||||
|
||||
# Instead of complex regex, let's just create a new dao-tao.html structure by extracting the known sections.
|
||||
# Actually, the user wants the exact layout. I will write a script to just use JSDOM in Node.js to properly manipulate the DOM.
|
||||
Reference in New Issue
Block a user