From cac858a6cf31e371d3c7a8d74b5aa5e00144c2d1 Mon Sep 17 00:00:00 2001 From: numbbbbb Date: Wed, 4 Jun 2014 18:51:42 +0800 Subject: [PATCH] refactor the whole repo --- change_cdn.py | 17 - {swift => chapter1}/README.html | 26 +- .../a_swift_tour.html | 62 +- {swift => chapter1}/swift.html | 30 +- chapter2/article_1.html | 52 +- chapter2/the_basics.html | 26 +- index.html | 26 +- manifest.appcache | 8 +- search_index.json | 2 +- source/README.md | 6 + source/SUMMARY.md | 8 + source/chapter1/README.md | 4 + source/chapter1/a_swift_tour.md | 596 ++++++++++++++++++ source/chapter1/swift.md | 13 + source/chapter2/article_1.md | 60 ++ source/chapter2/the_basics.md | 3 + 16 files changed, 819 insertions(+), 120 deletions(-) delete mode 100644 change_cdn.py rename {swift => chapter1}/README.html (88%) rename a_swift_tour.html => chapter1/a_swift_tour.html (92%) rename {swift => chapter1}/swift.html (88%) create mode 100644 source/README.md create mode 100644 source/SUMMARY.md create mode 100644 source/chapter1/README.md create mode 100644 source/chapter1/a_swift_tour.md create mode 100644 source/chapter1/swift.md create mode 100644 source/chapter2/article_1.md create mode 100644 source/chapter2/the_basics.md diff --git a/change_cdn.py b/change_cdn.py deleted file mode 100644 index 8c3cb381..00000000 --- a/change_cdn.py +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/python - - -import os - - -def iter(path): - for root, dirs, files in os.walk(path): - for fn in files: - if fn.endswith(".html"): - with open(root + '/' + fn, 'r') as f: - content = f.read() - content = content.replace('', '').replace('', '') - with open(root + '/' + fn, 'w') as f: - f.write(content) - -iter(os.getcwd()) diff --git a/swift/README.html b/chapter1/README.html similarity index 88% rename from swift/README.html rename to chapter1/README.html index af48ff46..51377ceb 100644 --- a/swift/README.html +++ b/chapter1/README.html @@ -15,7 +15,7 @@ - + @@ -46,7 +46,7 @@ -
+
@@ -123,9 +123,9 @@ -
  • +
  • - + 1. 欢迎使用Swift @@ -133,18 +133,18 @@
      -
    • +
    • - + 1.1. 关于Swift
    • -
    • +
    • - + 1.2. Swift初见 @@ -202,11 +202,11 @@ - + - + - + @@ -217,7 +217,7 @@
      -
      +

      欢迎使用Swift

      在本章中您将了解Swift的特性和开发历史,并对Swift有一个初步的了解。

      @@ -233,7 +233,7 @@ - +
  • diff --git a/a_swift_tour.html b/chapter1/a_swift_tour.html similarity index 92% rename from a_swift_tour.html rename to chapter1/a_swift_tour.html index 27a20f18..91020dc3 100644 --- a/a_swift_tour.html +++ b/chapter1/a_swift_tour.html @@ -1,5 +1,5 @@ - + @@ -15,10 +15,10 @@ - + - + @@ -33,7 +33,7 @@ - + @@ -41,12 +41,12 @@ - + -
    +
    @@ -98,7 +98,7 @@

    - Swift编程语言 + Swift编程语言

    @@ -119,13 +119,13 @@
  • - Introduction + Introduction
  • -
  • +
  • - + 1. 欢迎使用Swift @@ -133,18 +133,18 @@
  • - + - + - + - + - + - +
    -
    +

    Swift初见

    通常来说,编程语言教程中的第一个程序应该在屏幕上打印“Hello, world”。在Swift中,可以用一行代码实现:

    @@ -548,7 +548,9 @@ triangleAndSquare.triangle.sideLength var counter = Counter() counter.incrementBy(2, numberOfTimes: 7)

    处理变量的可选值时,你可以在操作(比如方法、属性和子脚本)之前加?。如果?之前的值是nil?后面的东西都会被忽略,并且整个表达式返回nil。否则,?之后的东西都会被运行。在这两种情况下,整个表达式的值也是一个可选值。

    -

    枚举和结构体

    +
    let optionalSquare: Square? = Square(sideLength: 2.5, name: "optional square")
    +let sideLength = optionalSquare?.sideLength
    +

    枚举和结构体

    使用enum来创建一个枚举。就像类和其他所有命名类型一样,枚举可以包含方法。

    enum Rank: Int {
         case Ace = 1
    @@ -729,10 +731,10 @@ anyCommonElements([1, 2, 3], [3])
             
    - + - +
    @@ -741,12 +743,12 @@ anyCommonElements([1, 2, 3], [3]) - - + + - + @@ -754,7 +756,7 @@ anyCommonElements([1, 2, 3], [3]) - +