Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/SalamLang/Salam
Browse files Browse the repository at this point in the history
  • Loading branch information
BaseMax committed Jan 8, 2025
2 parents faeed39 + 36f797a commit d4d6dde
Show file tree
Hide file tree
Showing 14 changed files with 237 additions and 213 deletions.
2 changes: 1 addition & 1 deletion build-webassembly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ if [ $? -eq 0 ]; then
else
echo "Warning: npx command not found. JavaScript will not be transpiled for older browsers."
fi

sed -i ':a;N;$!ba;s/\n/\\n/g' ${OUTPUT_BASE}.js

if [ -d "$EDITOR_DIR" ]; then
Expand Down
2 changes: 1 addition & 1 deletion config/admin/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import List, Union

import yaml
from flask import Flask, redirect, render_template, request, session, url_for, Response
from flask import Flask, Response, redirect, render_template, request, session, url_for
from werkzeug.wrappers import Response as WerkzeugResponse

# Create an alias for the response type to handle both werkzeug and flask Response
Expand Down
10 changes: 6 additions & 4 deletions config/module/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ def command_layout_type(item: Dict[str, Any], prefix: str, value: str) -> str:
)


def command_layout_style_type(item: Dict[str, Any], prefix: str, value: str, extra: str = 'none') -> str:
def command_layout_style_type(
item: Dict[str, Any], prefix: str, value: str, extra: str = "none"
) -> str:
"""
Generates a formatted command string based on the item and value provided.
:param item: Dictionary containing item data.
Expand All @@ -75,7 +77,7 @@ def command_layout_style_type(item: Dict[str, Any], prefix: str, value: str, ext
else "NULL"
)

if extra == 'none':
if extra == "none":
return (
f"({itemid}, "
f'"{idtext}", '
Expand All @@ -84,7 +86,7 @@ def command_layout_style_type(item: Dict[str, Any], prefix: str, value: str, ext
f'"{generate_name}", '
f"{type}, {reserved_values}, NULL)"
)
elif extra == '':
elif extra == "":
return (
f"({itemid}, "
f'"{idtext}", '
Expand All @@ -93,7 +95,7 @@ def command_layout_style_type(item: Dict[str, Any], prefix: str, value: str, ext
f'"{generate_name}", '
f"{type}, {reserved_values}, NULL, AST_LAYOUT_ATTRIBUTE_VALUE_HANDLER_SIMPLE)"
)
else:
else:
return (
f"({itemid}, "
f'"{idtext}", '
Expand Down
31 changes: 24 additions & 7 deletions config/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ def prettify_layout_attribute_type(item: Dict[str, Any], group: Dict[str, Any])
else:
return (
key_normal
+ command_layout_style_type(item, "AST_LAYOUT_ATTRIBUTE_TYPE_", values, value_handler)
+ command_layout_style_type(
item, "AST_LAYOUT_ATTRIBUTE_TYPE_", values, value_handler
)
+ "\n"
)

Expand Down Expand Up @@ -168,15 +170,21 @@ def prettify_layout_attribute_style_type(
result += (
key_hide
+ command_layout_style_type(
item, "AST_LAYOUT_ATTRIBUTE_STYLE_TYPE_", value, value_handler
item,
"AST_LAYOUT_ATTRIBUTE_STYLE_TYPE_",
value,
value_handler,
)
+ "\n"
)
else:
result += (
key_repeat
+ command_layout_style_type(
item, "AST_LAYOUT_ATTRIBUTE_STYLE_TYPE_", value, value_handler
item,
"AST_LAYOUT_ATTRIBUTE_STYLE_TYPE_",
value,
value_handler,
)
+ "\n"
)
Expand All @@ -197,15 +205,21 @@ def prettify_layout_attribute_style_type(
result += (
key_main
+ command_layout_style_type(
item, "AST_LAYOUT_ATTRIBUTE_STYLE_TYPE_", value, value_handler
item,
"AST_LAYOUT_ATTRIBUTE_STYLE_TYPE_",
value,
value_handler,
)
+ "\n"
)
else:
result += (
key_repeat
+ command_layout_style_type(
item, "AST_LAYOUT_ATTRIBUTE_STYLE_TYPE_", value, value_handler
item,
"AST_LAYOUT_ATTRIBUTE_STYLE_TYPE_",
value,
value_handler,
)
+ "\n"
)
Expand Down Expand Up @@ -399,7 +413,7 @@ def prettify_layout_type_attributes_all(
return "{" + f" {itemid}, {var_attrs}, {var_attrs_length}" + " },\n"
else:
return ""


def prettify_layout_type_attributes_values_extern(
item: Dict[str, Any], group: Dict[str, Any]
Expand Down Expand Up @@ -458,7 +472,10 @@ def prettify_layout_type_attributes_values(
result += "};\n"
result += f"const size_t {var_attrs_length} = sizeof({var_attrs}) / sizeof({var_attrs}[0]);\n"
else:
result += f"ast_layout_attribute_type_t {var_attrs}[] = " + "{ AST_LAYOUT_ATTRIBUTE_TYPE_ERROR };\n"
result += (
f"ast_layout_attribute_type_t {var_attrs}[] = "
+ "{ AST_LAYOUT_ATTRIBUTE_TYPE_ERROR };\n"
)
result += f"const size_t {var_attrs_length} = 0;\n"

return result
Expand Down
4 changes: 2 additions & 2 deletions example/custom-font.salam
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//محدود یونیکد = "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???"
Expand All @@ -18,5 +18,5 @@
اندازه قلم = ۵۰
تمام
تمام

تمام
20 changes: 10 additions & 10 deletions example/try.salam
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
رنگ پس زمینه = «زرد»
رنگ = «سیاه»
محتوا = «سلام دنیا»

جهت = "راست به چپ"
زبان = "فارسی"

پاراگراف:
محتوا = «سلام این یک متن آزاد است و می تواند طویل باشد.»
تمام

خط بعدی:
تکرار = ۳
تمام

جعبه:
تکرار = ۴

رنگ پس زمینه = "زرد"

قطعه:
محتوا = "این یک متن است"
تمام

فهرست مرتب:
مورد:
محتوا = "این یک ایتم موردی است"
Expand All @@ -35,15 +35,15 @@
تمام
تمام
تمام

قطعه:
محتوا = "متن ازمایشی"
تمام

خط بعدی:
تکرار = ۳
تمام

قطعه:
محتوا = "پایان"
تمام
Expand Down
20 changes: 10 additions & 10 deletions salam-online.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,27 @@
رنگ پس زمینه = «زرد»
رنگ = «سیاه»
محتوا = «سلام دنیا»

جهت = "راست به چپ"
زبان = "فارسی"

پاراگراف:
محتوا = «سلام این یک متن آزاد است و می تواند طویل باشد.»
تمام

خط بعدی:
تکرار = ۳
تمام

جعبه:
تکرار = ۴

رنگ پس زمینه = "زرد"

قطعه:
محتوا = "این یک متن است"
تمام

فهرست مرتب:
مورد:
محتوا = "این یک ایتم موردی است"
Expand All @@ -49,15 +49,15 @@
تمام
تمام
تمام

قطعه:
محتوا = "متن ازمایشی"
تمام

خط بعدی:
تکرار = ۳
تمام

قطعه:
محتوا = "پایان"
تمام
Expand Down
2 changes: 1 addition & 1 deletion src/array_custom.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ void array_layout_node_print(array_node_layout_t *array) {
printf("\t");
ast_layout_node_t *node =
cast(ast_layout_node_t *, array_get(cast(array_t *, array), i));

if (node != NULL) {
node->print(node);
} else {
Expand Down
Loading

0 comments on commit d4d6dde

Please sign in to comment.