From 8b81a92e7501242fd944a02ed0751116fac5f000 Mon Sep 17 00:00:00 2001 From: Max Base Date: Thu, 30 Jan 2025 13:24:15 +0330 Subject: [PATCH] test persian color names, add persian names to color type as reserved values --- src/phase/generator/test.html | 6 +++--- src/phase/generator/test.salam | 2 ++ .../validator/validation/layout/element_attribute_value.ts | 6 +++--- src/runtime/style/attribute/background-color.ts | 3 +++ src/runtime/style/attribute/color.ts | 3 +++ 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/phase/generator/test.html b/src/phase/generator/test.html index 8190635a..20a56052 100644 --- a/src/phase/generator/test.html +++ b/src/phase/generator/test.html @@ -6,10 +6,10 @@ diff --git a/src/phase/generator/test.salam b/src/phase/generator/test.salam index e548881e..d213b97b 100644 --- a/src/phase/generator/test.salam +++ b/src/phase/generator/test.salam @@ -3,9 +3,11 @@ محتوا = «به نام خدا» + /* فونت: منبع = «Vazirmatn-Bold.ttf» تمام + */ باکس: رنگ پس زمینه = "زرد" diff --git a/src/phase/validator/validation/layout/element_attribute_value.ts b/src/phase/validator/validation/layout/element_attribute_value.ts index a7a0b726..21ab60ff 100644 --- a/src/phase/validator/validation/layout/element_attribute_value.ts +++ b/src/phase/validator/validation/layout/element_attribute_value.ts @@ -93,11 +93,11 @@ export function validateLayoutElementAttributeValue(validator: Validator, attrib if (value.startsWith("#") === true) { if ((value.length !== 7 && value.length !== 4) || !/^#[0-9A-F]{6}$/i.test(value)) { return error; + } else { + return undefined } - } else { - } - return undefined; + return error; } case RuntimeElementAttributeType.Colors: { diff --git a/src/runtime/style/attribute/background-color.ts b/src/runtime/style/attribute/background-color.ts index 887c5adb..89d3dde7 100644 --- a/src/runtime/style/attribute/background-color.ts +++ b/src/runtime/style/attribute/background-color.ts @@ -1,3 +1,4 @@ +import { color } from './../../data/style/values/color'; import { LanguageID } from '../../../common/language/language'; import { RuntimeElementAttributeType } from '../../element_attribute_type'; import { RuntimeElementAttributeStyle } from '../../element_attribute_style'; @@ -7,5 +8,7 @@ export class RuntimeStyleBackgroundColor extends RuntimeElementAttributeStyle { super(RuntimeElementAttributeType.Color, "background-color"); this.addText(LanguageID.LanguagePersian, "رنگ پس زمینه"); this.addText(LanguageID.LanguageEnglish, "background color"); + + this.addReservedValues(color); } }; diff --git a/src/runtime/style/attribute/color.ts b/src/runtime/style/attribute/color.ts index 058a2a4d..8e05f2b1 100644 --- a/src/runtime/style/attribute/color.ts +++ b/src/runtime/style/attribute/color.ts @@ -1,3 +1,4 @@ +import { color } from './../../data/style/values/color'; import { LanguageID } from '../../../common/language/language'; import { RuntimeElementAttributeType } from '../../element_attribute_type'; import { RuntimeElementAttributeStyle } from '../../element_attribute_style'; @@ -7,5 +8,7 @@ export class RuntimeStyleColor extends RuntimeElementAttributeStyle { super(RuntimeElementAttributeType.Color, "color"); this.addText(LanguageID.LanguagePersian, "رنگ"); this.addText(LanguageID.LanguageEnglish, "color"); + + this.addReservedValues(color); } };