Commit 74ee428b authored by myhloli's avatar myhloli
Browse files

fix(dict2md): add space for inline equations in CJK contexts

- In Chinese, Japanese, and Korean (CJK) languages, no space is needed for line breaks within paragraphs.
- However, if an inline equation is at the end of a line, a space should be added to separate it from the following text.
- This change improves the formatting of documents containing both CJK text and inline equations.
parent 012a46e0
...@@ -165,8 +165,8 @@ def merge_para_with_text(para_block): ...@@ -165,8 +165,8 @@ def merge_para_with_text(para_block):
if content: if content:
langs = ['zh', 'ja', 'ko'] langs = ['zh', 'ja', 'ko']
# logger.info(f'block_lang: {block_lang}, content: {content}') # logger.info(f'block_lang: {block_lang}, content: {content}')
if block_lang in langs: # 中文/日语/韩文语境下,换行不需要空格分隔 if block_lang in langs: # 中文/日语/韩文语境下,换行不需要空格分隔,但是如果是行内公式结尾,还是要加空格
if j == len(line['spans']) - 1: if j == len(line['spans']) - 1 and span_type not in [ContentType.InlineEquation]:
para_text += content para_text += content
else: else:
para_text += f'{content} ' para_text += f'{content} '
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment