diff --git a/mdlm.sh b/mdlm.sh index d73f426..f9c17d6 100755 --- a/mdlm.sh +++ b/mdlm.sh @@ -12,12 +12,14 @@ MDLM_VERSION="0.0.14" DEFAULT_LCM_LOCAL="English" -MDLM_HEADER="" -MDLM_P_OPEN="" +MDLM_HEADER="" + +MDLM_SECTION_OPEN="" MDLM_P_TBD="TBD" -MDLM_IGNORE_START="" -MDLM_IGNORE_END="" + +MDLM_IGNORE_START="" +MDLM_IGNORE_END="" MDLM_ADD_LINK="https://github.com/markdown-localization/markdown-localization-spec#workflow" @@ -128,7 +130,7 @@ mdlm_copy_original_to_localized_file() { command echo "${HEADER}" > "${LCM_FILE}" command grep -v "${MDLM_HEADER}" "${ORIG_FILE}" \ | sed -e "/$MDLM_IGNORE_START/,/$MDLM_IGNORE_END/d" \ - | awk -v RS="(^|\n)#" -v popen="${MDLM_P_OPEN}" -v pclose="${MDLM_P_CLOSE}" -v ptbd="${MDLM_P_TBD}" \ + | awk -v RS="(^|\n)#" -v popen="${MDLM_SECTION_OPEN}" -v pclose="${MDLM_SECTION_CLOSE}" -v ptbd="${MDLM_P_TBD}" \ '{ if ($0) print popen "\n#" $0 pclose "\n" ptbd "\n"}' >> "${LCM_FILE}" } @@ -282,8 +284,13 @@ mdlm_update_all_headers() { mdlm_original_diff() { diff --color="${USE_COLORS}" -B \ <(grep -v "${MDLM_HEADER}" "${2}" \ - | sed -e "/${MDLM_P_CLOSE}/,/${MDLM_P_OPEN}/d" -e "/${MDLM_P_OPEN}/d" -e "/$MDLM_IGNORE_START/,/$MDLM_IGNORE_END/d") \ - <(grep -v "${MDLM_HEADER}" "${1}" | sed -e "/${MDLM_IGNORE_START}/,/${MDLM_IGNORE_END}/d") + | sed \ + -e "/${MDLM_SECTION_CLOSE}/,/${MDLM_SECTION_OPEN}/d" \ + -e "/${MDLM_SECTION_OPEN}/d" \ + -e "/$MDLM_IGNORE_START/,/$MDLM_IGNORE_END/d") \ + <(grep -v "${MDLM_HEADER}" "${1}" \ + | sed \ + -e "/${MDLM_IGNORE_START}/,/${MDLM_IGNORE_END}/d") } mdlm_get_file_localizations() { diff --git a/test/example-localized/README-ar.md b/test/example-localized/README-ar.md index 76297af..15b1f33 100644 --- a/test/example-localized/README-ar.md +++ b/test/example-localized/README-ar.md @@ -1,23 +1,23 @@ -[English](README.md) | [Русский](README-ru.md) | **[العَرَبِيَّة](README-ar.md)** | [简体中文](README-zh-Hans.md) | [Español](README-es.md) | [Français](README-fr.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* +[English](README.md) | [Русский](README-ru.md) | **[العَرَبِيَّة](README-ar.md)** | [简体中文](README-zh-Hans.md) | [Español](README-es.md) | [Français](README-fr.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* - + ![l10n-sync-ar](https://github.com/markdown-localization/markdown-localization-spec/workflows/l10n-sync-ar/badge.svg) - + - +l10n:section --> ## المثال أ هنا نص المثال. ترجم مع ترجمة جوجل. - +l10n:section --> ### المراجع بعض المراجع هنا. diff --git a/test/example-localized/README-es.md b/test/example-localized/README-es.md index c4b7c5e..e6ddd13 100644 --- a/test/example-localized/README-es.md +++ b/test/example-localized/README-es.md @@ -1,23 +1,23 @@ -[English](README.md) | [Русский](README-ru.md) | [العَرَبِيَّة](README-ar.md) | [简体中文](README-zh-Hans.md) | **[Español](README-es.md)** | [Français](README-fr.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* +[English](README.md) | [Русский](README-ru.md) | [العَرَبِيَّة](README-ar.md) | [简体中文](README-zh-Hans.md) | **[Español](README-es.md)** | [Français](README-fr.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* - + ![l10n-sync-es](https://github.com/markdown-localization/markdown-localization-spec/workflows/l10n-sync-es/badge.svg) - + - +l10n:section --> ## Ejemplo A Aquí hay un texto de ejemplo. Traducido con Google Translate. - +l10n:section --> ### Referencias Algunas referencias aquí. diff --git a/test/example-localized/README-fr.md b/test/example-localized/README-fr.md index e193f31..ea34b10 100644 --- a/test/example-localized/README-fr.md +++ b/test/example-localized/README-fr.md @@ -1,23 +1,23 @@ -[English](README.md) | [Русский](README-ru.md) | [العَرَبِيَّة](README-ar.md) | [简体中文](README-zh-Hans.md) | [Español](README-es.md) | **[Français](README-fr.md)** | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* +[English](README.md) | [Русский](README-ru.md) | [العَرَبِيَّة](README-ar.md) | [简体中文](README-zh-Hans.md) | [Español](README-es.md) | **[Français](README-fr.md)** | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* - + ![l10n-sync-fr](https://github.com/markdown-localization/markdown-localization-spec/workflows/l10n-sync-fr/badge.svg) - + - +l10n:section --> ## Exemple A Voici un texte d'exemple. Traduit avec Google Translate. - +l10n:section --> ### Les références Quelques références ici. diff --git a/test/example-localized/README-ru.md b/test/example-localized/README-ru.md index d7da1fd..7138a2c 100644 --- a/test/example-localized/README-ru.md +++ b/test/example-localized/README-ru.md @@ -1,23 +1,23 @@ -[English](README.md) | **[Русский](README-ru.md)** | [العَرَبِيَّة](README-ar.md) | [简体中文](README-zh-Hans.md) | [Español](README-es.md) | [Français](README-fr.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* +[English](README.md) | **[Русский](README-ru.md)** | [العَرَبِيَّة](README-ar.md) | [简体中文](README-zh-Hans.md) | [Español](README-es.md) | [Français](README-fr.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* - + ![l10n-sync-ru](https://github.com/markdown-localization/markdown-localization-spec/workflows/l10n-sync-ru/badge.svg) - + - +l10n:section --> ## Пример А Здесь находится текст примера. - +l10n:section --> ### Ссылки diff --git a/test/example-localized/README-zh-Hans.md b/test/example-localized/README-zh-Hans.md index f636bcb..2dde060 100644 --- a/test/example-localized/README-zh-Hans.md +++ b/test/example-localized/README-zh-Hans.md @@ -1,23 +1,23 @@ -[English](README.md) | [Русский](README-ru.md) | [العَرَبِيَّة](README-ar.md) | **[简体中文](README-zh-Hans.md)** | [Español](README-es.md) | [Français](README-fr.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* +[English](README.md) | [Русский](README-ru.md) | [العَرَبِيَّة](README-ar.md) | **[简体中文](README-zh-Hans.md)** | [Español](README-es.md) | [Français](README-fr.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* - + ![l10n-sync-zh-Hans](https://github.com/markdown-localization/markdown-localization-spec/workflows/l10n-sync-zh-Hans/badge.svg) - + - +l10n:section --> ## 示例A 这是一个示例文本。 用Google翻译翻译。 - +l10n:section --> ### 参考 这里有一些参考。 diff --git a/test/example-localized/README.md b/test/example-localized/README.md index eadd78f..a23324d 100644 --- a/test/example-localized/README.md +++ b/test/example-localized/README.md @@ -1,4 +1,4 @@ -**[English](README.md)** | [Русский](README-ru.md) | [العَرَبِيَّة](README-ar.md) | [简体中文](README-zh-Hans.md) | [Español](README-es.md) | [Français](README-fr.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* +**[English](README.md)** | [Русский](README-ru.md) | [العَرَبِيَّة](README-ar.md) | [简体中文](README-zh-Hans.md) | [Español](README-es.md) | [Français](README-fr.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* ## Example A diff --git a/test/example-original/README-fr.md.en-it-fr.expected b/test/example-original/README-fr.md.en-it-fr.expected index 05bb8bb..97734dd 100644 --- a/test/example-original/README-fr.md.en-it-fr.expected +++ b/test/example-original/README-fr.md.en-it-fr.expected @@ -1,15 +1,15 @@ -[English](README.md) | **[Français](README-fr.md)** | [Italiano](README-it.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* - + +l10n:section --> TBD - +l10n:section --> TBD diff --git a/test/example-original/README-it.md.en-it-fr.expected b/test/example-original/README-it.md.en-it-fr.expected index b078a4c..bcc197c 100644 --- a/test/example-original/README-it.md.en-it-fr.expected +++ b/test/example-original/README-it.md.en-it-fr.expected @@ -1,16 +1,16 @@ -[English](README.md) | [Français](README-fr.md) | **[Italiano](README-it.md)** | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* +[English](README.md) | [Français](README-fr.md) | **[Italiano](README-it.md)** | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* - +l10n:section --> TBD - +l10n:section --> TBD diff --git a/test/example-original/README-it.md.en-it.expected b/test/example-original/README-it.md.en-it.expected index 313cdd5..9b872bb 100644 --- a/test/example-original/README-it.md.en-it.expected +++ b/test/example-original/README-it.md.en-it.expected @@ -1,16 +1,16 @@ -[English](README.md) | **[Italiano](README-it.md)** | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* +[English](README.md) | **[Italiano](README-it.md)** | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* - +l10n:section --> TBD - +l10n:section --> TBD diff --git a/test/example-original/README.md.en-it-fr.expected b/test/example-original/README.md.en-it-fr.expected index e7a6e20..726f3a4 100644 --- a/test/example-original/README.md.en-it-fr.expected +++ b/test/example-original/README.md.en-it-fr.expected @@ -1,4 +1,4 @@ -**[English](README.md)** | [Français](README-fr.md) | [Italiano](README-it.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* +**[English](README.md)** | [Français](README-fr.md) | [Italiano](README-it.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* ## Example A Here is a text of example. diff --git a/test/example-original/README.md.en-it.expected b/test/example-original/README.md.en-it.expected index 8051ff8..730ed31 100644 --- a/test/example-original/README.md.en-it.expected +++ b/test/example-original/README.md.en-it.expected @@ -1,4 +1,4 @@ -**[English](README.md)** | [Italiano](README-it.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* +**[English](README.md)** | [Italiano](README-it.md) | *[Add](https://github.com/markdown-localization/markdown-localization-spec#workflow)* ## Example A Here is a text of example.