Skip to content

Commit

Permalink
YCDOCS-16069: add IMAGE to function ref (#463)
Browse files Browse the repository at this point in the history
* generated IMAGE function page

* fix internal part
  • Loading branch information
shamshinds authored May 29, 2024
1 parent 1fb076b commit 33ae833
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 1 deletion.
1 change: 0 additions & 1 deletion lib/dl_formula/dl_formula/definitions/functions_markup.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ class NullImageMarkupNode:

class FuncImageBase(FuncMarkup):
name = "image"
scopes = Function.scopes & ~Scope.SUGGESTED & ~Scope.DOCUMENTED


class FuncImage1(FuncImageBase):
Expand Down
10 changes: 10 additions & 0 deletions lib/dl_formula_ref/dl_formula_ref/categories/markup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from dl_formula_ref.localization import get_gettext
from dl_formula_ref.registry.aliased_res import (
AliasedLinkResource,
AliasedTextResource,
SimpleAliasedResourceRegistry,
)
from dl_formula_ref.registry.base import FunctionDocCategory
Expand Down Expand Up @@ -31,6 +32,15 @@
"gravity_ui_texts_link": AliasedLinkResource(
url=_("https://preview.gravity-ui.com/uikit/iframe.html?args=&id=colors--texts&viewMode=story")
),
"storage_link": AliasedLinkResource(url=_("../../storage/quickstart.md")),
"storage_prices_link": AliasedLinkResource(url=_("../../storage/pricing.md#prices-storage")),
"image_source_restrictions": AliasedTextResource(
body=_(
"Images can be added from the `*.yandex.ru`, `*.yandex.net`, `yastat.net`, `yastatic.net`, or "
"`storage.yandexcloud.net` domains. The easiest way is to upload and publish the image in "
"{link: storage_link: Yandex Object Storage} (see the pricing {link: storage_prices_link: here}).\n"
),
),
}
),
)
24 changes: 24 additions & 0 deletions lib/dl_formula_ref/dl_formula_ref/functions/markup.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,29 @@
],
)

FUNCTION_IMAGE = FunctionDocRegistryItem(
name="image",
category=CATEGORY_MARKUP,
description=_(
"Enables inserting an image located at the {arg:0} address to the table. "
"The {arg:1} and {arg:2} values are provided in pixels. If one of the dimensions is "
"`NULL`, it will be calculated automatically in proportion to the other. "
"If both dimensions are `NULL`, the image will be inserted with the original width and height. "
"In case there are issues when uploading the image, the function will display the {arg:3} text.\n"
"\n"
"{text: image_source_restrictions}\n"
"\n"
),
examples=[
SimpleExample(
"IMAGE('https://storage.yandexcloud.net/functions********/nature-01.jpg', 250, 150, 'alt-text-1')"
),
SimpleExample(
"IMAGE('https://storage.yandexcloud.net/functions********/nature-02.jpg', NULL, NULL, 'alt-text-2')"
),
],
)

FUNCTIONS_MARKUP = [
FUNCTION_BOLD,
FUNCTION_ITALIC,
Expand All @@ -90,4 +113,5 @@
FUNCTION_COLOR,
FUNCTION_SIZE,
FUNCTION_BR,
FUNCTION_IMAGE,
]
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,19 @@ msgid ""
"texts&viewMode=story"
msgstr ""

msgid "../../storage/quickstart.md"
msgstr ""

msgid "../../storage/pricing.md#prices-storage"
msgstr ""

msgid ""
"Images can be added from the `*.yandex.ru`, `*.yandex.net`, `yastat.net`, "
"`yastatic.net`, or `storage.yandexcloud.net` domains. The easiest way is to "
"upload and publish the image in {link: storage_link: Yandex Object Storage} "
"(see the pricing {link: storage_prices_link: here}).\n"
msgstr ""

msgid "https://github.com/google/re2/wiki/Syntax"
msgstr "https://github.com/google/re2/wiki/Syntax"

Expand Down Expand Up @@ -1108,6 +1121,18 @@ msgstr ""
msgid "Adds a line break."
msgstr ""

msgid ""
"Enables inserting an image located at the {arg:0} address to the table. The "
"{arg:1} and {arg:2} values are provided in pixels. If one of the dimensions "
"is `NULL`, it will be calculated automatically in proportion to the other. "
"If both dimensions are `NULL`, the image will be inserted with the original "
"width and height. In case there are issues when uploading the image, the "
"function will display the {arg:3} text.\n"
"\n"
"{text: image_source_restrictions}\n"
"\n"
msgstr ""

msgid "Returns the absolute value of {arg:0}."
msgstr ""

Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,24 @@ msgid ""
"texts&viewMode=story"
msgstr ""

msgid "../../storage/quickstart.md"
msgstr ""

msgid "../../storage/pricing.md#prices-storage"
msgstr ""

msgid ""
"Images can be added from the `*.yandex.ru`, `*.yandex.net`, `yastat.net`, "
"`yastatic.net`, or `storage.yandexcloud.net` domains. The easiest way is to "
"upload and publish the image in {link: storage_link: Yandex Object Storage} "
"(see the pricing {link: storage_prices_link: here}).\n"
msgstr ""
"Допускается добавление изображений с доменов `*.yandex.ru`, `*.yandex.net`, "
"`yastat.net`, `yastatic.net` или `storage.yandexcloud.net`. Самый простой "
"способ — загрузить и опубликовать изображение в {link: storage_link: Yandex "
"Object Storage} (ознакомьтесь с {link: storage_prices_link: правилами "
"тарификации} сервиса).\n"

msgid "https://github.com/google/re2/wiki/Syntax"
msgstr ""

Expand Down Expand Up @@ -1681,6 +1699,28 @@ msgstr "Позволяет указать размер в пикселях дл
msgid "Adds a line break."
msgstr "Добавляет перенос строки."

msgid ""
"Enables inserting an image located at the {arg:0} address to the table. The "
"{arg:1} and {arg:2} values are provided in pixels. If one of the dimensions "
"is `NULL`, it will be calculated automatically in proportion to the other. "
"If both dimensions are `NULL`, the image will be inserted with the original "
"width and height. In case there are issues when uploading the image, the "
"function will display the {arg:3} text.\n"
"\n"
"{text: image_source_restrictions}\n"
"\n"
msgstr ""
"Позволяет вставить в таблицу изображение, расположенное по адресу {arg:0}. "
"Ширина ({arg:1}) и высота ({arg:2}) изображения указываются в пикселях. Если "
"для одного из размеров указано значение `NULL`, он рассчитывается "
"автоматически пропорционально размеру другой стороны. Если для обоих "
"размеров указано значение `NULL`, изображение вставляется с исходными "
"размерами. В случае проблем с загрузкой изображения функция выводит "
"альтернативный текст {arg:3}.\n"
"\n"
"{text: image_source_restrictions}\n"
"\n"

msgid "Returns the absolute value of {arg:0}."
msgstr "Возвращает абсолютное значение заданного числа {arg:0}."

Expand Down

0 comments on commit 33ae833

Please sign in to comment.