diff --git a/.vscode/launch.json b/.vscode/launch.json index aeb6226..f5dfdb3 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,24 +5,31 @@ "version": "0.2.0", "configurations": [ { - "name": "a710_Thiam_Han_Ji_Tan_Piau_Im", + "name": "a710_清理原填入漢字及注音", "type": "debugpy", "request": "launch", - "program": "a710_Thiam_Han_Ji_Tan_Piau_Im.py", + "program": "a710_清理原填入漢字及注音.py", "console": "integratedTerminal", }, { - "name": "a720_Thiam_Zu_Im", + "name": "a720_待注音漢字填入標音用方格", "type": "debugpy", "request": "launch", - "program": "a720_Thiam_Zu_Im.py", + "program": "a720_待注音漢字填入標音用方格.py", "console": "integratedTerminal", }, { - "name": "a730_Tng_Bang_Iah", + "name": "a730_將漢字注音填入", "type": "debugpy", "request": "launch", - "program": "a730_Tng_Bang_Iah.py", + "program": "a730_將漢字注音填入.py", + "console": "integratedTerminal", + }, + { + "name": "a740_漢字注音轉網頁", + "type": "debugpy", + "request": "launch", + "program": "a740_漢字注音轉網頁.py", "console": "integratedTerminal", }, { diff --git a/Tai_Gi_Zu_Im_Bun.xlsx b/Tai_Gi_Zu_Im_Bun.xlsx index 380ea50..4fc94e9 100644 Binary files a/Tai_Gi_Zu_Im_Bun.xlsx and b/Tai_Gi_Zu_Im_Bun.xlsx differ diff --git a/a700_Iong_Excel_Piau_Zu_Im.py b/a700_Iong_Excel_Piau_Zu_Im.py index d91681d..5f0c76e 100644 --- a/a700_Iong_Excel_Piau_Zu_Im.py +++ b/a700_Iong_Excel_Piau_Zu_Im.py @@ -6,7 +6,7 @@ import xlwings as xw import settings -from a720_Thiam_Zu_Im import thiam_zu_im +from a730_將漢字注音填入 import thiam_zu_im from p730_Tng_Sing_Bang_Iah import tng_sing_bang_iah diff --git "a/a710_\346\270\205\347\220\206\345\216\237\345\241\253\345\205\245\346\274\242\345\255\227\345\217\212\346\263\250\351\237\263.py" "b/a710_\346\270\205\347\220\206\345\216\237\345\241\253\345\205\245\346\274\242\345\255\227\345\217\212\346\263\250\351\237\263.py" new file mode 100644 index 0000000..22df141 --- /dev/null +++ "b/a710_\346\270\205\347\220\206\345\216\237\345\241\253\345\205\245\346\274\242\345\255\227\345\217\212\346\263\250\351\237\263.py" @@ -0,0 +1,98 @@ +# 將 `Tai_Gi_Zu_Im_Bun.xlsx` 檔案已填入之拼音字母及注音符號清除。 +import getopt +import sys + +import xlwings as xw + +import settings +from p701_Clear_Cells import clear_hanji_in_cells +from p710_thiam_han_ji import fill_hanji_in_cells + + +def get_input_and_output_options(argv): + arg_input = "" + arg_output = "" + arg_user = "" + arg_help = "{0} -i -u -o ".format(argv[0]) + + try: + opts, args = getopt.getopt( # pyright: ignore + argv[1:], "hi:u:o:", ["help", "input=", "user=", "output="] + ) + except Exception as e: + print(e) + print(arg_help) + sys.exit(2) + + for opt, arg in opts: + if opt in ("-h", "--help"): + print(arg_help) # print the help message + sys.exit(2) + elif opt in ("-i", "--input"): + arg_input = arg + elif opt in ("-u", "--user"): + arg_user = arg + elif opt in ("-o", "--output"): + arg_output = arg + + print("input:", arg_input) + print("user:", arg_user) + print("output:", arg_output) + + return { + "input": arg_input, + "user": arg_user, + "output": arg_output, + } + + +if __name__ == "__main__": + # ========================================================================= + # (1) 取得需要注音的「檔案名稱」及其「目錄路徑」。 + # ========================================================================= + # 取得 Input 檔案名稱 + file_path = settings.get_tai_gi_zu_im_bun_path() + if not file_path: + print("未設定 .env 檔案") + # sys.exit(2) + opts = get_input_and_output_options(sys.argv) + if opts["input"] != "": + CONVERT_FILE_NAME = opts["input"] + else: + CONVERT_FILE_NAME = "Tai_Gi_Zu_Im_Bun.xlsx" + else: + CONVERT_FILE_NAME = file_path + print(f"CONVERT_FILE_NAME = {CONVERT_FILE_NAME}") + + # 打開 Excel 檔案 + wb = xw.Book(CONVERT_FILE_NAME) + + # 顯示「已輸入之拼音字母及注音符號」 + named_range = wb.names['顯示注音輸入'] # 選擇名為 "顯示注音輸入" 的命名範圍# 選擇名為 "顯示注音輸入" 的命名範圍 + named_range.refers_to_range.value = True + + # ========================================================================= + # (2) 將漢字填入 + # - 上方:台語音標 + # - 下方:台語注音符號 + # ========================================================================= + clear_hanji_in_cells(wb) # 清除先前已填入的漢字、注音符號 + wb.sheets['漢字注音'].range("V3").value = "" + + # ========================================================================= + # (3) 依據《文章標題》另存新檔。 + # ========================================================================= + # wb = xw.Book(CONVERT_FILE_NAME) + # setting_sheet = wb.sheets["env"] + # new_file_name = str( + # setting_sheet.range("C4").value + # ).strip() + # new_file_path = os.path.join( + # ".\\output", + # f"【河洛話注音】{new_file_name}" + ".xlsx") + + # # 儲存新建立的工作簿 + # wb.save(new_file_path) + + # # 保存 Excel 檔案 + # wb.close() \ No newline at end of file diff --git a/a710_Thiam_Han_Ji_Tan_Piau_Im.py "b/a720_\345\276\205\346\263\250\351\237\263\346\274\242\345\255\227\345\241\253\345\205\245\346\250\231\351\237\263\347\224\250\346\226\271\346\240\274.py" similarity index 97% rename from a710_Thiam_Han_Ji_Tan_Piau_Im.py rename to "a720_\345\276\205\346\263\250\351\237\263\346\274\242\345\255\227\345\241\253\345\205\245\346\250\231\351\237\263\347\224\250\346\226\271\346\240\274.py" index 20c1501..ef9f217 100644 --- a/a710_Thiam_Han_Ji_Tan_Piau_Im.py +++ "b/a720_\345\276\205\346\263\250\351\237\263\346\274\242\345\255\227\345\241\253\345\205\245\346\250\231\351\237\263\347\224\250\346\226\271\346\240\274.py" @@ -1,6 +1,5 @@ # 填漢字等標音:將整段的文字拆解,個別填入儲存格,以便後續人工手動填入台語音標、注音符號。 import getopt -import math import sys import xlwings as xw @@ -77,7 +76,6 @@ def get_input_and_output_options(argv): # - 上方:台語音標 # - 下方:台語注音符號 # ========================================================================= - clear_hanji_in_cells(wb) # 清除先前已填入的漢字、注音符號 fill_hanji_in_cells(wb) # 將漢字逐個填入各儲存格 # ========================================================================= diff --git a/a720_Thiam_Zu_Im.py "b/a730_\345\260\207\346\274\242\345\255\227\346\263\250\351\237\263\345\241\253\345\205\245.py" similarity index 99% rename from a720_Thiam_Zu_Im.py rename to "a730_\345\260\207\346\274\242\345\255\227\346\263\250\351\237\263\345\241\253\345\205\245.py" index d44e02e..c8ae25e 100644 --- a/a720_Thiam_Zu_Im.py +++ "b/a730_\345\260\207\346\274\242\345\255\227\346\263\250\351\237\263\345\241\253\345\205\245.py" @@ -1,6 +1,4 @@ import getopt -import math -import os import sys import xlwings as xw diff --git a/a730_Tng_Bang_Iah.py "b/a740_\346\274\242\345\255\227\346\263\250\351\237\263\350\275\211\347\266\262\351\240\201.py" similarity index 99% rename from a730_Tng_Bang_Iah.py rename to "a740_\346\274\242\345\255\227\346\263\250\351\237\263\350\275\211\347\266\262\351\240\201.py" index ea56ac9..c57ef75 100644 --- a/a730_Tng_Bang_Iah.py +++ "b/a740_\346\274\242\345\255\227\346\263\250\351\237\263\350\275\211\347\266\262\351\240\201.py" @@ -1,6 +1,4 @@ import getopt -import math -import os import sys import xlwings as xw diff --git "a/docs/\343\200\212\351\207\221\345\211\233\350\210\254\350\213\245\346\263\242\347\276\205\350\234\234\347\266\223\343\200\213\345\226\204\347\217\276\345\225\237\350\253\213\345\210\206\347\254\254\344\272\214_\346\274\242\345\255\227\346\263\250\351\237\263.html" "b/docs/\343\200\212\351\207\221\345\211\233\350\210\254\350\213\245\346\263\242\347\276\205\350\234\234\347\266\223\343\200\213\345\226\204\347\217\276\345\225\237\350\253\213\345\210\206\347\254\254\344\272\214_\346\274\242\345\255\227\346\263\250\351\237\263.html" new file mode 100644 index 0000000..3fa03de --- /dev/null +++ "b/docs/\343\200\212\351\207\221\345\211\233\350\210\254\350\213\245\346\263\242\347\276\205\350\234\234\347\266\223\343\200\213\345\226\204\347\217\276\345\225\237\350\253\213\345\210\206\347\254\254\344\272\214_\346\274\242\345\255\227\346\263\250\351\237\263.html" @@ -0,0 +1,227 @@ + + + + + 《《金剛般若波羅蜜經》善現啟請分第二》【漢字注音】 + + + + + 《《金剛般若波羅蜜經》善現啟請分第二》【漢字注音】 + + +

+ +kim¹ㄍㄧㆬˉ +kong¹ㄍㆲˉ +pⁿua¹ㄅㄨㆩˉ +na²ㄋㄚˋ +pho¹ㄆㄜˉ +lo⁵ㄌㄜˊ +bit⁸ㆠㄧㆵ˙ +king¹ㄍㄧㄥˉ + +

+sian⁷ㄒㄧㄢ˫ +hian⁷ㄏㄧㄢ˫ +khe²ㄎㆤˋ +cⁿia²ㄑㄧㆩˋ +hun¹ㄏㄨㄣˉ +te⁷ㄉㆤ˫ +ji⁷ㆢㄧ˫ +

+si⁵ㄒㄧˊ +tng⁵ㄉㆭˊ +lau⁷ㄌㄠ˫ +su¹ㄙㄨˉ +phoo⁵ㄆㆦˊ +theh⁸ㄊㆤㆷ˙ +zai⁷ㄗㄞ˫ +tua⁷ㄉㄨㄚ˫ +ziong³ㄐㄧㆲ˪ +tiong¹ㄉㄧㆲˉ + +ziah⁴ㄐㄧㄚㆷ +ziong⁵ㄐㄧㆲˊ +zo⁷ㄗㄜ˫ +khi²ㄎㄧˋ + +phian¹ㄆㄧㄢˉ +than²ㄊㄢˋ +iu⁷ㄧㄨ˫ +king¹ㄍㄧㄥˉ + +iu⁷ㄧㄨ˫ +ciek⁴ㄑㄧㆤ +tio⁰ㄉㄧㄜ˙ +te⁷ㄉㆤ˫ + +hap⁸ㄏㄚㆴ˙ +ziong²ㄐㄧㆲˋ +kiong¹ㄍㄧㆲˉ +king³ㄍㄧㄥ˪ + +li⁵ㄌㄧˊ +peh⁸ㄅㆤㆷ˙ +put⁸ㄅㄨㆵ˙ +gian⁵ㆣㄧㄢˊ + + +hi¹ㄏㄧˉ +u⁷ㄨ˫ + +se³ㄙㆤ˪ +zun¹ㄗㄨㄣˉ + +ju⁵ㆡㄨˊ +lai⁰ㄌㄞ˙ +sian⁷ㄒㄧㄢ˫ +hoo⁷ㄏㆦ˫ +liam⁷ㄌㄧㆰ˫ +zu¹ㄗㄨˉ +phoo⁵ㄆㆦˊ +sat⁴ㄙㄚㆵ + +sian⁷ㄒㄧㄢ˫ +hoo⁷ㄏㆦ˫ +ziok⁴ㄐㄧㆦ +zu¹ㄗㄨˉ +phoo⁵ㄆㆦˊ +sat⁴ㄙㄚㆵ + +se³ㄙㆤ˪ +zun¹ㄗㄨㄣˉ + +sian⁷ㄒㄧㄢ˫ +lam⁵ㄌㆰˊ +zu²ㄗㄨˋ + +sian⁷ㄒㄧㄢ˫ +lu²ㄌㄨˋ +lang⁵ㄌㄤˊ + +huat⁸ㄏㄨㄚㆵ˙ +ㄚˉ +loo⁷ㄌㆦ˫ +to¹ㄉㄜˉ +lo⁵ㄌㄜˊ +sⁿa¹ㄙㆩˉ +biau²ㆠㄧㄠˋ +sⁿa¹ㄙㆩˉ +phoo⁵ㄆㆦˊ +theh⁸ㄊㆤㆷ˙ +sim¹ㄒㄧㆬˉ + +un⁵ㄨㄣˊ +ho⁵ㄏㄜˊ +ing¹ㄧㄥˉ +zu⁷ㄗㄨ˫ + +un⁵ㄨㄣˊ +ho⁵ㄏㄜˊ +kang³ㄍㄤ˪ +hok⁸ㄏㆦ˙ +ki⁵ㄍㄧˊ +sim¹ㄒㄧㆬˉ + + +put⁸ㄅㄨㆵ˙ +gian⁵ㆣㄧㄢˊ + + +sian⁷ㄒㄧㄢ˫ +zai¹ㄗㄞˉ + +sian⁷ㄒㄧㄢ˫ +zai¹ㄗㄞˉ + +su¹ㄙㄨˉ +phoo⁵ㄆㆦˊ +theh⁸ㄊㆤㆷ˙ + +ju⁵ㆡㄨˊ +li²ㄌㄧˋ +soo²ㄙㆦˋ +suat⁴ㄙㄨㄚㆵ + +ju⁵ㆡㄨˊ +lai⁰ㄌㄞ˙ +sian⁷ㄒㄧㄢ˫ +hoo⁷ㄏㆦ˫ +liam⁷ㄌㄧㆰ˫ +zu¹ㄗㄨˉ +phoo⁵ㄆㆦˊ +sat⁴ㄙㄚㆵ + +sian⁷ㄒㄧㄢ˫ +hoo⁷ㄏㆦ˫ +ziok⁴ㄐㄧㆦ +zu¹ㄗㄨˉ +phoo⁵ㄆㆦˊ +sat⁴ㄙㄚㆵ + +li²ㄌㄧˋ +kim¹ㄍㄧㆬˉ +te³ㄉㆤ˪ +thⁿia¹ㄊㄧㆩˉ + +tong¹ㄉㆲˉ +ui⁵ㄨㄧˊ +li²ㄌㄧˋ +suat⁴ㄙㄨㄚㆵ + +sian⁷ㄒㄧㄢ˫ +lam⁵ㄌㆰˊ +zu²ㄗㄨˋ + +sian⁷ㄒㄧㄢ˫ +lu²ㄌㄨˋ +lang⁵ㄌㄤˊ + +huat⁸ㄏㄨㄚㆵ˙ +ㄚˉ +loo⁷ㄌㆦ˫ +to¹ㄉㄜˉ +lo⁵ㄌㄜˊ +sⁿa¹ㄙㆩˉ +biau²ㆠㄧㄠˋ +sⁿa¹ㄙㆩˉ +phoo⁵ㄆㆦˊ +theh⁸ㄊㆤㆷ˙ +sim¹ㄒㄧㆬˉ + +ing¹ㄧㄥˉ +ju⁵ㆡㄨˊ +si⁷ㄒㄧ˫ +zu⁷ㄗㄨ˫ + +ju⁵ㆡㄨˊ +si⁷ㄒㄧ˫ +kang³ㄍㄤ˪ +hok⁸ㄏㆦ˙ +ki⁵ㄍㄧˊ +sim¹ㄒㄧㆬˉ + + + +ui⁵ㄨㄧˊ +lian⁵ㄌㄧㄢˊ + +se³ㄙㆤ˪ +zun¹ㄗㄨㄣˉ + +guan⁷ㆣㄨㄢ˫ +lok⁸ㄌㆦ˙ +beh⁴ㆠㆤㆷ +bun⁵ㆠㄨㄣˊ + + +

+ + + \ No newline at end of file diff --git "a/output2/\343\200\212\351\207\221\351\213\274\347\266\223\343\200\213002.xlsx" "b/output2/\343\200\212\351\207\221\351\213\274\347\266\223\343\200\213002.xlsx" new file mode 100644 index 0000000..dcaef34 Binary files /dev/null and "b/output2/\343\200\212\351\207\221\351\213\274\347\266\223\343\200\213002.xlsx" differ diff --git a/p730_Tng_Sing_Bang_Iah.py b/p730_Tng_Sing_Bang_Iah.py index 5141bc0..d99b731 100644 --- a/p730_Tng_Sing_Bang_Iah.py +++ b/p730_Tng_Sing_Bang_Iah.py @@ -17,15 +17,6 @@ def create_html_file(output_path, content, title='您的標題'): {content} -
-

- 為能正確顯示「注音符號」,請點擊以下連結,下載注音符號專用字型: - - BopomofoRuby1909-v1-Regular.ttf - - ,並於使用之電腦端安裝此字型。 -

-
"""