feat(rules): 建立共享排版契约并收束 WebKit 与 Unicode 基线
This commit is contained in:
@@ -0,0 +1,267 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://juzhen.dev/schemas/golden-vectors.schema.json",
|
||||
"title": "Juzhen shared rules golden vectors",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [ "schemaVersion", "rulesetVersion", "vectors" ],
|
||||
"properties": {
|
||||
"$schema": { "type": "string" },
|
||||
"schemaVersion": { "const": 1 },
|
||||
"rulesetVersion": {
|
||||
"type": "string",
|
||||
"pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
|
||||
},
|
||||
"vectors": {
|
||||
"type": "array",
|
||||
"minItems": 20,
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{ "$ref": "#/$defs/languageVector" },
|
||||
{ "$ref": "#/$defs/punctuationClassVector" },
|
||||
{ "$ref": "#/$defs/punctuationStyleVector" },
|
||||
{ "$ref": "#/$defs/punctuationAdjacencyVector" },
|
||||
{ "$ref": "#/$defs/spacingVector" },
|
||||
{ "$ref": "#/$defs/ivsAtomVector" },
|
||||
{ "$ref": "#/$defs/jinzeVector" },
|
||||
{ "$ref": "#/$defs/orphanVector" }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"$defs": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
|
||||
},
|
||||
"punctuationClass": {
|
||||
"enum": [ "stop", "pause", "open", "close", "middle", "liga" ]
|
||||
},
|
||||
"style": {
|
||||
"enum": [ "quanjiao", "kaiming", "banjiao" ]
|
||||
},
|
||||
"atoms": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": { "type": "string", "minLength": 1 }
|
||||
},
|
||||
"languageVector": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [ "id", "category", "input", "expected" ],
|
||||
"properties": {
|
||||
"id": { "$ref": "#/$defs/id" },
|
||||
"category": { "const": "language-classification" },
|
||||
"input": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [ "lang" ],
|
||||
"properties": {
|
||||
"lang": { "type": "string" }
|
||||
}
|
||||
},
|
||||
"expected": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [ "langClass" ],
|
||||
"properties": {
|
||||
"langClass": { "enum": [ "zh-Hans", "zh-Hant", "ja", "other" ] }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"punctuationClassVector": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [ "id", "category", "input", "expected" ],
|
||||
"properties": {
|
||||
"id": { "$ref": "#/$defs/id" },
|
||||
"category": { "const": "punctuation-classification" },
|
||||
"input": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [ "character" ],
|
||||
"properties": {
|
||||
"character": { "type": "string", "minLength": 1 }
|
||||
}
|
||||
},
|
||||
"expected": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [ "punctuationClass" ],
|
||||
"properties": {
|
||||
"punctuationClass": {
|
||||
"oneOf": [ { "$ref": "#/$defs/punctuationClass" }, { "type": "null" } ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"punctuationStyleVector": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [ "id", "category", "input", "expected" ],
|
||||
"properties": {
|
||||
"id": { "$ref": "#/$defs/id" },
|
||||
"category": { "const": "punctuation-style" },
|
||||
"input": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [ "style", "punctuationClass" ],
|
||||
"properties": {
|
||||
"style": { "$ref": "#/$defs/style" },
|
||||
"punctuationClass": { "$ref": "#/$defs/punctuationClass" }
|
||||
}
|
||||
},
|
||||
"expected": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [ "halfWidth" ],
|
||||
"properties": {
|
||||
"halfWidth": { "type": "boolean" }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"punctuationAdjacencyVector": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [ "id", "category", "input", "expected" ],
|
||||
"properties": {
|
||||
"id": { "$ref": "#/$defs/id" },
|
||||
"category": { "const": "punctuation-adjacency" },
|
||||
"input": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [ "left", "right" ],
|
||||
"properties": {
|
||||
"left": { "$ref": "#/$defs/punctuationClass" },
|
||||
"right": { "$ref": "#/$defs/punctuationClass" }
|
||||
}
|
||||
},
|
||||
"expected": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [ "squeezeLeft", "squeezeRight" ],
|
||||
"properties": {
|
||||
"squeezeLeft": { "type": "boolean" },
|
||||
"squeezeRight": { "type": "boolean" }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"spacingVector": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [ "id", "category", "input", "expected" ],
|
||||
"properties": {
|
||||
"id": { "$ref": "#/$defs/id" },
|
||||
"category": { "const": "spacing" },
|
||||
"input": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [ "text" ],
|
||||
"properties": {
|
||||
"text": { "type": "string" }
|
||||
}
|
||||
},
|
||||
"expected": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [ "managedGaps", "normalizedText" ],
|
||||
"properties": {
|
||||
"managedGaps": { "type": "integer", "minimum": 0 },
|
||||
"normalizedText": { "type": "string" },
|
||||
"gapEm": { "const": 0.25 },
|
||||
"authorSpaceDisposition": {
|
||||
"enum": [ "remove-and-use-managed-gap", "remove-without-gap" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ivsAtomVector": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [ "id", "category", "input", "expected" ],
|
||||
"properties": {
|
||||
"id": { "$ref": "#/$defs/id" },
|
||||
"category": { "const": "ivs-atom" },
|
||||
"input": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [ "text" ],
|
||||
"properties": {
|
||||
"text": { "type": "string", "minLength": 1 }
|
||||
}
|
||||
},
|
||||
"expected": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [ "atoms" ],
|
||||
"properties": {
|
||||
"atoms": { "$ref": "#/$defs/atoms" }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"jinzeVector": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [ "id", "category", "input", "expected" ],
|
||||
"properties": {
|
||||
"id": { "$ref": "#/$defs/id" },
|
||||
"category": { "const": "jinze" },
|
||||
"input": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [ "left", "right" ],
|
||||
"properties": {
|
||||
"left": { "type": "string", "minLength": 1 },
|
||||
"right": { "type": "string", "minLength": 1 }
|
||||
}
|
||||
},
|
||||
"expected": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [ "prohibitedBreak" ],
|
||||
"properties": {
|
||||
"prohibitedBreak": { "type": "boolean" },
|
||||
"reason": { "enum": [ "before-stop", "before-close", "after-open" ] },
|
||||
"atoms": { "$ref": "#/$defs/atoms" }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"orphanVector": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [ "id", "category", "input", "expected" ],
|
||||
"properties": {
|
||||
"id": { "$ref": "#/$defs/id" },
|
||||
"category": { "const": "orphan" },
|
||||
"input": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [ "text", "minimum" ],
|
||||
"properties": {
|
||||
"text": { "type": "string", "minLength": 1 },
|
||||
"minimum": { "type": "integer", "minimum": 1 }
|
||||
}
|
||||
},
|
||||
"expected": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [ "meaningfulCjkCount", "protectedSuffix" ],
|
||||
"properties": {
|
||||
"meaningfulCjkCount": { "type": "integer", "minimum": 0 },
|
||||
"protectedSuffix": {
|
||||
"oneOf": [ { "type": "string" }, { "type": "null" } ]
|
||||
},
|
||||
"atoms": { "$ref": "#/$defs/atoms" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user