Skip to content

Commit 3400530

Browse files
committed
feat: rename and update Japanese comments to English for better clarity
1 parent ef0025d commit 3400530

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

parse_pptx.py renamed to src/tppt/_pptx/tree.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
def color_format_to_dict(color_format: Any) -> Dict[str, Any]:
11-
"""カラーフォーマットを辞書に変換する"""
11+
"""Convert color format to dictionary"""
1212
data = {}
1313

1414
try:
@@ -29,7 +29,7 @@ def color_format_to_dict(color_format: Any) -> Dict[str, Any]:
2929

3030

3131
def text_frame_to_dict(text_frame: Any) -> Dict[str, Any]:
32-
"""テキストフレームを辞書に変換する"""
32+
"""Convert text frame to dictionary"""
3333
if not hasattr(text_frame, "paragraphs"):
3434
return {"text": str(text_frame) if text_frame else ""}
3535

@@ -71,7 +71,7 @@ def text_frame_to_dict(text_frame: Any) -> Dict[str, Any]:
7171

7272

7373
def shape_to_dict(shape: Any) -> Dict[str, Any]:
74-
"""Shape オブジェクトを辞書に変換する"""
74+
"""Convert Shape object to dictionary"""
7575
shape_data = {
7676
"name": shape.name,
7777
"shape_id": shape.shape_id,
@@ -134,7 +134,7 @@ def shape_to_dict(shape: Any) -> Dict[str, Any]:
134134

135135

136136
def placeholder_to_dict(placeholder: Any) -> Dict[str, Any]:
137-
"""プレースホルダーを辞書に変換する"""
137+
"""Convert placeholder to dictionary"""
138138
placeholder_data = shape_to_dict(placeholder)
139139

140140
# プレースホルダー特有の情報を追加
@@ -156,7 +156,7 @@ def placeholder_to_dict(placeholder: Any) -> Dict[str, Any]:
156156

157157

158158
def slide_layout_to_dict(slide_layout: Any) -> Dict[str, Any]:
159-
"""スライドレイアウトを辞書に変換する"""
159+
"""Convert slide layout to dictionary"""
160160
layout_data = {
161161
"name": slide_layout.name,
162162
"slide_master_id": id(slide_layout.slide_master)
@@ -173,7 +173,7 @@ def slide_layout_to_dict(slide_layout: Any) -> Dict[str, Any]:
173173

174174

175175
def slide_master_to_dict(slide_master: Any) -> Dict[str, Any]:
176-
"""スライドマスターを辞書に変換する"""
176+
"""Convert slide master to dictionary"""
177177
master_data = {
178178
"id": id(slide_master),
179179
"shapes": [shape_to_dict(shape) for shape in slide_master.shapes],
@@ -194,7 +194,7 @@ def slide_master_to_dict(slide_master: Any) -> Dict[str, Any]:
194194

195195

196196
def slide_to_dict(slide: Any) -> Dict[str, Any]:
197-
"""スライドを辞書に変換する"""
197+
"""Convert slide to dictionary"""
198198
slide_data = {
199199
"slide_id": slide.slide_id,
200200
"slide_layout_name": slide.slide_layout.name
@@ -228,7 +228,7 @@ def slide_to_dict(slide: Any) -> Dict[str, Any]:
228228

229229

230230
def presentation_to_dict(pptx_path: str) -> Dict[str, Any]:
231-
"""プレゼンテーションの情報を辞書に変換する"""
231+
"""Convert presentation information to dictionary"""
232232
prs = Presentation(pptx_path)
233233

234234
# スライドのサイズを安全に取得
@@ -277,17 +277,19 @@ def presentation_to_dict(pptx_path: str) -> Dict[str, Any]:
277277

278278
def main():
279279
parser = argparse.ArgumentParser(
280-
description="PPTXファイルの構造をJSONに変換するツール"
280+
description="Tool to convert PPTX file structure to JSON"
281281
)
282-
parser.add_argument("pptx_file", help="変換するPPTXファイルのパス")
282+
parser.add_argument("pptx_file", help="Path to the PPTX file to convert")
283283
parser.add_argument(
284-
"-o", "--output", help="出力するJSONファイルのパス", default=None
284+
"-o", "--output", help="Path to the output JSON file", default=None
285+
)
286+
parser.add_argument(
287+
"--indent", type=int, help="JSON indentation for formatting", default=2
285288
)
286-
parser.add_argument("--indent", type=int, help="JSONの整形用インデント", default=2)
287289
args = parser.parse_args()
288290

289291
if not os.path.exists(args.pptx_file):
290-
print(f"エラー: ファイル '{args.pptx_file}' が見つかりません。")
292+
print(f"Error: File '{args.pptx_file}' not found.")
291293
return
292294

293295
prs_data = presentation_to_dict(args.pptx_file)
@@ -302,7 +304,7 @@ def main():
302304
with open(output_path, "w", encoding="utf-8") as f:
303305
json.dump(prs_data, f, ensure_ascii=False, indent=args.indent)
304306

305-
print(f"'{args.pptx_file}' の構造を '{output_path}' に出力しました。")
307+
print(f"Structure of '{args.pptx_file}' has been output to '{output_path}'.")
306308

307309

308310
if __name__ == "__main__":

0 commit comments

Comments
 (0)