From 9510998a2e9486c6a63ecc6e6e9a3ecf1a732421 Mon Sep 17 00:00:00 2001 From: breezedeus Date: Fri, 10 May 2024 16:21:45 +0800 Subject: [PATCH 1/2] bugfix --- pix2text/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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' From 3ca7d164c398d3a779a5797a8939f6d106d6ffa8 Mon Sep 17 00:00:00 2001 From: breezedeus Date: Fri, 10 May 2024 16:25:33 +0800 Subject: [PATCH 2/2] bugfix --- docs/RELEASE.md | 11 +++++++++++ pix2text/__version__.py | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) 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'