diff --git a/docs/RELEASE.md b/docs/RELEASE.md index a613397..4ed3203 100644 --- a/docs/RELEASE.md +++ b/docs/RELEASE.md @@ -1,5 +1,16 @@ # Release Notes +## Update 2024.05.10:**V1.1.0.2** Released + +Major changes: + +* Fixed the error caused by empty lines in `merge_line_texts`. + +主要变更: + +* 修复 `merge_line_texts` 中空行导致的错误。 + + ## Update 2024.04.30:**V1.1.0.1** Released Major changes: diff --git a/pix2text/__version__.py b/pix2text/__version__.py index 69bfb4d..1926b15 100644 --- a/pix2text/__version__.py +++ b/pix2text/__version__.py @@ -2,4 +2,4 @@ # [Pix2Text](https://github.com/breezedeus/pix2text): an Open-Source Alternative to Mathpix. # Copyright (C) 2022-2024, [Breezedeus](https://www.breezedeus.com). -__version__ = '1.1.0.1' +__version__ = '1.1.0.2' diff --git a/pix2text/utils.py b/pix2text/utils.py index 97b1c0d..d1aa994 100644 --- a/pix2text/utils.py +++ b/pix2text/utils.py @@ -914,8 +914,8 @@ def merge_line_texts( min_x, max_x = cal_block_xmin_xmax(lines, indentation_thrsh) - line_text_list = [(idx, txt) for idx, txt in enumerate(line_text_list) if txt] res_line_texts = [''] * len(line_text_list) + line_text_list = [(idx, txt) for idx, txt in enumerate(line_text_list) if txt] for idx, (line_number, txt) in enumerate(line_text_list): if isolated_included[line_number]: res_line_texts[line_number] = line_sep + txt + line_sep @@ -938,5 +938,5 @@ def merge_line_texts( tmp = tmp + line_sep res_line_texts[idx] = tmp - outs = smart_join(res_line_texts, spellchecker) + outs = smart_join([c for c in res_line_texts if c], spellchecker) return re.sub(rf'{line_sep}+', line_sep, outs) # 把多个 '\n' 替换为 '\n'