22 lines
718 B
Python
22 lines
718 B
Python
|
|
#!/usr/bin/env python3
|
||
|
|
# 分析 settings.php 文件结构
|
||
|
|
|
||
|
|
with open('settings.php', 'r', encoding='utf-8') as f:
|
||
|
|
content = f.read()
|
||
|
|
|
||
|
|
# 查找关键位置
|
||
|
|
pos1 = content.find('<!-- ========== 12. 文章功能 ==========')
|
||
|
|
pos2 = content.find('<tr><th class="subtitle"><h3 id="subsection-footnote">')
|
||
|
|
|
||
|
|
print(f'文章功能开始位置: {pos1}')
|
||
|
|
print(f'脚注引用开始位置: {pos2}')
|
||
|
|
print(f'需要替换的字符数: {pos2 - pos1}')
|
||
|
|
|
||
|
|
# 统计行数
|
||
|
|
lines_before = content[:pos1].count('\n')
|
||
|
|
lines_between = content[pos1:pos2].count('\n')
|
||
|
|
|
||
|
|
print(f'\n文章功能开始行: {lines_before + 1}')
|
||
|
|
print(f'需要移除的行数: {lines_between}')
|
||
|
|
print(f'脚注引用开始行: {lines_before + lines_between + 1}')
|