#!/usr/bin/env python3 """Build inert, independent Smarty-source visual references; no application boot or API.""" from pathlib import Path import re,json ROOT=Path(__file__).resolve().parents[2] RAW=ROOT/'codex/output/fuc-theme/reference/raw' OUT=RAW.parent/'pages';OUT.mkdir(exist_ok=True) BASE='/theme/Fuc/assets/native/' footer=(Path('/Users/hellcat/Documents/GemCodes/fuc-new.loc/resources/views/tabler/user/footer.tpl').read_text().split('')[0]+'') # Inputs match the isolated XB fixture where the source has a corresponding value. values={'BRAND':'福云','NAME':'preview','EMAIL':'preview@example.test','PLAN':'标准订阅','CLASS':'标准订阅','BALANCE':'28.00','COMMISSION':'12.00','DAYS':'27','GB':'300','P_NAME':'轻量订阅','P_PRICE':'12.00','P_GB':'100','P_IP':'3','P_SPEED':'100','P_PERIOD':'30','P_ID':'1','CYCLE':'month_price','RATE':'—','WITHDRAW_MIN':'—','REWARD_GB':'—','FEE':'—'} for name in ['home','login','register','forget','reset','index','plans','myplan','wallet','invite','profile','tickets','ticket','servers','notices','knowledge','article','faq','orders','purchase','checkout']: html=(RAW/(name+'.html')).read_text() if name not in ['home','login','register','forget','reset']: html=(RAW/'header.html').read_text()+html+footer+'' html=re.sub(r']*>|','',html) html=re.sub(r'__([A-Z_0-9]+)__',lambda m:values.get(m[1],'—'),html) html=re.sub(r']*>.*?','',html,flags=re.S|re.I) html=re.sub(r'\s+on\w+=("[^"]*"|\x27[^\x27]*\x27)','',html) html=html.replace('https://fastly.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.8.2/css/all.min.css',BASE+'assets/cool/all.min.css') html=re.sub(r'((?:href|src)=[\x27"])(/(?!/)(?:theme|images|assets)/|assets/cool/|\.\./theme/)',lambda m:m[1]+BASE+m[2].removeprefix('../').lstrip('/'),html) html=html.replace('','') (OUT/(name+'.html')).write_text(html) print(f'{len(list(OUT.glob("*.html")))} independent source reference pages')