Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: Parse Microsoft PowerPoint ordered list markers https://github.com/siyuan-note/siyuan/issues/18756 (#18794)

Achuan-2dde8104c3939
diff --git a/app/src/protyle/util/officeList.test.ts b/app/src/protyle/util/officeList.test.ts
index 1228ac16c3..ea6a9abae8 100644
--- a/app/src/protyle/util/officeList.test.ts
+++ b/app/src/protyle/util/officeList.test.ts
@@ -34,7 +34,9 @@ describe("Office list style parsing", () => {
it("only accepts actual PowerPoint bullet formats", () => {
assert.equal(parsePptSpecialFormat("mso-special-format: bullet"), "bullet");
assert.equal(parsePptSpecialFormat("MSO-SPECIAL-FORMAT:numbullet"), "numbullet");
+ assert.equal(parsePptSpecialFormat("mso-special-format:\"numbullet3\\,1\""), "numbullet");
assert.equal(parsePptSpecialFormat("mso-special-format:nobullet"), undefined);
+ assert.equal(parsePptSpecialFormat("mso-special-format:bulletproof"), undefined);
assert.equal(parsePptSpecialFormat("mso-special-format:lastCR"), undefined);
});
diff --git a/app/src/protyle/util/officeList.ts b/app/src/protyle/util/officeList.ts
index 2cba6d72e3..8f6f7bfcf8 100644
--- a/app/src/protyle/util/officeList.ts
+++ b/app/src/protyle/util/officeList.ts
@@ -119,7 +119,11 @@ export const parseWordListStyle = (style: string) => {
export const parsePptSpecialFormat = (style: string): "bullet" | "numbullet" | undefined => {
const value = parseInlineStyle(style)["mso-special-format"]?.trim().toLowerCase();
- return value === "bullet" || value === "numbullet" ? value : undefined;
+ const normalized = value?.replace(/^(["'])(.*)\1$/, "$2").trim();
+ if (normalized && /^numbullet(?:[\d\\,]+)?$/.test(normalized)) {
+ return "numbullet";
+ }
+ return normalized && /^bullet(?:[\d\\,]+)?$/.test(normalized) ? "bullet" : undefined;
};
export const parseCssLengthToPoints = (value: string) => {