Unbreak some Markdown tables that are all one 1 line in translations (#43523)
This commit is contained in:
@@ -46,6 +46,27 @@ export function correctTranslatedContentStrings(content, englishContent, context
|
||||
content = content.replaceAll('{{ 용어집.description }}', '{{ glossary.description }}')
|
||||
}
|
||||
|
||||
// We have seen a lot of Markdown tables, that may have Liquid tags
|
||||
// (like `{% ifversion ... %}`) within them lose the linebreak between
|
||||
// the heading and the first row marker.
|
||||
// For example:
|
||||
//
|
||||
// | **Sprache** | **Ökosystem** | **Manifestdatei** | **Unterstützter Abhängigkeitsbereich** | |:---|:---:|:---:|:---|{% ifversion dep
|
||||
//
|
||||
// The equivalent English for that is:
|
||||
//
|
||||
// | **Language** | **Ecosystem** | **Manifest file** | **Dependency scope supported** |
|
||||
// |:---|:---:|:---:|:---|
|
||||
// {%- ifversion dependency-graph-dart-support %}
|
||||
//
|
||||
// Let's inject these newline characters if found in the English content.
|
||||
if (content.includes('| |:---|:') && englishContent.includes('|\n|:---|')) {
|
||||
content = content.replaceAll('| |:---|:', '|\n|:---|:')
|
||||
}
|
||||
if (content.includes('|:---|{% ifversion') && englishContent.includes('|:---|\n{%- ifversion')) {
|
||||
content = content.replaceAll('|:---|{% ifversion', '|:---|\n{%- ifversion')
|
||||
}
|
||||
|
||||
// A lot of Liquid tags lose their linebreak after the `}` which can
|
||||
// result in formatting problems, especially around Markdown tables.
|
||||
// This code here, compares each Liquid statement, in the translation,
|
||||
|
||||
Reference in New Issue
Block a user