swift-codeblocks-syntax-highlight

Everthing is Ok now, thanks Samy Pessé.

Lastest version at The Swift Programming Language 中文版.

由于The Swift Programming Language 中文版不能swift语言高亮.

Enjoy:

There's a swfit syntax bug highlight onGitbooknow, even though Samy Pessé had upgraded the highlight version of gitbook/package.json to 8.1.0, which support swfit syntax.

如果不论PDF、MOBI、EPUB格式输出,则 $$Coding \approx Github + Gitbook$$

一般html解决办法见highlightjs,需要xcode.css、highlight.pack.js,并在head增加:

<link rel="stylesheet" href="../assets/css/xcode.css">
<script src="../assets/js/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>

Test:

extension OCBool: Equatable{
}

//支持等值判断运算符
func ==( left: OCBool, right: OCBool )->Bool{
    switch (left, right){
    case (.ocTrue, .ocTrue):
            return true
    default:
        return false
    }
}
//支持位与运算符
func &( left:OCBool, right: OCBool)->OCBool{

    if left{
        return right
    }
    else{
        return false
    }
}
//支持位或运算符
func |( left:OCBool, right: OCBool)->OCBool{

    if left{
        return true
    }
    else{
        return right
    }
}

//支持位异或运算符
func ^( left:OCBool, right: OCBool)->OCBool{
    return OCBool( left != right )
}
//支持求反运算符
@prefix func !( a:OCBool )-> OCBool{
    return a ^ true
}
//支持组合求与运算符
func &= (inout left:OCBool, right:OCBool ){
    left = left & right
}


var isHasMoney:OCBool = true
var isHasWife:OCBool = true
var isHasHealty:OCBool = true
var isHasLover:OCBool = true

isHasMoney != isHasHealty
isHasHealty == isHasMoney
isHasWife ^ isHasLover
isHasWife = !isHasLover

if (isHasMoney | isHasHealty) & isHasHealty{
    println( "坐看云起时")
}else
{
    println("千金散尽还复来")
}

Build Status