diff --git a/config/docs.md b/config/docs.md index 9a3ea6d1..31e0862a 100644 --- a/config/docs.md +++ b/config/docs.md @@ -375,6 +375,16 @@ نام این دستور معادل دستور `font` می‌باشد. +این دستور دارای ویژگی‌های زیر می‌باشد: + +| نام ویژگی | توضیح | تولید | +|-----------|------------|-------| +| `نام` | | `name` | +| `منبع` | | `src` | +| `محدود یونیکد` | | `unicode_range` | +| `سبک` | | `style` | +| `وزن` | | `weight` | +

دستور واکنش گرا

این دستور مادر است و می تواند حامی دستوراتی به عنوان فرزند باشد. diff --git a/config/json/layout/attribute/type.json b/config/json/layout/attribute/type.json index 6dc23603..c19ecd66 100644 --- a/config/json/layout/attribute/type.json +++ b/config/json/layout/attribute/type.json @@ -8,7 +8,7 @@ "generate_name": "group", "id": "AST_LAYOUT_ATTRIBUTE_TYPE_GROUP", "reserved_values": "", - "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING", + "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY", "text": { "en": [ "group" @@ -18,11 +18,53 @@ ] } }, + { + "generate_name": "weight", + "id": "AST_LAYOUT_ATTRIBUTE_TYPE_WEIGHT", + "reserved_values": "", + "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY", + "text": { + "en": [ + "weight" + ], + "fa": [ + "وزن" + ] + } + }, + { + "generate_name": "unicode_range", + "id": "AST_LAYOUT_ATTRIBUTE_TYPE_UNICODE_RANGE", + "reserved_values": "", + "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY", + "text": { + "en": [ + "unicode range" + ], + "fa": [ + "محدود یونیکد" + ] + } + }, + { + "generate_name": "style", + "id": "AST_LAYOUT_ATTRIBUTE_TYPE_STYLE", + "reserved_values": "", + "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY", + "text": { + "en": [ + "style" + ], + "fa": [ + "سبک" + ] + } + }, { "generate_name": "class", "id": "AST_LAYOUT_ATTRIBUTE_TYPE_CLASS", "reserved_values": "", - "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING", + "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY", "description": { "fa": "ویژگی کلاس جهت تنظیم نام کلاس برای یک دستور می‌باشد." }, @@ -39,7 +81,7 @@ "generate_name": "id", "id": "AST_LAYOUT_ATTRIBUTE_TYPE_ID", "reserved_values": "", - "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING", + "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY", "description": { "fa": "ویژگی شناسه جهت تنظیم شناسه برای یک دستور می‌باشد." }, @@ -56,7 +98,7 @@ "generate_name": "content", "id": "AST_LAYOUT_ATTRIBUTE_TYPE_CONTENT", "reserved_values": "", - "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING", + "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY", "description": { "fa": "جهت تنظیم یک محتوا به یک دستور می‌باشد." }, @@ -73,7 +115,7 @@ "generate_name": "src", "id": "AST_LAYOUT_ATTRIBUTE_TYPE_SRC", "reserved_values": "", - "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING", + "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY", "text": { "en": [ "src" @@ -87,7 +129,7 @@ "generate_name": "label", "id": "AST_LAYOUT_ATTRIBUTE_TYPE_LABEL", "reserved_values": "", - "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING", + "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY", "text": { "en": [ "label" @@ -143,7 +185,7 @@ "generate_name": "title", "id": "AST_LAYOUT_ATTRIBUTE_TYPE_TITLE", "reserved_values": "", - "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING", + "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY", "text": { "en": [ "title" @@ -185,7 +227,7 @@ "generate_name": "author", "id": "AST_LAYOUT_ATTRIBUTE_TYPE_AUTHOR", "reserved_values": "", - "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING", + "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY", "text": { "en": [ "author" @@ -199,7 +241,7 @@ "generate_name": "description", "id": "AST_LAYOUT_ATTRIBUTE_TYPE_DESCRIPTION", "reserved_values": "", - "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING", + "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY", "text": { "en": [ "description" @@ -213,7 +255,7 @@ "generate_name": "keywords", "id": "AST_LAYOUT_ATTRIBUTE_TYPE_KEYWORDS", "reserved_values": "", - "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING", + "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY", "text": { "en": [ "keywords" @@ -227,7 +269,7 @@ "generate_name": "icon", "id": "AST_LAYOUT_ATTRIBUTE_TYPE_ICON", "reserved_values": "", - "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING", + "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY", "text": { "en": [ "icon" @@ -241,7 +283,7 @@ "generate_name": "name", "id": "AST_LAYOUT_ATTRIBUTE_TYPE_NAME", "reserved_values": "", - "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING", + "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY", "text": { "en": [ "name" @@ -269,7 +311,7 @@ "generate_name": "refresh", "id": "AST_LAYOUT_ATTRIBUTE_TYPE_REFRESH", "reserved_values": "", - "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING", + "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY", "text": { "en": [ "refresh" @@ -283,7 +325,7 @@ "generate_name": "viewport", "id": "AST_LAYOUT_ATTRIBUTE_TYPE_VIEWPORT", "reserved_values": "", - "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING", + "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY", "text": { "en": [ "viewport" @@ -297,7 +339,7 @@ "generate_name": "value", "id": "AST_LAYOUT_ATTRIBUTE_TYPE_VALUE", "reserved_values": "", - "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING", + "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY", "text": { "en": [ "value" @@ -311,7 +353,7 @@ "generate_name": "for", "id": "AST_LAYOUT_ATTRIBUTE_TYPE_FOR", "reserved_values": "", - "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING", + "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY", "text": { "en": [ "for" @@ -325,7 +367,7 @@ "generate_name": "placeholder", "id": "AST_LAYOUT_ATTRIBUTE_TYPE_PLACEHOLDER", "reserved_values": "", - "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING", + "type": "AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY", "text": { "en": [ "placeholder" diff --git a/config/json/layout/type.json b/config/json/layout/type.json index a39f079f..2f5d8083 100644 --- a/config/json/layout/type.json +++ b/config/json/layout/type.json @@ -858,6 +858,13 @@ "descriptions": "", "examples": "", "generate_name": "font", + "attributes": [ + "AST_LAYOUT_ATTRIBUTE_TYPE_NAME", + "AST_LAYOUT_ATTRIBUTE_TYPE_SRC", + "AST_LAYOUT_ATTRIBUTE_TYPE_UNICODE_RANGE", + "AST_LAYOUT_ATTRIBUTE_TYPE_STYLE", + "AST_LAYOUT_ATTRIBUTE_TYPE_WEIGHT" + ], "id": "AST_LAYOUT_TYPE_FONT", "is_mother": true, "text": { diff --git a/config/layout/attribute/type.yaml b/config/layout/attribute/type.yaml index 1c1baabc..3c8f374a 100644 --- a/config/layout/attribute/type.yaml +++ b/config/layout/attribute/type.yaml @@ -4,16 +4,43 @@ items: - generate_name: group id: AST_LAYOUT_ATTRIBUTE_TYPE_GROUP reserved_values: '' - type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING + type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY text: en: - group fa: - گروه + - generate_name: weight + id: AST_LAYOUT_ATTRIBUTE_TYPE_WEIGHT + reserved_values: '' + type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY + text: + en: + - weight + fa: + - وزن + - generate_name: unicode_range + id: AST_LAYOUT_ATTRIBUTE_TYPE_UNICODE_RANGE + reserved_values: '' + type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY + text: + en: + - unicode range + fa: + - محدود یونیکد + - generate_name: style + id: AST_LAYOUT_ATTRIBUTE_TYPE_STYLE + reserved_values: '' + type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY + text: + en: + - style + fa: + - سبک - generate_name: class id: AST_LAYOUT_ATTRIBUTE_TYPE_CLASS reserved_values: '' - type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING + type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY description: fa: 'ویژگی کلاس جهت تنظیم نام کلاس برای یک دستور می‌باشد.' text: @@ -24,7 +51,7 @@ items: - generate_name: id id: AST_LAYOUT_ATTRIBUTE_TYPE_ID reserved_values: '' - type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING + type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY description: fa: 'ویژگی شناسه جهت تنظیم شناسه برای یک دستور می‌باشد.' text: @@ -35,7 +62,7 @@ items: - generate_name: content id: AST_LAYOUT_ATTRIBUTE_TYPE_CONTENT reserved_values: '' - type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING + type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY description: fa: 'جهت تنظیم یک محتوا به یک دستور می‌باشد.' text: @@ -46,7 +73,7 @@ items: - generate_name: src id: AST_LAYOUT_ATTRIBUTE_TYPE_SRC reserved_values: '' - type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING + type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY text: en: - src @@ -55,7 +82,7 @@ items: - generate_name: label id: AST_LAYOUT_ATTRIBUTE_TYPE_LABEL reserved_values: '' - type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING + type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY text: en: - label @@ -91,7 +118,7 @@ items: - generate_name: title id: AST_LAYOUT_ATTRIBUTE_TYPE_TITLE reserved_values: '' - type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING + type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY text: en: - title @@ -118,7 +145,7 @@ items: - generate_name: author id: AST_LAYOUT_ATTRIBUTE_TYPE_AUTHOR reserved_values: '' - type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING + type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY text: en: - author @@ -127,7 +154,7 @@ items: - generate_name: description id: AST_LAYOUT_ATTRIBUTE_TYPE_DESCRIPTION reserved_values: '' - type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING + type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY text: en: - description @@ -136,7 +163,7 @@ items: - generate_name: keywords id: AST_LAYOUT_ATTRIBUTE_TYPE_KEYWORDS reserved_values: '' - type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING + type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY text: en: - keywords @@ -145,7 +172,7 @@ items: - generate_name: icon id: AST_LAYOUT_ATTRIBUTE_TYPE_ICON reserved_values: '' - type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING + type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY text: en: - icon @@ -154,7 +181,7 @@ items: - generate_name: name id: AST_LAYOUT_ATTRIBUTE_TYPE_NAME reserved_values: '' - type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING + type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY text: en: - name @@ -172,7 +199,7 @@ items: - generate_name: refresh id: AST_LAYOUT_ATTRIBUTE_TYPE_REFRESH reserved_values: '' - type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING + type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY text: en: - refresh @@ -181,7 +208,7 @@ items: - generate_name: viewport id: AST_LAYOUT_ATTRIBUTE_TYPE_VIEWPORT reserved_values: '' - type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING + type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY text: en: - viewport @@ -190,7 +217,7 @@ items: - generate_name: value id: AST_LAYOUT_ATTRIBUTE_TYPE_VALUE reserved_values: '' - type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING + type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY text: en: - value @@ -199,7 +226,7 @@ items: - generate_name: for id: AST_LAYOUT_ATTRIBUTE_TYPE_FOR reserved_values: '' - type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING + type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY text: en: - for @@ -208,7 +235,7 @@ items: - generate_name: placeholder id: AST_LAYOUT_ATTRIBUTE_TYPE_PLACEHOLDER reserved_values: '' - type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING + type: AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY text: en: - placeholder diff --git a/config/layout/type.yaml b/config/layout/type.yaml index f0e58951..74e59793 100644 --- a/config/layout/type.yaml +++ b/config/layout/type.yaml @@ -581,6 +581,12 @@ items: - descriptions: '' examples: '' generate_name: font + attributes: + - AST_LAYOUT_ATTRIBUTE_TYPE_NAME + - AST_LAYOUT_ATTRIBUTE_TYPE_SRC + - AST_LAYOUT_ATTRIBUTE_TYPE_UNICODE_RANGE + - AST_LAYOUT_ATTRIBUTE_TYPE_STYLE + - AST_LAYOUT_ATTRIBUTE_TYPE_WEIGHT id: AST_LAYOUT_TYPE_FONT is_mother: true text: diff --git a/example/another-test.salam b/example/another-test.salam index 1e4e6ceb..03b127f1 100644 --- a/example/another-test.salam +++ b/example/another-test.salam @@ -3,7 +3,7 @@ رنگ پس زمینه = "زرد" /* - فراخوانی: + بارگیری: تکرار = ۲۰ منبع = "example/include.salam" تمام diff --git a/example/card.salam b/example/card.salam index 2d62225a..8978a9f9 100644 --- a/example/card.salam +++ b/example/card.salam @@ -1,6 +1,6 @@ صفحه: - فراخوانی: - منبع = "../example/card-header.salam" + بارگیری: + منبع = "example/card-header.salam" تمام جعبه: diff --git a/example/custom-font.salam b/example/custom-font.salam index e085f3cf..5078e179 100644 --- a/example/custom-font.salam +++ b/example/custom-font.salam @@ -1,20 +1,4 @@ صفحه: عنوان = "test me" - قلم: - نام = "Vazirmatn" - سبک = "معمولی" - وزن = 400 - //محدود یونیکد = "U+0460-052F", "U+1C80-1C88", "U+20B4", "U+2DE0-2DFF", "U+A640-A69F", "U+FE2E-FE2F" - منبع = "https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/fonts/webfonts/Vazirmatn-Thin.woff2" - تمام - - جعبه: - نام قلم = "Vazirmatn" - محتوا = "Hi there, it's a custom font???" - - هاور: - اندازه قلم = ۵۰ - تمام - تمام تمام diff --git a/example/input.salam b/example/input.salam index 7146c71b..3b4be9b0 100644 --- a/example/input.salam +++ b/example/input.salam @@ -14,6 +14,11 @@ گردی = ۹ تمام + بارگیری: + فضا بالا = ۲۰ + منبع = «example/card.salam» + تمام + جعبه: رنگ پس زمینه = «بنفش» رنگ = «سفید» diff --git a/example/test-include.salam b/example/test-include.salam index 948f8b99..1ffc3ca5 100644 --- a/example/test-include.salam +++ b/example/test-include.salam @@ -1,6 +1,6 @@ صفحه: - فراخوانی: + بارگیری: تکرار= 10 منبع= "../example/card.salam" تمام diff --git a/src/generated-config/ast_block_type.h b/src/generated-config/ast_block_type.h index 8ee91a12..0323a96a 100644 --- a/src/generated-config/ast_block_type.h +++ b/src/generated-config/ast_block_type.h @@ -11,3 +11,5 @@ ADD_BLOCK_TYPE(AST_BLOCK_TYPE_ERROR, "ERROR", "error") // ----------- END AUTO GENERATED ----------- // + + diff --git a/src/generated-config/ast_layout_attribute_style_global.h b/src/generated-config/ast_layout_attribute_style_global.h index dd1dde68..5cc5e812 100644 --- a/src/generated-config/ast_layout_attribute_style_global.h +++ b/src/generated-config/ast_layout_attribute_style_global.h @@ -11,3 +11,5 @@ ADD_LAYOUT_ATTRIBUTE_STYLE_GLOBAL_VALUE(unset, "حذف شده") // ----------- END AUTO GENERATED ----------- // + + diff --git a/src/generated-config/ast_layout_attribute_style_state_type.h b/src/generated-config/ast_layout_attribute_style_state_type.h index 6712257c..e4a111a8 100644 --- a/src/generated-config/ast_layout_attribute_style_state_type.h +++ b/src/generated-config/ast_layout_attribute_style_state_type.h @@ -71,3 +71,5 @@ ADD_LAYOUT_ATTRIBUTE_STYLE_STATE_TYPE(AST_LAYOUT_ATTRIBUTE_STYLE_STATE_TYPE_EMPT // ----------- END AUTO GENERATED ----------- // + + diff --git a/src/generated-config/ast_layout_attribute_style_type.h b/src/generated-config/ast_layout_attribute_style_type.h index 1cf06674..65d3a9e6 100644 --- a/src/generated-config/ast_layout_attribute_style_type.h +++ b/src/generated-config/ast_layout_attribute_style_type.h @@ -570,3 +570,5 @@ ADD_LAYOUT_ATTRIBUTE_STYLE_TYPE_HIDE(AST_LAYOUT_ATTRIBUTE_STYLE_TYPE_ERROR, "ERR // ----------- END AUTO GENERATED ----------- // + + diff --git a/src/generated-config/ast_layout_attribute_style_value.h b/src/generated-config/ast_layout_attribute_style_value.h index 68422bfb..5f2020ff 100644 --- a/src/generated-config/ast_layout_attribute_style_value.h +++ b/src/generated-config/ast_layout_attribute_style_value.h @@ -1474,3 +1474,5 @@ const ast_layout_attribute_pair_t ast_layout_allowed_style_list_zoom[] = { #endif + + diff --git a/src/generated-config/ast_layout_attribute_style_value_extern.h b/src/generated-config/ast_layout_attribute_style_value_extern.h index 96c9642c..28f7d50e 100644 --- a/src/generated-config/ast_layout_attribute_style_value_extern.h +++ b/src/generated-config/ast_layout_attribute_style_value_extern.h @@ -361,3 +361,5 @@ extern const ast_layout_attribute_pair_t ast_layout_allowed_style_list_zoom[]; // ----------- END AUTO GENERATED ----------- // + + diff --git a/src/generated-config/ast_layout_attribute_type.h b/src/generated-config/ast_layout_attribute_type.h index 4e9408db..0cf889f1 100644 --- a/src/generated-config/ast_layout_attribute_type.h +++ b/src/generated-config/ast_layout_attribute_type.h @@ -1,17 +1,23 @@ // ----------- BEGIN AUTO GENERATED ----------- // ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_ERROR, "ERROR", "error", "", "", AST_LAYOUT_ATTRIBUTE_FILTER_STRING, NULL, NULL) -ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_GROUP, "GROUP", "group", "گروه", "group", AST_LAYOUT_ATTRIBUTE_FILTER_STRING, NULL, NULL) +ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_GROUP, "GROUP", "group", "گروه", "group", AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY, NULL, NULL) -ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_CLASS, "CLASS", "class", "کلاس", "class", AST_LAYOUT_ATTRIBUTE_FILTER_STRING, NULL, NULL) +ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_WEIGHT, "WEIGHT", "weight", "وزن", "weight", AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY, NULL, NULL) -ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_ID, "ID", "id", "شناسه", "id", AST_LAYOUT_ATTRIBUTE_FILTER_STRING, NULL, NULL) +ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_UNICODE_RANGE, "UNICODE_RANGE", "unicode_range", "محدود یونیکد", "unicode_range", AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY, NULL, NULL) -ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_CONTENT, "CONTENT", "content", "محتوا", "content", AST_LAYOUT_ATTRIBUTE_FILTER_STRING, NULL, NULL) +ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_STYLE, "STYLE", "style", "سبک", "style", AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY, NULL, NULL) -ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_SRC, "SRC", "src", "منبع", "src", AST_LAYOUT_ATTRIBUTE_FILTER_STRING, NULL, NULL) +ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_CLASS, "CLASS", "class", "کلاس", "class", AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY, NULL, NULL) -ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_LABEL, "LABEL", "label", "برچسب", "label", AST_LAYOUT_ATTRIBUTE_FILTER_STRING, NULL, NULL) +ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_ID, "ID", "id", "شناسه", "id", AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY, NULL, NULL) + +ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_CONTENT, "CONTENT", "content", "محتوا", "content", AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY, NULL, NULL) + +ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_SRC, "SRC", "src", "منبع", "src", AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY, NULL, NULL) + +ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_LABEL, "LABEL", "label", "برچسب", "label", AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY, NULL, NULL) ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_REPEAT, "REPEAT", "repeat", "تکرار", "repeat", AST_LAYOUT_ATTRIBUTE_FILTER_NUMBER, NULL, NULL) @@ -19,33 +25,33 @@ ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_DIR, "DIR", "dir", "جهت", ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_LANG, "LANG", "lang", "زبان", "lang", AST_LAYOUT_ATTRIBUTE_FILTER_STRING, ast_layout_allowed_lang, NULL) -ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_TITLE, "TITLE", "title", "عنوان", "title", AST_LAYOUT_ATTRIBUTE_FILTER_STRING, NULL, NULL) +ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_TITLE, "TITLE", "title", "عنوان", "title", AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY, NULL, NULL) ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_TYPE, "TYPE", "type", "نوع", "type", AST_LAYOUT_ATTRIBUTE_FILTER_STRING, ast_layout_allowed_form_type, NULL) ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_KIND, "KIND", "kind", "روش", "target", AST_LAYOUT_ATTRIBUTE_FILTER_STRING, ast_layout_allowed_form_kind, NULL) -ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_AUTHOR, "AUTHOR", "author", "نویسنده", "author", AST_LAYOUT_ATTRIBUTE_FILTER_STRING, NULL, NULL) +ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_AUTHOR, "AUTHOR", "author", "نویسنده", "author", AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY, NULL, NULL) -ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_DESCRIPTION, "DESCRIPTION", "description", "توضیح", "description", AST_LAYOUT_ATTRIBUTE_FILTER_STRING, NULL, NULL) +ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_DESCRIPTION, "DESCRIPTION", "description", "توضیح", "description", AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY, NULL, NULL) -ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_KEYWORDS, "KEYWORDS", "keywords", "کلمات", "keywords", AST_LAYOUT_ATTRIBUTE_FILTER_STRING, NULL, NULL) +ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_KEYWORDS, "KEYWORDS", "keywords", "کلمات", "keywords", AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY, NULL, NULL) -ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_ICON, "ICON", "icon", "نمایه", "icon", AST_LAYOUT_ATTRIBUTE_FILTER_STRING, NULL, NULL) +ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_ICON, "ICON", "icon", "نمایه", "icon", AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY, NULL, NULL) -ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_NAME, "NAME", "name", "نام", "name", AST_LAYOUT_ATTRIBUTE_FILTER_STRING, NULL, NULL) +ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_NAME, "NAME", "name", "نام", "name", AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY, NULL, NULL) ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_CHARSET, "CHARSET", "charset", "فرمت متنی", "charset", AST_LAYOUT_ATTRIBUTE_FILTER_STRING, ast_layout_allowed_charset, NULL) -ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_REFRESH, "REFRESH", "refresh", "بروزرسانی", "refresh", AST_LAYOUT_ATTRIBUTE_FILTER_STRING, NULL, NULL) +ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_REFRESH, "REFRESH", "refresh", "بروزرسانی", "refresh", AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY, NULL, NULL) -ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_VIEWPORT, "VIEWPORT", "viewport", "محدوده نمایش", "viewport", AST_LAYOUT_ATTRIBUTE_FILTER_STRING, NULL, NULL) +ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_VIEWPORT, "VIEWPORT", "viewport", "محدوده نمایش", "viewport", AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY, NULL, NULL) -ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_VALUE, "VALUE", "value", "مقدار", "value", AST_LAYOUT_ATTRIBUTE_FILTER_STRING, NULL, NULL) +ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_VALUE, "VALUE", "value", "مقدار", "value", AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY, NULL, NULL) -ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_FOR, "FOR", "for", "برای", "for", AST_LAYOUT_ATTRIBUTE_FILTER_STRING, NULL, NULL) +ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_FOR, "FOR", "for", "برای", "for", AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY, NULL, NULL) -ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_PLACEHOLDER, "PLACEHOLDER", "placeholder", "راهنما", "placeholder", AST_LAYOUT_ATTRIBUTE_FILTER_STRING, NULL, NULL) +ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_PLACEHOLDER, "PLACEHOLDER", "placeholder", "راهنما", "placeholder", AST_LAYOUT_ATTRIBUTE_FILTER_STRING_ANY, NULL, NULL) ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_REQUIRED, "REQUIRED", "required", "اجباری", "required", AST_LAYOUT_ATTRIBUTE_FILTER_BOOL, NULL, NULL) @@ -59,3 +65,5 @@ ADD_LAYOUT_ATTRIBUTE_TYPE(AST_LAYOUT_ATTRIBUTE_TYPE_RESPONSIVE_MIN_HEIGHT, "RESP // ----------- END AUTO GENERATED ----------- // + + diff --git a/src/generated-config/ast_layout_attribute_value.h b/src/generated-config/ast_layout_attribute_value.h index 132131ee..f8653241 100644 --- a/src/generated-config/ast_layout_attribute_value.h +++ b/src/generated-config/ast_layout_attribute_value.h @@ -41,3 +41,5 @@ const ast_layout_attribute_pair_t ast_layout_allowed_lang[] = { #endif + + diff --git a/src/generated-config/ast_layout_attribute_value_extern.h b/src/generated-config/ast_layout_attribute_value_extern.h index 033b0fbc..fbf0f850 100644 --- a/src/generated-config/ast_layout_attribute_value_extern.h +++ b/src/generated-config/ast_layout_attribute_value_extern.h @@ -16,3 +16,5 @@ extern const ast_layout_attribute_pair_t ast_layout_allowed_lang[]; #endif + + diff --git a/src/generated-config/ast_layout_type.h b/src/generated-config/ast_layout_type.h index b39e1bf3..6fb32e92 100644 --- a/src/generated-config/ast_layout_type.h +++ b/src/generated-config/ast_layout_type.h @@ -128,3 +128,5 @@ ADD_LAYOUT_TYPE_REPEAT(AST_LAYOUT_TYPE_MEDIA, "MEDIA", "media", "@media", "وا // ----------- END AUTO GENERATED ----------- // + + diff --git a/src/generated-config/ast_layout_type_attributes.h b/src/generated-config/ast_layout_type_attributes.h index 952fd046..ec2fb8a6 100644 --- a/src/generated-config/ast_layout_type_attributes.h +++ b/src/generated-config/ast_layout_type_attributes.h @@ -127,8 +127,13 @@ else if (attribute->parent_node_type == AST_LAYOUT_TYPE_INPUT) { else if (attribute->parent_node_type == AST_LAYOUT_TYPE_IMG) { } else if (attribute->parent_node_type == AST_LAYOUT_TYPE_FONT) { + if (is_attribute_type_in_array(attribute_key_type, valid_attributes_font, valid_attributes_font_length)) { + return true; + } } else if (attribute->parent_node_type == AST_LAYOUT_TYPE_MEDIA) { } // ----------- END AUTO GENERATED ----------- // + + diff --git a/src/generated-config/ast_layout_type_attributes_values.h b/src/generated-config/ast_layout_type_attributes_values.h index 121d2e43..ab82fe25 100644 --- a/src/generated-config/ast_layout_type_attributes_values.h +++ b/src/generated-config/ast_layout_type_attributes_values.h @@ -95,7 +95,17 @@ ast_layout_attribute_type_t valid_attributes_input[] = { const size_t valid_attributes_input_length = sizeof(valid_attributes_input) / sizeof(valid_attributes_input[0]); +ast_layout_attribute_type_t valid_attributes_font[] = { + AST_LAYOUT_ATTRIBUTE_TYPE_NAME, + AST_LAYOUT_ATTRIBUTE_TYPE_SRC, + AST_LAYOUT_ATTRIBUTE_TYPE_UNICODE_RANGE, + AST_LAYOUT_ATTRIBUTE_TYPE_STYLE, + AST_LAYOUT_ATTRIBUTE_TYPE_WEIGHT, +}; +const size_t valid_attributes_font_length = sizeof(valid_attributes_font) / sizeof(valid_attributes_font[0]); // ----------- END AUTO GENERATED ----------- // + + diff --git a/src/generated-config/ast_type.h b/src/generated-config/ast_type.h index e523735b..7b9dacf4 100644 --- a/src/generated-config/ast_type.h +++ b/src/generated-config/ast_type.h @@ -19,3 +19,5 @@ ADD_TYPE(AST_TYPE_ERROR, "ERROR", "error") // ----------- END AUTO GENERATED ----------- // + + diff --git a/src/generator_layout.c b/src/generator_layout.c index d7c59126..b8b4b07a 100644 --- a/src/generator_layout.c +++ b/src/generator_layout.c @@ -44,7 +44,6 @@ void generator_code_layout_value(hashmap_t *attrs, hashmap_t *new_attrs, } if (isValid == false) { - printf("%d\n", attribute->parent_node_type); error_generator( 2, "Invalid value for '%s' %s in '%s' element at line %zu column %zu!", @@ -908,7 +907,7 @@ string_t *generator_code_layout_attributes(generator_t *generator, media_min_width, NULL, NULL) == false) { error_generator(2, - "Invalid value for responsive_max_width " + "Invalid value for responsive_min_width " "attribute in layout block!"); return NULL; @@ -935,7 +934,7 @@ string_t *generator_code_layout_attributes(generator_t *generator, media_max_height, NULL, NULL) == false) { error_generator(2, - "Invalid value for responsive_max_width " + "Invalid value for responsive_max_height " "attribute in layout block!"); return NULL; @@ -962,7 +961,7 @@ string_t *generator_code_layout_attributes(generator_t *generator, media_min_height, NULL, NULL) == false) { error_generator(2, - "Invalid value for responsive_max_width " + "Invalid value for responsive_min_height " "attribute in layout block!"); return NULL; diff --git a/src/validator.c b/src/validator.c index db826258..b80d83d5 100644 --- a/src/validator.c +++ b/src/validator.c @@ -220,7 +220,6 @@ bool validate_value(hashmap_t *attributes, hashmap_t *new_attributes, ast_layout_attribute_t *attribute) { DEBUG_ME; ast_value_t *first = attribute->values->data[0]; - // char *value = first->data.string_value; if (attribute->values->length < 1) { error_validator(