From 629aa39f42f39cf83ec150b3cb04a9b15e8c4f24 Mon Sep 17 00:00:00 2001 From: "ALI Mohammadiyeh (Max Base)" Date: Thu, 9 Jan 2025 17:49:18 +0100 Subject: [PATCH] Add u, video, and wbr tag --- build/tags/u.py | 26 ++++++++++++++ build/tags/video.py | 87 +++++++++++++++++++++++++++++++++++++++++++++ build/tags/wbr.py | 24 +++++++++++++ 3 files changed, 137 insertions(+) create mode 100644 build/tags/u.py create mode 100644 build/tags/video.py create mode 100644 build/tags/wbr.py diff --git a/build/tags/u.py b/build/tags/u.py new file mode 100644 index 00000000..708a690a --- /dev/null +++ b/build/tags/u.py @@ -0,0 +1,26 @@ +import os +import sys +import json +from pathlib import Path + +parent_dir = Path(__file__).resolve().parent.parent +sys.path.append(str(parent_dir)) +sys.path.append(os.path.join(parent_dir, "data")) + +from type import Type +from lang import Lang +from value import Value +from element import Element + +if __name__ == "__main__": + element = Element() + element.set_is_mother(True) + element.set_generate_name("u") + element.set_text(Lang.EN, "u") + element.set_text(Lang.FA, "زیرخط") + + element_dict = element.to_dict() + + j = json.dumps(element_dict, indent=4, ensure_ascii=False) + print(j) + open(Path(__file__).stem + ".json", "w", encoding="utf-8").write(j) diff --git a/build/tags/video.py b/build/tags/video.py new file mode 100644 index 00000000..3c4a65d5 --- /dev/null +++ b/build/tags/video.py @@ -0,0 +1,87 @@ +import os +import sys +import json +from pathlib import Path + +parent_dir = Path(__file__).resolve().parent.parent +sys.path.append(str(parent_dir)) +sys.path.append(os.path.join(parent_dir, "data")) + +from type import Type +from lang import Lang +from value import Value +from element import Element + +if __name__ == "__main__": + element = Element() + element.set_is_mother(True) + element.set_generate_name("video") + element.set_text(Lang.EN, "video") + element.set_text(Lang.FA, "فیلم") + + element.add_attribute() \ + .set_generate_name("autoplay") \ + .set_type(Type.Boolean) \ + .add_text(Lang.EN, "autoplay") \ + .add_text(Lang.FA, "پخش خودکار") \ + + element.add_attribute() \ + .set_generate_name("controls") \ + .set_type(Type.Boolean) \ + .add_text(Lang.EN, "controls") \ + .add_text(Lang.FA, "کنترلر") \ + + element.add_attribute() \ + .set_generate_name("height") \ + .set_type(Type.Size) \ + .add_text(Lang.EN, "height") \ + .add_text(Lang.FA, "ارتفاع") \ + + element.add_attribute() \ + .set_generate_name("loop") \ + .set_type(Type.Boolean) \ + .add_text(Lang.EN, "loop") \ + .add_text(Lang.FA, "تکرار") \ + + element.add_attribute() \ + .set_generate_name("muted") \ + .set_type(Type.Boolean) \ + .add_text(Lang.EN, "muted") \ + .add_text(Lang.FA, "بی صدا") \ + + element.add_attribute() \ + .set_generate_name("poster") \ + .set_type(Type.Url) \ + .add_text(Lang.EN, "poster") \ + .add_text(Lang.FA, "پوستر") \ + + element.add_attribute() \ + .set_generate_name("preload") \ + .set_type(Type.Url) \ + .add_text(Lang.EN, "preload") \ + .add_text(Lang.FA, "پیش لود") \ + .reserved_values( + Value().set_generate_name("auto").add_text(Lang.EN, "auto").add_text(Lang.FA, "خودکار"), + Value().set_generate_name("metadata").add_text(Lang.EN, "metadata").add_text(Lang.FA, "متادیتا"), + Value().set_generate_name("none").add_text(Lang.EN, "none").add_text(Lang.FA, "هیچکدام"), + ) \ + + element.add_attribute() \ + .set_generate_name("src") \ + .set_type(Type.Url) \ + .add_text(Lang.EN, "source") \ + .add_text(Lang.FA, "منبع") \ + .set_is_required(True) \ + + element.add_attribute() \ + .set_generate_name("width") \ + .set_type(Type.Size) \ + .add_text(Lang.EN, "width") \ + .add_text(Lang.FA, "عرض") \ + + + element_dict = element.to_dict() + + j = json.dumps(element_dict, indent=4, ensure_ascii=False) + print(j) + open(Path(__file__).stem + ".json", "w", encoding="utf-8").write(j) diff --git a/build/tags/wbr.py b/build/tags/wbr.py new file mode 100644 index 00000000..a1deb1c0 --- /dev/null +++ b/build/tags/wbr.py @@ -0,0 +1,24 @@ +import os +import sys +import json +from pathlib import Path + +parent_dir = Path(__file__).resolve().parent.parent +sys.path.append(str(parent_dir)) +sys.path.append(os.path.join(parent_dir, "data")) + +from lang import Lang +from element import Element + +if __name__ == "__main__": + element = Element() + element.set_is_mother(False) + element.set_generate_name("wbr") + element.set_text(Lang.EN, "wbr") + element.set_text(Lang.FA, "وی بی ار") + + element_dict = element.to_dict() + + j = json.dumps(element_dict, indent=4, ensure_ascii=False) + print(j) + open(Path(__file__).stem + ".json", "w", encoding="utf-8").write(j)