From 6a74746113c724e750620d10b58ad6bac94060c9 Mon Sep 17 00:00:00 2001 From: Stephen Kraus <8003332+stephenmk@users.noreply.github.com> Date: Sat, 14 May 2022 08:59:38 -0500 Subject: Add new structured content features: lists and the HTML `lang` attribute (#2129) * Add support for structured content lists and `list-style-type` style A full list of supported style types is documented here: https://developer.mozilla.org/en-US/docs/Web/CSS/list-style-type There's nothing in this code preventing a term bank from assigning, for example, a `list-style-type` style to a `div` element, but it doesn't seem like browsers will complain about things like that. * Add support for `lang` attribute in structured content Support added for the following node types: "ruby", "rt", "rp", "table", "thead", "tbody", "tfoot", "tr", "td", "th", "span", "div", "ol", "ul", "li", "a" I couldn't get it to work for the alt-hover text on "img" tags. Tests are included in the file "test/data/dictionaries/valid-dictionary/term_bank_1.json" * Add styles for structured content lists * Add override rules for new structured-content list styles see: https://github.com/FooSoft/yomichan/pull/2129 Co-authored-by: stephenmk --- .../schemas/dictionary-term-bank-v3-schema.json | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'ext/data') diff --git a/ext/data/schemas/dictionary-term-bank-v3-schema.json b/ext/data/schemas/dictionary-term-bank-v3-schema.json index 268a2c11..12c2e4f3 100644 --- a/ext/data/schemas/dictionary-term-bank-v3-schema.json +++ b/ext/data/schemas/dictionary-term-bank-v3-schema.json @@ -51,6 +51,10 @@ }, "data": { "$ref": "#/definitions/structuredContentData" + }, + "lang": { + "type": "string", + "description": "Defines the language of an element in the format defined by RFC 5646." } } }, @@ -82,6 +86,10 @@ }, "style": { "$ref": "#/definitions/structuredContentStyle" + }, + "lang": { + "type": "string", + "description": "Defines the language of an element in the format defined by RFC 5646." } } }, @@ -95,7 +103,7 @@ "properties": { "tag": { "type": "string", - "enum": ["span", "div"] + "enum": ["span", "div", "ol", "ul", "li"] }, "content": { "$ref": "#/definitions/structuredContent" @@ -105,6 +113,10 @@ }, "style": { "$ref": "#/definitions/structuredContentStyle" + }, + "lang": { + "type": "string", + "description": "Defines the language of an element in the format defined by RFC 5646." } } }, @@ -206,6 +218,10 @@ "type": "string", "description": "The URL for the link. URLs starting with a ? are treated as internal links to other dictionary content.", "pattern": "^(?:https?:|\\?)[\\w\\W]*" + }, + "lang": { + "type": "string", + "description": "Defines the language of an element in the format defined by RFC 5646." } } } @@ -276,6 +292,10 @@ "marginBottom": { "type": "number", "default": 0 + }, + "listStyleType": { + "type": "string", + "default": "disc" } } } -- cgit v1.2.3