From fd530b0f7640cdc88047b0324fe4bd7d51ccd182 Mon Sep 17 00:00:00 2001 From: Mostafa Elgreatly <66712535+mostafaroshdy1@users.noreply.github.com> Date: Thu, 18 Apr 2024 03:36:40 +0200 Subject: [PATCH 01/15] Added hyperlink to animation type --- kumascript/macros/AnimationType.ejs | 13 +++++++++++++ kumascript/macros/CSSInfo.ejs | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 kumascript/macros/AnimationType.ejs diff --git a/kumascript/macros/AnimationType.ejs b/kumascript/macros/AnimationType.ejs new file mode 100644 index 000000000000..0a54a136783b --- /dev/null +++ b/kumascript/macros/AnimationType.ejs @@ -0,0 +1,13 @@ +<% +let linkText = mdn.localString({ + "en-US": "Animation type", + "es" : "Animation type", + "fr" : "Type d'animation", + "ja" : "アニメーションの種類", + "ko" : "Animation type", + "ru" : "Animation type", + "zh-CN": "Animation type", + "zh-TW": "Animation type" +}); +%> +<%- `${linkText}` %> diff --git a/kumascript/macros/CSSInfo.ejs b/kumascript/macros/CSSInfo.ejs index 6a8c570279dd..aa7d621e9c17 100644 --- a/kumascript/macros/CSSInfo.ejs +++ b/kumascript/macros/CSSInfo.ejs @@ -283,7 +283,7 @@ if (name === "preview-wiki-content") { if (!atRule) { properties = properties.concat({ name: "animationType", - label: localize(localStrings, "animationType") + label: await template("animationType") }); } From 2bb7fb44b3933675bfc242991e4f3400088c269e Mon Sep 17 00:00:00 2001 From: Mostafa Elgreatly <66712535+mostafaroshdy1@users.noreply.github.com> Date: Fri, 19 Apr 2024 08:02:57 +0200 Subject: [PATCH 02/15] Changed the modification to inline --- kumascript/macros/AnimationType.ejs | 13 ------------- kumascript/macros/CSSInfo.ejs | 2 +- 2 files changed, 1 insertion(+), 14 deletions(-) delete mode 100644 kumascript/macros/AnimationType.ejs diff --git a/kumascript/macros/AnimationType.ejs b/kumascript/macros/AnimationType.ejs deleted file mode 100644 index 0a54a136783b..000000000000 --- a/kumascript/macros/AnimationType.ejs +++ /dev/null @@ -1,13 +0,0 @@ -<% -let linkText = mdn.localString({ - "en-US": "Animation type", - "es" : "Animation type", - "fr" : "Type d'animation", - "ja" : "アニメーションの種類", - "ko" : "Animation type", - "ru" : "Animation type", - "zh-CN": "Animation type", - "zh-TW": "Animation type" -}); -%> -<%- `${linkText}` %> diff --git a/kumascript/macros/CSSInfo.ejs b/kumascript/macros/CSSInfo.ejs index aa7d621e9c17..74e11b375e16 100644 --- a/kumascript/macros/CSSInfo.ejs +++ b/kumascript/macros/CSSInfo.ejs @@ -283,7 +283,7 @@ if (name === "preview-wiki-content") { if (!atRule) { properties = properties.concat({ name: "animationType", - label: await template("animationType") + label: `${localize(localStrings, "animationType")}` }); } From 50b7cec1306e2263a64454a4f56d82d47fde7ff0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Apr 2024 17:53:51 +0000 Subject: [PATCH 03/15] chore(deps): bump inquirer from 9.2.18 to 9.2.19 (#10940) --- package.json | 2 +- yarn.lock | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 99dd2c5aa23a..9eccf2c264ea 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,7 @@ "imagemin-mozjpeg": "^10.0.0", "imagemin-pngquant": "^9.0.2", "imagemin-svgo": "^10.0.1", - "inquirer": "^9.2.18", + "inquirer": "^9.2.19", "is-svg": "^5.0.0", "js-yaml": "^4.1.0", "loglevel": "^1.9.1", diff --git a/yarn.lock b/yarn.lock index 67ad2cbc99f1..595fd7779ae9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1909,10 +1909,10 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz#d9fae00a2d5cb40f92cfe64b47ad749fbc38f917" integrity sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw== -"@inquirer/figures@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@inquirer/figures/-/figures-1.0.0.tgz#f28ee68d08c5ada5284ee0d58ae1d177e80dabda" - integrity sha512-3fw+7+77/duTnMJTeSS44wneszghI4tkr0m0xdIJabbYRe36ElzmsqyboMZ1nFRon6sT+ckVvYDVjwapKv+2sw== +"@inquirer/figures@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@inquirer/figures/-/figures-1.0.1.tgz#d65f0bd0e9511a90b4d3543ee6a3ce7211f29417" + integrity sha512-mtup3wVKia3ZwULPHcbs4Mor8Voi+iIXEWD7wCNbIO6lYR62oPCTQyrddi5OMYVXHzeCSoneZwJuS8sBvlEwDw== "@isaacs/cliui@^8.0.2": version "8.0.2" @@ -8635,12 +8635,12 @@ inquirer@^6.0.0: strip-ansi "^5.1.0" through "^2.3.6" -inquirer@^9.2.18: - version "9.2.18" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-9.2.18.tgz#eb7dcb2c9d7aa0678b9dc4d1d243c297aacc2629" - integrity sha512-Qzm+UP7L9beFyycZ9Nxzqj7WBgeJIaT4Ue0+2bmQp9yZXiUW2azrmBnp3vlInMw1wXkUmaM0hiMcht7CjJzASw== +inquirer@^9.2.19: + version "9.2.19" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-9.2.19.tgz#e142ebc111b6328a21eb84d8e7dd226ff824239e" + integrity sha512-WpxOT71HGsFya6/mj5PUue0sWwbpbiPfAR+332zLj/siB0QA1PZM8v3GepegFV1Op189UxHUCF6y8AySdtOMVA== dependencies: - "@inquirer/figures" "^1.0.0" + "@inquirer/figures" "^1.0.1" "@ljharb/through" "^2.3.13" ansi-escapes "^4.3.2" chalk "^5.3.0" From 16c1be1f922b7e99795c4d6fa855ceab3539393c Mon Sep 17 00:00:00 2001 From: A1lo Date: Thu, 18 Apr 2024 19:27:39 +0800 Subject: [PATCH 04/15] enhance(macros/PreviousMenuNext): use the actual title of the document by default (#10812) --- kumascript/macros/PreviousMenuNext.ejs | 57 ++++++++++++++------------ 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/kumascript/macros/PreviousMenuNext.ejs b/kumascript/macros/PreviousMenuNext.ejs index a016233e163c..820d55c32de1 100644 --- a/kumascript/macros/PreviousMenuNext.ejs +++ b/kumascript/macros/PreviousMenuNext.ejs @@ -6,17 +6,15 @@ Parameter $1 (second parameter): path of Next page $2 (third parameter): path to main menu of module -Issue - * Problem of Apostrophe (https://developer.mozilla.org/fr/docs/JavaScript_Guide/Op%C3%A9rateurs/Op%C3%A9rateurs_sp%C3%A9ciaux) - */ -var lang = env.locale; -var strPrevious = ""; -var strNext = ""; -var strMenu = ""; +const locale = env.locale; +const defaultLocale = "en-US"; +const prevPage = $0?.replace(/ /g, "_"); +const nextPage = $1?.replace(/ /g, "_"); +const mainMenu = $2?.replace(/ /g, "_"); -var s_PreviousNext = mdn.localString({ +const previousNextStr = mdn.localString({ "en-US": [" Previous ", " Next "], "es" : [" Anterior ", " Siguiente "], "fr" : [" Précédent ", " Suivant "], @@ -28,7 +26,7 @@ var s_PreviousNext = mdn.localString({ "zh-TW": [" 前頁 ", " 次頁 "] }); -var s_Menu = mdn.localString({ +const menuStr = mdn.localString({ "en-US": " Overview: ", "pt-BR": " Menu: ", "fr" : " Aperçu : ", @@ -37,29 +35,34 @@ var s_Menu = mdn.localString({ "zh-TW": " 概述:", }); -if ($0) { - strPrevious = '
  • ' + s_PreviousNext[0] + '
  • '; +function generateLink(pageSlug, linkText) { + return `
  • ${linkText}
  • `; } -if ($1) { - strNext = '
  • ' + s_PreviousNext[1] + '
  • '; +function generateMenuLink(pageSlug) { + const url = `/${locale}/docs/${pageSlug}`; + let aPage = info.getPageByURL(url); + if (!aPage.url && locale !== defaultLocale) { + const fallbackUrl = `/${defaultLocale}/docs/${pageSlug}`; + aPage = info.getPageByURL(fallbackUrl); + } + + let title = ""; + if (!aPage.url) { + // fallback to generate title from slug + title = pageSlug.split('/').at(-1).replace(/_/g, " "); + } else { + title = aPage.title; + } + return generateLink(pageSlug, `${menuStr}${title}`); } -if ($2) { - var startString = $2; - var linkTextArray = startString.split('/'); - var linkText = linkTextArray[linkTextArray.length-1]; - var re = /_/gi; - var finalString = linkText.replace(re,' '); - if($0 && $1) { - strMenu = '
  • ' + s_Menu + finalString + '
  • '; - } else if($0) { - strMenu = '
  • ' + s_Menu + finalString + '
  • '; - } else if($1) { - strMenu = '
  • ' + s_Menu + finalString + '
  • '; - } -} +// Output +const strPrevious = prevPage ? generateLink(prevPage, previousNextStr[0]) : ""; +const strNext = nextPage ? generateLink(nextPage, previousNextStr[1]) : ""; +// If there is a main menu with a previous and/or a next page, generate a link to the main menu +const strMenu = (mainMenu && (prevPage || nextPage)) ? generateMenuLink(mainMenu) : ""; %>