From 7202fa6cb499aeb3e423d67cd6224e7834138b54 Mon Sep 17 00:00:00 2001 From: Zhicheng Wang Date: Sun, 19 Jun 2016 19:31:02 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:=20=E8=87=AA=E5=8A=A8=E5=8A=A0=E7=A9=BA?= =?UTF-8?q?=E6=A0=BC=E6=97=B6=E6=B2=A1=E6=9C=89=E5=BF=BD=E7=95=A5html?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=EF=BC=8C=E5=AF=BC=E8=87=B4=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E6=B7=B7=E4=B9=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/docs/_includes/_side-nav.jade | 6 ++-- public/docs/ts/latest/guide/index.jade | 38 +++++++++++++------------- public/resources/css/_translate.scss | 9 ++++++ public/translate/cn/translate.js | 10 ++++++- 4 files changed, 40 insertions(+), 23 deletions(-) diff --git a/public/docs/_includes/_side-nav.jade b/public/docs/_includes/_side-nav.jade index dd5c3bc13c..a7be93033b 100644 --- a/public/docs/_includes/_side-nav.jade +++ b/public/docs/_includes/_side-nav.jade @@ -83,7 +83,7 @@ nav.side-nav.l-pinned-left.l-layer-4.l-offset-nav .nav-ordered-lists(class="#{isCollapsed(anyItemSelected(basics))}") ul each item, index in basics - li(class="nav-list-item translated-cn #{item.class}"): a(href="#{item.href}" title="#{item.tooltip}") #{index + 1}. #{item.navTitle} + li(class="nav-list-item #{item.class}"): a(href="#{item.href}" title="#{item.tooltip}") #{index + 1}. #{item.navTitle} .nav-blocks a(class="nav-title #{anyItemSelected(guide)}" href="#{guide[0].href}" title="#{guide[0].tooltip}") 开发指南 @@ -92,7 +92,7 @@ nav.side-nav.l-pinned-left.l-layer-4.l-offset-nav .nav-unordered-lists(class="#{isCollapsed(anyItemSelected(guide))}") ul each item in guide - li(class="nav-list-item translated-cn #{item.class}"): a(href="#{item.href}" title="#{item.tooltip}") #{item.navTitle} + li(class="nav-list-item #{item.class}"): a(href="#{item.href}" title="#{item.tooltip}") #{item.navTitle} .nav-blocks a(class="nav-title #{anyItemSelected(cookbook)}" href="#{cookbook[0].href}" title="#{cookbook[0].tooltip}") 烹饪宝典 @@ -104,7 +104,7 @@ nav.side-nav.l-pinned-left.l-layer-4.l-offset-nav li(class="nav-list-item #{item.class}"): a(href="#{item.href}" title="#{item.tooltip}") #{item.navTitle} .nav-blocks - a(class="nav-title translated-cn #{isApiReferenceSelected()}" href="#{reference[0].href}" title="#{reference[0].tooltip}") API参考手册 + a(class="nav-title #{isApiReferenceSelected()}" href="#{reference[0].href}" title="#{reference[0].tooltip}") API参考手册 script. // Could put in appCtrl but only needed here and clear here diff --git a/public/docs/ts/latest/guide/index.jade b/public/docs/ts/latest/guide/index.jade index d4b806a0db..89d56e0f3d 100644 --- a/public/docs/ts/latest/guide/index.jade +++ b/public/docs/ts/latest/guide/index.jade @@ -31,22 +31,22 @@ figure // #enddocregion how-to-read-1 // #docregion how-to-read-2 - var top="vertical-align:top" -table(width="100%") +table.vertical-table(width="100%") col(width="15%") col tr(style=top) - td - p QuickStart - p 快速起步 + th + p QuickStart + p 快速起步 td :marked The foundation for every chapter and sample in this documentation. 本文档中每一个章节和范例的基础工作。 tr(style=top) - td - p Tutorial - p 教程 + th + p Tutorial + p 教程 td :marked A step-by-step, immersive approach to learning Angular that @@ -54,36 +54,36 @@ table(width="100%") 按部就班、沉浸式的Angular学习之旅,在应用场景中介绍了Angular的各个主要特性。 tr(style=top) - td - p Basics - p 基础 + th + p Basics + p 基础 td :marked The essential ingredients of Angular development. Angular开发中必不可少的要素。 tr(style=top) - td - p Developer Guide - p 开发指南 + th + p Developer Guide + p 开发指南 td :marked In-depth analysis of Angular features and development practices. 深入分析Angular的特性和开发实践。 tr(style=top) - td - p Cookbook - p 烹饪宝典 + th + p Cookbook + p 烹饪宝典 td :marked Recipes for specific application challenges, mostly code snippets with a minimum of exposition. 一组解决实际应用中某些特定挑战的食谱,大部分是代码片段,也有少量的详细阐述。 tr(style=top) - td - p API Reference - p API 参考 + th + p API Reference + p API参考手册 td :marked Authoritative details about each member of the Angular libraries. diff --git a/public/resources/css/_translate.scss b/public/resources/css/_translate.scss index ce4d6c7d28..235d6992a7 100644 --- a/public/resources/css/_translate.scss +++ b/public/resources/css/_translate.scss @@ -20,6 +20,9 @@ td, th { margin-left: 0.2em; margin-right: 0.2em; } + span[lang=english] { + display: inline-block; + } } .about-cn-translation { @@ -32,3 +35,9 @@ td, th { body, .main-nav .main-nav-button,.translated-cn code { font-family: "Helvetica Neue", Arial, STHeiti, "Microsoft YaHei", sans-serif, Helvetica, "DroidSansFallback", FreeSans, Arimo, "Droid Sans", "wenquanyi micro hei", "Hiragino Sans GB", "Hiragino Sans GB W3" !important; } + +.vertical-table { + th { + white-space: nowrap; + } +} diff --git a/public/translate/cn/translate.js b/public/translate/cn/translate.js index 8762be743d..a88bfb6cbe 100644 --- a/public/translate/cn/translate.js +++ b/public/translate/cn/translate.js @@ -62,7 +62,15 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true'; var nodes = document.querySelectorAll('.translated-cn'); _.each(nodes, function (node) { var text = node.innerHTML; - text = text.replace(/([\x20-\xff]+)/g, '$1'); + text = text.replace(/([\x20-\xff]+)/g, function (word) { + if (!word.replace(/\s/, '')) { + return ''; + } else if (/<[^>]*>/.test(word)) { + return word; + } else { + return '' + word + ''; + } + }); node.innerHTML = text; }); }