59 lines
3.2 KiB
Python
59 lines
3.2 KiB
Python
import sys
|
|
sys.stdout.reconfigure(encoding='utf-8')
|
|
path = 'c:/NeoZQYY/docs/h5_ui/compare/AGENT-PLAYBOOK.md'
|
|
with open(path, 'rb') as f:
|
|
raw = f.read()
|
|
content = raw.decode('utf-8')
|
|
lines = content.split('\n')
|
|
|
|
# Insert §0.8 before line 154 (the --- separator before ## 一)
|
|
insert_before = 153 # 0-indexed = line 154
|
|
|
|
new_lines = [
|
|
'---',
|
|
'',
|
|
'### 0.8 \u8fc1\u79fb\u524d\u9884\u5148\u8ba1\u7b97\u5b50\u8868\uff08step-0 \u5904\u7406\u524d\u5fc5\u505a\uff09',
|
|
'',
|
|
'\u5f00\u59cb\u5199 WXSS \u4e4b\u524d\uff0c\u5148\u4ece H5 \u6e90\u7801\u9884\u5148\u8ba1\u7b97\u4ee5\u4e0b\u5b50\u8868\uff0c\u907f\u514d\u8fb9\u770b\u8fb9\u6362\u7b97\u5bfc\u81f4\u6f0f\u6539\u6216\u9519\u6539\uff1a',
|
|
'',
|
|
'**A. \u5168\u5c40\u5185\u8fb9\u8ddd \u2192 rpx**',
|
|
'```',
|
|
'H5 \u9875\u9762\u5bbd 430px\u3002\u5c06 H5 \u5185\u8fb9\u8ddd px \u5e94\u7528\u516c\u5f0f\uff1arpx = px \u00d7 1.75\uff08\u53d6\u5076\u6570\uff09',
|
|
'\u793a\u4f8b\uff1ap-4(16px)\u219228rpx p-6(24px)\u219242rpx p-7(28px)\u219250rpx',
|
|
'\u5185\u5bb9\u533a\u5bbd(px) = 430 - 2\u00d7\u5185\u8fb9\u8ddd(px)\uff0c\u5bf9\u5e94 rpx \u5e94\u4e0e WXSS \u5185\u5bb9\u5bbd\u4e00\u81f4',
|
|
'```',
|
|
'',
|
|
'**B. Sticky \u5143\u7d20\u9ad8\u5ea6\uff08\u6709 sticky \u7684\u9875\u9762\uff09**',
|
|
'```',
|
|
'\u8fdd\u5143\u7d20\u8ba1\u7b97\uff1a\u9ad8\u5ea6(px) \u00d7 1.75 \u53d6\u5076\u6570 = rpx\uff0c\u7d2f\u52a0\u5f97 sticky \u533a\u57df\u603b\u9ad8',
|
|
'\u586b\u5165 \u00a75.5 \u8868\u683c\uff0c\u7528\u4e8e\u9501\u70b9\u5bf9\u9f50\u548c\u6eda\u52a8\u88c1\u526a\u504f\u79fb\u8ba1\u7b97',
|
|
'```',
|
|
'',
|
|
'**C. \u6bcf\u4e2a Section \u7406\u8bba\u9ad8\u5ea6\uff08\u8f85\u52a9\u9a8c\u8bc1\uff09**',
|
|
'```',
|
|
'\u5bf9\u91cd\u590d\u5217\u8868\u9879\uff1an \u9879 \u00d7 \u5355\u9879\u9ad8 + gap\u00d7(n-1)',
|
|
'\u5bf9\u5361\u7247\uff1apadding-top + padding-bottom + \u5185\u5bb9\u884c\u9ad8\u00d7\u884c\u6570 + gap\u00d7(\u884c\u6570-1)',
|
|
'\u7406\u8bba\u9ad8\u5ea6\u4e0e \u00a79 scrollHeight \u5bf9\u7167\uff0c\u8d85\u8fc7 50px \u5dee\u5f02\u8bf4\u660e\u6709\u5143\u7d20\u9057\u6f0f',
|
|
'```',
|
|
'',
|
|
'**D. Tailwind \u7c7b\u540d \u2192 rpx \u6620\u5c04\u8868\uff08\u5168\u9875\u6240\u6709\u5143\u7d20\uff09**',
|
|
'```',
|
|
'\u626b\u63cf H5 \u6e90\u7801\u6240\u6709 Tailwind \u7c7b\u540d\uff0c\u5bf9\u7167 \u00a77.2 \u9884\u5148\u8f93\u51fa\u6620\u5c04\u8868\uff0c\u907f\u514d\u4fee\u6b63\u65f6\u8fb9\u67e5\u8fb9\u9057\u6f0f',
|
|
'\u683c\u5f0f\uff1a[ \u5143\u7d20\u540d | Tailwind\u7c7b | H5 px | WXSS rpx | \u5907\u6ce8 ]',
|
|
'```',
|
|
'',
|
|
'**E. \u6a21\u5f0f B \u9875\u9762\uff1a\u81ea\u5b9a\u4e49 navBar \u5b9e\u9645\u8bbe\u8ba1\u9ad8\u5ea6**',
|
|
'```',
|
|
'\u8bfb H5 \u6e90\u7801\u4e2d\u81ea\u5b9a\u4e49 navBar \u7684\u8bbe\u8ba1\u9ad8\u5ea6(px)\uff0c\u6362\u7b97\u5230 rpx \u586b\u5165 WXML',
|
|
'\u8be5\u9ad8\u5ea6\u5373 \u00a72.3 \u88c1\u526a\u504f\u79fb\u7684\u4f9d\u636e\uff08\u9ed8\u8ba4 64px \u903b\u8f91 \u00d7 1.5 = 96px \u7269\u7406\uff09',
|
|
'```',
|
|
'',
|
|
]
|
|
|
|
lines = lines[:insert_before] + new_lines + lines[insert_before:]
|
|
content_new = '\n'.join(lines)
|
|
|
|
with open(path, 'wb') as f:
|
|
f.write(content_new.encode('utf-8'))
|
|
print(f'Done. Lines inserted: {len(new_lines)}. Total lines: {len(lines)}')
|