Skip to content

Commit 44aa5b7

Browse files
committed
webpage: fix more build issues with translations
Signed-off-by: Patrizio Bekerle <patrizio@bekerle.com>
1 parent 5c9f2c5 commit 44aa5b7

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

scripts/download_translations.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,20 @@ fixCrowdinTranslationProblems() {
126126
# Fix malformed anchor tags where the closing > of the opening tag is missing (e.g. <a href="url"text</a>)
127127
perl -i -pe 's|<a href="([^"]+)"([^>\s<][^<]*)</a>|[$2]($1)|g' "$1"
128128
sed -i -e ':a' -e 'N' -e '$!ba' -e 's/~~~\n~~~/```\n~~~/g' "$1"
129+
# Convert <code>text</code> pairs to backtick code spans
130+
perl -i -pe 's|<code>([^<]*)</code>|`$1`|g' "$1"
131+
# Convert <li> at the start of a line to a markdown list item
132+
sed -i -E 's|^<li>|- |g' "$1"
133+
# Remove orphaned HTML list/paragraph tags that break Vue template compilation
134+
sed -i -E 's|</?(li|ul|ol|p)\s*>||g' "$1"
135+
# Remove remaining orphaned <code> and </code> tags
136+
sed -i -E 's|</?code\s*>||g' "$1"
137+
# Remove numeric placeholder tags like <0>, </0>, <1>, </1>, </0 >, etc.
138+
sed -i -E 's|</?[0-9]+\s*>||g' "$1"
139+
# Fix HTML entity &gt; to > inside backtick code spans (Crowdin sometimes encodes -> as -&gt;)
140+
perl -i -pe 's|(`[^`]*?)&gt;([^`]*`)|$1>$2|g' "$1"
141+
# Fix HTML entity &lt; to < inside backtick code spans
142+
perl -i -pe 's|(`[^`]*?)&lt;([^`]*`)|$1<$2|g' "$1"
129143
}
130144

131145
echo "Fix Crowdin translation bugs..."

webpage/scripts/find-corrupted-files.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ find src -name "*.md" -type f 2>/dev/null | grep -E 'src/[a-z]{2}(-[A-Z]{2})?/'
6767
error_details="${error_details}unescaped angle-bracket placeholder outside code span (e.g. '<id>'); "
6868
fi
6969

70+
# Pattern 9: Orphaned HTML list/paragraph tags (<li>, </li>, <ul>, </ul>, <ol>, </ol>, </p>)
71+
# These break Vue template compilation when they appear as bare HTML in markdown
72+
if grep -qE '</?li\s*>|</?ul\s*>|</?ol\s*>' "$file" 2>/dev/null; then
73+
has_error=true
74+
error_details="${error_details}orphaned HTML list tags (<li>, </li>, <ul>, </ul>, etc.); "
75+
fi
76+
7077
if [ "$has_error" = true ]; then
7178
corrupted_files="$corrupted_files$file
7279
"

0 commit comments

Comments
 (0)