47 行
1.8 KiB
Python
47 行
1.8 KiB
Python
# -*- coding: utf-8 -*-
|
|
import re
|
|
|
|
with open('addons/official/view/web/official_journalism/list.html', 'r', encoding='utf-8') as f:
|
|
c = f.read()
|
|
|
|
c = re.sub(
|
|
r'<div class="nhc-title-list">.*?</div>',
|
|
'''<div class="nhc-title-list">
|
|
{foreach $data as $index => $item}
|
|
<a href="{:addon_url('official/web.official_journalism/details',[':pid'=>(int)input('param.pid'),':sid'=>(int)input('param.sid'),':id'=>$item['id']])}" class="nhc-title-item" title="{$item['title']}">
|
|
<div class="nhc-title-left">
|
|
<span class="nhc-title-text">{$item['title']}</span>
|
|
</div>
|
|
</a>
|
|
{/foreach}
|
|
</div>''',
|
|
c,
|
|
flags=re.DOTALL
|
|
)
|
|
|
|
with open('addons/official/view/web/official_journalism/list.html', 'w', encoding='utf-8') as f:
|
|
f.write(c)
|
|
|
|
with open('addons/official/view/web/official_journalism/list_e.html', 'r', encoding='utf-8') as f:
|
|
ce = f.read()
|
|
|
|
ce = re.sub(
|
|
r'<div class="nhc-title-list">.*?</div>',
|
|
'''<div class="nhc-title-list">
|
|
{foreach $data as $index => $val}
|
|
<a href="{:addon_url('official/web.official_journalism/details',[':pid'=>(int)input('param.pid'),':sid'=>(int)input('param.sid'),':id'=>$val['id']])}" class="nhc-title-item" style="padding: 14px 16px; border-bottom: 1px solid var(--border-color); display: block;">
|
|
<h2 style="font-family: var(--font-serif); font-size: 15px; font-weight: 600; color: var(--text-primary); line-height: 1.45; margin: 0;">
|
|
{$val['title']}
|
|
</h2>
|
|
</a>
|
|
{/foreach}
|
|
</div>''',
|
|
ce,
|
|
flags=re.DOTALL
|
|
)
|
|
|
|
with open('addons/official/view/web/official_journalism/list_e.html', 'w', encoding='utf-8') as f:
|
|
f.write(ce)
|
|
|
|
print('Journalism lists updated to pure title mode successfully.')
|