MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / normalize_inline_bullets

Function normalize_inline_bullets

demo/posterbuilder/convert.py:154–165  ·  view source on GitHub ↗

把 Unicode 的 • 统一替换为 LaTeX 的 \\textbullet{},并确保两侧留空格。

(s: str)

Source from the content-addressed store, hash-verified

152_BULLET_RE = re.compile(r"•")
153
154def normalize_inline_bullets(s: str) -> str:
155 """
156 把 Unicode 的 • 统一替换为 LaTeX 的 \\textbullet{},并确保两侧留空格。
157 """
158 if not s:
159 return s
160 s = _BULLET_RE.sub(r"\\textbullet{}", s)
161 # 若两侧无空格,补空格(避免“黏连”)
162 s = re.sub(r"(?<=\S)\\textbullet\{\}(?=\S)", r" \\textbullet{} ", s)
163 s = re.sub(r"\\textbullet\{\}(?=\S)", r"\\textbullet{} ", s)
164 s = re.sub(r"(?<=\S)\\textbullet\{\}", r" \\textbullet{}", s)
165 return s
166
167def normalize_textit_math(s: str) -> str:
168 """

Callers

nothing calls this directly

Calls 1

subMethod · 0.45

Tested by

no test coverage detected