refactor: HWP 변환을 exe(HWP→HWPX) 단일 경로로 교체, 이미지 경로 URL 인코딩
- hwp.py: COM/pyhwp 제거, HwpToPdfConverter.exe → hwpx 컨버터 재사용으로 단순화 - hwpx.py, hml.py: 이미지 경로의 공백/대괄호 URL 인코딩(%20, %5B, %5D) 추가 (Obsidian 등 Markdown 뷰어에서 [기본이론] 포함 파일명 이미지 표시 오류 수정) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,8 @@ import base64
|
||||
import re
|
||||
import xml.etree.ElementTree as ET
|
||||
from pathlib import Path
|
||||
def _esc_path(s: str) -> str:
|
||||
return s.replace(' ', '%20').replace('[', '%5B').replace(']', '%5D')
|
||||
|
||||
|
||||
def _extract_images(tree, images_dir: Path) -> tuple[dict, list]:
|
||||
@@ -125,7 +127,7 @@ def _process_p(p_elem, pic_counter: list, bin_order: list, id_to_file: dict, bas
|
||||
pic_counter[0] += 1
|
||||
bid = bin_order[idx] if idx < len(bin_order) else None
|
||||
filename = id_to_file.get(bid, '') if bid else ''
|
||||
ref = f'{base_name}_images/{filename}' if filename else f'그림_{idx+1}.png'
|
||||
ref = f'{_esc_path(base_name)}_images/{_esc_path(filename)}' if filename else f'그림_{idx+1}.png'
|
||||
lines.append(f'')
|
||||
if not has_content:
|
||||
text = _extract_text(p_elem)
|
||||
|
||||
Reference in New Issue
Block a user