Merge pull request #131 from todoubaba/translate

Processing sibling with children only
This commit is contained in:
Rex 2016-11-24 19:39:56 +00:00 committed by GitHub
commit 89195ee681
2 changed files with 10 additions and 2 deletions

View File

@ -80,6 +80,10 @@ td, th {
h2 { h2 {
border-bottom: 1px solid $silver; border-bottom: 1px solid $silver;
} }
p {
margin: 0 0 24px 0;
line-height: 28px;
}
} }
body, .main-nav .main-nav-button,.translated-cn code { body, .main-nav .main-nav-button,.translated-cn code {

View File

@ -28,7 +28,8 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true';
// ignore example code. // ignore example code.
if (node.classList.contains('code-example') || if (node.classList.contains('code-example') ||
node.tagName === 'CODE-EXAMPLE') { node.tagName === 'CODE-EXAMPLE' ||
node.tagName === 'SCRIPT') {
continue; continue;
} }
@ -51,6 +52,7 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true';
case 'TH': case 'TH':
case 'UL': case 'UL':
case 'OL': case 'OL':
case 'DIV':
processContainer(node); processContainer(node);
break; break;
default: default:
@ -81,7 +83,9 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true';
if (sibling) { if (sibling) {
if (isClonedNode(current, sibling)) { if (isClonedNode(current, sibling)) {
if (isPureEnglish(current.textContent)) { if (isPureEnglish(current.textContent)) {
processContainer(sibling); if (sibling.children) {
processContainer(sibling);
}
$current.addClass('original-english'); $current.addClass('original-english');
$sibling.addClass('translated'); $sibling.addClass('translated');
$sibling.addClass('translated-cn'); $sibling.addClass('translated-cn');