Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
help-beta: Add component for emoticon translations table.
Shubham Padia496aa16f19d9
diff --git a/help-beta/src/components/EmoticonTranslations.astro b/help-beta/src/components/EmoticonTranslations.astronew file mode 100644index 00000000000..47cdeae4803--- /dev/null+++ b/help-beta/src/components/EmoticonTranslations.astro@@ -0,0 +1,35 @@+---+import EmojiCodes from '../../../static/generated/emoji/emoji_codes.json';++const nameToCodePoint: {[key: string]: string} = EmojiCodes["name_to_codepoint"];+const rowHTML = (emoticon: string, codepoint: string, name: string) => (`+<tr>+ <td><code>${emoticon}</code></td>+ <td>+ <img+ src="/static/generated/emoji/images-google-64/${codepoint}.png"+ alt="${name}"+ class="emoji-big">+ </td>+</tr>+`);++let body = "";+const emoticonConversions: {[key: string]: string} = EmojiCodes["emoticon_conversions"]+Object.keys(emoticonConversions).forEach((name: string) => {+ const emoticon: string = emoticonConversions[name]!;+ body += rowHTML(name, nameToCodePoint[emoticon.slice(1, -1)]!, emoticon)+})+---++<table>+ <thead>+ <tr>+ <th>Emoticon</th>+ <th>Emoji</th>+ </tr>+ </thead>+ <tbody>+ <Fragment set:html={body} />+ </tbody>+</table>diff --git a/tools/convert-help-center-docs-to-mdx b/tools/convert-help-center-docs-to-mdxindex 0986ff6a303..ea2d9153f3b 100755--- a/tools/convert-help-center-docs-to-mdx+++ b/tools/convert-help-center-docs-to-mdx@@ -18,6 +18,21 @@ os.environ["DJANGO_SETTINGS_MODULE"] = "zproject.settings"django.setup()+def replace_emoticon_translation_table(markdown_string: str) -> str:+ """+ We will replace emoticon_translations custom syntax in Python with+ <EmoticonTranslations> astro component.+ """+ return markdown_string.replace(+ "\\{emoticon_translations\\}",+ """+import EmoticonTranslations from '../../components/EmoticonTranslations.astro';++<EmoticonTranslations />+""",+ )++def replace_image_path(markdown_string: str) -> str:"""We will point to the existing image folder till@@ -69,6 +84,7 @@ def insert_frontmatter(markdown_string: str) -> str:def convert_string_to_mdx(markdown_string: str) -> str:result = escape_curly_braces(markdown_string)result = fix_relative_path(result)+ result = replace_emoticon_translation_table(result)result = replace_image_path(result)return insert_frontmatter(result)