Skip to content

Commit

Permalink
test persian color names, add persian names to color type as reserved…
Browse files Browse the repository at this point in the history
… values
  • Loading branch information
BaseMax committed Jan 30, 2025
1 parent 5c99404 commit 8b81a92
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/phase/generator/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
/* Generated Styles */
.a {background-color:زرد;font-size:50px}
.a:hover {background-color:سبز}
.a {background-color:yellow;font-size:50px}
.a:hover {background-color:green}
.b {font-size:20px}
.c {color:قرمز;font-size:20px}
.c {color:red;font-size:20px}
</style>
</head>
<body>
Expand Down
2 changes: 2 additions & 0 deletions src/phase/generator/test.salam
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@

محتوا = «به نام خدا»

/*
فونت:
منبع = «Vazirmatn-Bold.ttf»
تمام
*/

باکس:
رنگ پس زمینه = "زرد"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
3 changes: 3 additions & 0 deletions src/runtime/style/attribute/background-color.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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);
}
};
3 changes: 3 additions & 0 deletions src/runtime/style/attribute/color.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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);
}
};

0 comments on commit 8b81a92

Please sign in to comment.