Skip to content
This repository has been archived by the owner on Aug 24, 2019. It is now read-only.

Commit

Permalink
Organize
Browse files Browse the repository at this point in the history
  • Loading branch information
soffes committed Jun 15, 2015
1 parent 4c1a3f3 commit 5e6d721
Show file tree
Hide file tree
Showing 17 changed files with 468 additions and 100 deletions.
27 changes: 25 additions & 2 deletions Readme.markdown
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
# Syntax Kit

TextMate-style syntax highlighting.
[![Version](https://img.shields.io/github/release/soffes/SyntaxKit.svg)](https://github.com/soffes/SyntaxKit/releases) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![CocoaPods compatible](https://img.shields.io/cocoapods/v/SyntaxKit.svg)](https://cocoapods.org/pods/SyntaxKit)

Syntax Kit makes TextMate-style syntax highlighting easy. It works on iOS & OS X.

Syntax Kit was abstracted from [Whiskey](http://usewhiskey.com).


## Building

Xcode 7 is required to build SyntaxKit.
Syntax Kit is written in Swift 2 so Xcode 7 is required. There aren't any dependencies besides system frameworks.


## Installation

[Carthage](https://github.com/carthage/carthage) is the recommended way to install Syntax Kit. Add the following to your Cartfile:

``` ruby
github "soffes/SyntaxKit"
```

You can also install with [CocoaPods](https://cocoapods.org):

``` ruby
pod 'SyntaxKit'
```

For manual installation, I recommend adding the project as a subproject to your project or workspace and adding the appropriate framework as a target dependency.


## Usage
Expand Down Expand Up @@ -65,3 +86,5 @@ Easy as that. This method takes an optional `baseAttributes` parameter to custom
### Custom Parsers

If you want to build your own parser (for example, to generate HTML) you can subclass whichever one meets your needs. Go nuts.

Enjoy.
13 changes: 13 additions & 0 deletions SyntaxKit.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Pod::Spec.new do |spec|
spec.name = 'SyntaxKit'
spec.version = '0.1.0'
spec.authors = {'Sam Soffes' => 'sam@soff.es'}
spec.homepage = 'https://github.com/soffes/SyntaxKit'
spec.summary = 'TextMate-style syntax highlighting.'
spec.source = {:git => 'https://github.com/soffes/SyntaxKit.git', :tag => "v#{spec.version}"}
spec.license = { :type => 'MIT', :file => 'LICENSE' }

spec.ios.frameworks = 'Foundation', 'UIKit'
spec.osx.frameworks = 'Foundation', 'AppKit'
spec.source_files = 'SyntaxKit/*.{h,m,swift}'
end
373 changes: 295 additions & 78 deletions SyntaxKit.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "2122A6DD1B22B9320006409B"
BuildableName = "SyntaxKit.framework"
BlueprintName = "SyntaxKit"
ReferencedContainer = "container:SyntaxKit.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2122A6E81B22B9320006409B"
BuildableName = "SyntaxKitTests.xctest"
BlueprintName = "SyntaxKitTests"
BlueprintName = "SyntaxKit-OSX"
ReferencedContainer = "container:SyntaxKit.xcodeproj">
</BuildableReference>
</BuildActionEntry>
Expand All @@ -48,8 +34,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2122A6E81B22B9320006409B"
BuildableName = "SyntaxKitTests.xctest"
BlueprintName = "SyntaxKitTests"
BuildableName = "SyntaxKit-OSXTests.xctest"
BlueprintName = "SyntaxKit-OSXTests"
ReferencedContainer = "container:SyntaxKit.xcodeproj">
</BuildableReference>
</TestableReference>
Expand All @@ -59,7 +45,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "2122A6DD1B22B9320006409B"
BuildableName = "SyntaxKit.framework"
BlueprintName = "SyntaxKit"
BlueprintName = "SyntaxKit-OSX"
ReferencedContainer = "container:SyntaxKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
Expand All @@ -81,7 +67,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "2122A6DD1B22B9320006409B"
BuildableName = "SyntaxKit.framework"
BlueprintName = "SyntaxKit"
BlueprintName = "SyntaxKit-OSX"
ReferencedContainer = "container:SyntaxKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
Expand All @@ -99,7 +85,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "2122A6DD1B22B9320006409B"
BuildableName = "SyntaxKit.framework"
BlueprintName = "SyntaxKit"
BlueprintName = "SyntaxKit-OSX"
ReferencedContainer = "container:SyntaxKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
Expand Down
100 changes: 100 additions & 0 deletions SyntaxKit.xcodeproj/xcshareddata/xcschemes/SyntaxKit-iOS.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "211989A61B2EC3B600F0D786"
BuildableName = "SyntaxKit-iOS.framework"
BlueprintName = "SyntaxKit-iOS"
ReferencedContainer = "container:SyntaxKit.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES"
buildConfiguration = "Debug">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "211989AF1B2EC3B600F0D786"
BuildableName = "SyntaxKit-iOSTests.xctest"
BlueprintName = "SyntaxKit-iOSTests"
ReferencedContainer = "container:SyntaxKit.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "211989A61B2EC3B600F0D786"
BuildableName = "SyntaxKit-iOS.framework"
BlueprintName = "SyntaxKit-iOS"
ReferencedContainer = "container:SyntaxKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "211989A61B2EC3B600F0D786"
BuildableName = "SyntaxKit-iOS.framework"
BlueprintName = "SyntaxKit-iOS"
ReferencedContainer = "container:SyntaxKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "211989A61B2EC3B600F0D786"
BuildableName = "SyntaxKit-iOS.framework"
BlueprintName = "SyntaxKit-iOS"
ReferencedContainer = "container:SyntaxKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
29 changes: 29 additions & 0 deletions SyntaxKit/Tests/TestHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,35 @@ func simpleTheme() -> Theme! {
])
}

#if os(iOS)
import UIKit
extension Color {
var redComponent: CGFloat {
var value: CGFloat = 0.0
getRed(&value, green: nil, blue: nil, alpha: nil)
return value
}

var greenComponent: CGFloat {
var value: CGFloat = 0.0
getRed(nil, green: &value, blue: nil, alpha: nil)
return value
}

var blueComponent: CGFloat {
var value: CGFloat = 0.0
getRed(nil, green: nil, blue: &value, alpha: nil)
return value
}

var alphaComponent: CGFloat {
var value: CGFloat = 0.0
getRed(nil, green: nil, blue: nil, alpha: &value)
return value
}
}
#endif

func assertEqualColors(color1: Color, _ color2: Color, accuracy: CGFloat = 0.005) {
XCTAssertEqualWithAccuracy(color1.redComponent, color2.redComponent, accuracy: accuracy)
XCTAssertEqualWithAccuracy(color1.greenComponent, color2.greenComponent, accuracy: accuracy)
Expand Down
File renamed without changes.

0 comments on commit 5e6d721

Please sign in to comment.