"""Reproducible offline preview assembled from actual V8.34 server rendering.""" import html,json from pathlib import Path from app.blueprints import new_block,render_blocks ROOT=Path(__file__).resolve().parents[1] OUT=ROOT/'examples/V8_34_主题Banner与产品卡片_真实渲染交互预览.html' css=(ROOT/'app/static/blocks.css').read_text() styles={k:((ROOT/f'themes/{k}/blocks.css').read_text() if (ROOT/f'themes/{k}/blocks.css').exists() else '') for k in ('automotive','industrial')} entries={ 'automotive':[{'route':f'/product/model-{i}/','title':v,'type':'product','cover':'','summary':'出口车型展示 · 可按实际车型数据替换','meta_json':'{}'} for i,v in enumerate(['SUV 车型 A','新能源车型 B','皮卡车型 C','商务车型 D','紧凑车型 E','乘用车型 F'],1)], 'industrial':[{'route':f'/product/pipe-{i}/','title':v,'type':'product','cover':'','summary':'管道产品展示 · 可查看技术参数','meta_json':'{}'} for i,v in enumerate(['HDPE 给水管','PVC-U 排水管','双壁波纹管','钢丝网骨架管','土工布','土工膜'],1)] } views={} for theme in entries: views[theme]={} for banner in ('split','image-first','centered'): for cards in ('standard','compact','showcase'): blocks=[new_block('hero',{'title': '中国汽车 · 全球交付' if theme=='automotive' else '专业管道 · 工程应用', 'subtitle': 'GLOBAL AUTOMOTIVE' if theme=='automotive' else 'PIPE SYSTEM SOLUTIONS','description':'这是实际服务端渲染的内容模块,点击选项可比较布局。','image':'','layout_variant':banner,'image_fit':'contain','button':'查看产品','href':'/product/'}),new_block('collection',{'title':'精选车型' if theme=='automotive' else '主要产品','subtitle':'PRODUCT SELECTION','source':'product','limit':6,'columns':3,'card_style':cards,'image_fit':'contain'})] views[theme][banner+'-'+cards]=render_blocks(blocks,{'name':'DEMO'},{'route':'/','type':'home'},entries[theme]) # escape script closure payload=json.dumps({'views':views,'styles':styles,'blocks':css},ensure_ascii=False).replace('SiteForge V8.34 · 真正生成的主题布局
SiteForge V8.34 · Banner 与产品卡片来自实际服务端区块渲染 · 仅演示布局,不连接业务后台
''' OUT.write_text(base,encoding='utf-8');print('CREATED',OUT,OUT.stat().st_size)