cheatset 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/Gemfile +2 -0
- data/LICENSE.txt +22 -0
- data/README.md +75 -0
- data/Rakefile +1 -0
- data/bin/cheatset +6 -0
- data/cheatset.gemspec +31 -0
- data/lib/cheatset/cli.rb +11 -0
- data/lib/cheatset/creator.rb +74 -0
- data/lib/cheatset/dsl/base.rb +64 -0
- data/lib/cheatset/dsl/category.rb +16 -0
- data/lib/cheatset/dsl/cheatsheet.rb +18 -0
- data/lib/cheatset/dsl/context.rb +17 -0
- data/lib/cheatset/dsl/entry.rb +8 -0
- data/lib/cheatset/templates/.sass-cache/c0630dfea9543a0a71b68aca4887e98819b89684/style.scssc +0 -0
- data/lib/cheatset/templates/res/Open_Sans.woff +0 -0
- data/lib/cheatset/templates/style.css +317 -0
- data/lib/cheatset/templates/style.scss +198 -0
- data/lib/cheatset/templates/template.haml +36 -0
- data/lib/cheatset/version.rb +3 -0
- data/lib/cheatset.rb +6 -0
- metadata +206 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 69eee59e5e28ab0bd010959193bdbf88ae015d51
|
4
|
+
data.tar.gz: 697696929f19a13ca2c2581614de79f6f4288abb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 92128a90b0b06bfc0bfc879efcb8079367c42ee7c577227a120ac81ab298f9a22d3b352b66a3865e15b1348c46700a009de9c1f75e75d58af0acaec4817cc5e4
|
7
|
+
data.tar.gz: 810d205ba2a6a4d09a5c23b8ce2a1c31a36df90e132b5db1343b8fb89fd6e5e7092e5a7a39ac36377f6f776f3c3a5798336889ba274e2fc1fcffe0922b94f34d
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Florian Dütsch
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
# cheatset
|
2
|
+
|
3
|
+
[](http://badge.fury.io/rb/cheatset)
|
4
|
+
|
5
|
+
Generate your own cheatsheets as docsets for [Dash](http://kapeli.com/dash)!
|
6
|
+
Use this simple command line tool and write your cheatsheets in an easy
|
7
|
+
language (Ruby DSL).
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
$ gem install cheatset
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
Write a file (here `sample.cheatsheet`) containing your cheatsheet data, e.g.:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
cheatsheet do
|
19
|
+
title 'Sample Cheatsheet' # Will be displayed by Dash in the docset list
|
20
|
+
short_name 'sample' # Used for the filename of the docset
|
21
|
+
introduction 'My *awesome* cheatsheet' # Can contain markdown and multiple lines
|
22
|
+
|
23
|
+
# A cheatsheet must consist of categories
|
24
|
+
category do
|
25
|
+
id 'Windows' # Must be unique and is used as title of the category
|
26
|
+
|
27
|
+
entry do
|
28
|
+
command 'CMD-n' # Optional
|
29
|
+
command 'CMD-N' # Can have more than one command
|
30
|
+
name 'Create window' # A short name, can contain markdown
|
31
|
+
notes 'Some notes' # Optional longer explanation, can contain markdown
|
32
|
+
end
|
33
|
+
entry do
|
34
|
+
command 'CMD-w'
|
35
|
+
name 'Close window'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
category do
|
40
|
+
id 'Code'
|
41
|
+
entry do
|
42
|
+
name 'Code sample'
|
43
|
+
notes <<-'END'
|
44
|
+
```ruby
|
45
|
+
sample = "You can include code snippets as well"
|
46
|
+
```
|
47
|
+
Or anything else **markdown**.
|
48
|
+
END
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
notes 'Some notes at the end of the cheatsheet'
|
53
|
+
end
|
54
|
+
```
|
55
|
+
The following values may contain markdown formatted text:
|
56
|
+
|
57
|
+
* The `introduction` and the `notes` of the cheatsheet
|
58
|
+
* The `name` and the `notes` of the entries
|
59
|
+
|
60
|
+
For more complete examples look at some of
|
61
|
+
[the actual cheatsheets](https://github.com/Kapeli/cheatsheets).
|
62
|
+
|
63
|
+
To convert this file to a docset, call
|
64
|
+
|
65
|
+
$ cheatset generate sample.cheatsheet
|
66
|
+
|
67
|
+
|
68
|
+
## Contributing
|
69
|
+
|
70
|
+
Yes, please! Open issues and pull requests on the
|
71
|
+
[GitHub page](https://github.com/Kapeli/cheatset).
|
72
|
+
|
73
|
+
## Thanks
|
74
|
+
|
75
|
+
[Nix-wie-weg](https://github.com/Nix-wie-weg/dasheets) for the initial code.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/cheatset
ADDED
data/cheatset.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cheatset/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'cheatset'
|
8
|
+
spec.version = Cheatset::VERSION
|
9
|
+
spec.authors = ['Bogdan Popescu']
|
10
|
+
spec.description = 'Generate cheatsheets for Dash'
|
11
|
+
spec.summary = spec.description
|
12
|
+
spec.homepage = 'https://github.com/Kapeli/cheatset'
|
13
|
+
spec.license = 'MIT'
|
14
|
+
|
15
|
+
spec.files = `git ls-files`.split($/)
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ['lib']
|
19
|
+
|
20
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
21
|
+
spec.add_development_dependency 'rake'
|
22
|
+
|
23
|
+
spec.add_dependency 'thor'
|
24
|
+
spec.add_dependency 'haml', '~> 4.0.3'
|
25
|
+
spec.add_dependency 'sqlite3', '~> 1.3.8'
|
26
|
+
spec.add_dependency 'plist', '~> 3.1.0'
|
27
|
+
spec.add_dependency 'redcarpet', '~> 3.1.1'
|
28
|
+
spec.add_dependency 'rouge', '~> 1.3.2'
|
29
|
+
spec.add_dependency 'sanitize', '~> 2.0.6'
|
30
|
+
spec.add_dependency 'unindent', '~> 1.0'
|
31
|
+
end
|
data/lib/cheatset/cli.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'plist'
|
2
|
+
require 'sqlite3'
|
3
|
+
require 'fileutils'
|
4
|
+
require 'haml'
|
5
|
+
require 'ostruct'
|
6
|
+
|
7
|
+
class Cheatset::Creator
|
8
|
+
def initialize(cheatsheet)
|
9
|
+
@cheatsheet = cheatsheet
|
10
|
+
@docset_path = "#{@cheatsheet.short_name}.docset"
|
11
|
+
@path = "#{@docset_path}/Contents/"
|
12
|
+
end
|
13
|
+
|
14
|
+
def generate
|
15
|
+
FileUtils.rm_rf(@path)
|
16
|
+
FileUtils.mkdir_p(@path)
|
17
|
+
generate_html_file
|
18
|
+
generate_plist_file
|
19
|
+
generate_database
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def tpl_path
|
25
|
+
File.expand_path('../templates', __FILE__)
|
26
|
+
end
|
27
|
+
|
28
|
+
def generate_html_file
|
29
|
+
# HTML
|
30
|
+
template = File.read("#{tpl_path}/template.haml")
|
31
|
+
engine = Haml::Engine.new(template)
|
32
|
+
out = engine.render(@cheatsheet)
|
33
|
+
doc_path = "#{@path}Resources/Documents/"
|
34
|
+
FileUtils.mkdir_p(doc_path)
|
35
|
+
File.open("#{doc_path}index.html", 'w') { |file| file.write(out) }
|
36
|
+
|
37
|
+
# (static) CSS
|
38
|
+
FileUtils.cp("#{tpl_path}/style.css", doc_path)
|
39
|
+
|
40
|
+
# resources
|
41
|
+
FileUtils.cp_r("#{tpl_path}/res", doc_path)
|
42
|
+
end
|
43
|
+
|
44
|
+
def generate_plist_file
|
45
|
+
plist_data = {
|
46
|
+
'CFBundleIdentifier' => @cheatsheet.short_name,
|
47
|
+
'CFBundleName' => @cheatsheet.title,
|
48
|
+
'DocSetPlatformFamily' => "cheatsheet",
|
49
|
+
'DashDocSetFamily' => 'cheatsheet',
|
50
|
+
'isDashDocset' => true,
|
51
|
+
'dashIndexFilePath' => 'index.html'
|
52
|
+
}
|
53
|
+
File.open("#{@path}Info.plist", 'w') do |file|
|
54
|
+
file.write(Plist::Emit.dump(plist_data))
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def generate_database
|
59
|
+
sqlite_file = "#{@path}Resources/docSet.dsidx"
|
60
|
+
db = SQLite3::Database.new(sqlite_file)
|
61
|
+
db.execute <<-SQL
|
62
|
+
CREATE TABLE searchIndex(id INTEGER PRIMARY KEY, name TEXT,
|
63
|
+
type TEXT, path TEXT);
|
64
|
+
CREATE UNIQUE INDEX anchor ON searchIndex (name, type, path);
|
65
|
+
SQL
|
66
|
+
@cheatsheet.categories.each do |category|
|
67
|
+
category.entries.each_with_index do |entry, index|
|
68
|
+
sql = 'INSERT INTO searchIndex(name, type, path) VALUES (?, ?, ?)'
|
69
|
+
db.execute(sql, entry.tags_stripped_name, 'Guide',
|
70
|
+
"index.html\##{category.id}-#{index}")
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'redcarpet'
|
2
|
+
require 'rouge'
|
3
|
+
require 'rouge/plugins/redcarpet'
|
4
|
+
require 'sanitize'
|
5
|
+
require 'unindent'
|
6
|
+
|
7
|
+
class HTML < Redcarpet::Render::HTML
|
8
|
+
include Rouge::Plugins::Redcarpet
|
9
|
+
end
|
10
|
+
|
11
|
+
module Cheatset
|
12
|
+
module DSL
|
13
|
+
class Base
|
14
|
+
def initialize(&block)
|
15
|
+
instance_eval(&block)
|
16
|
+
end
|
17
|
+
private
|
18
|
+
|
19
|
+
def parse_markdown(str)
|
20
|
+
markdown = Redcarpet::Markdown.new(HTML, :autolink => true, :hard_wrap =>true, :disable_indented_code_blocks => true, :fenced_code_blocks => true)
|
21
|
+
markdown.render(str)
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.define_attrs(*names)
|
25
|
+
names.each do |name|
|
26
|
+
define_method(name) do |val = nil|
|
27
|
+
instance_variable_set("@#{name}", val) if val
|
28
|
+
instance_variable_get("@#{name}")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
def self.define_list_attrs(*names)
|
33
|
+
names.each do |name|
|
34
|
+
define_method(name) do |val = nil|
|
35
|
+
if val
|
36
|
+
array = instance_variable_get("@#{name}")
|
37
|
+
if !array
|
38
|
+
instance_variable_set("@#{name}", [val])
|
39
|
+
else
|
40
|
+
instance_variable_set("@#{name}", array << val)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
instance_variable_get("@#{name}")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
def self.define_markdown_attrs(*names)
|
48
|
+
names.each do |name|
|
49
|
+
define_method(name) do |val = nil|
|
50
|
+
if val
|
51
|
+
val = val.unindent
|
52
|
+
val = parse_markdown(val)
|
53
|
+
instance_variable_set("@#{name}", val)
|
54
|
+
end
|
55
|
+
instance_variable_get("@#{name}")
|
56
|
+
end
|
57
|
+
define_method("tags_stripped_#{name}") do
|
58
|
+
Sanitize.clean(send(name))
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Cheatset
|
2
|
+
module DSL
|
3
|
+
class Category < Base
|
4
|
+
attr_reader :entries
|
5
|
+
define_attrs :id
|
6
|
+
|
7
|
+
def initialize(&block)
|
8
|
+
@entries = []
|
9
|
+
super(&block)
|
10
|
+
end
|
11
|
+
def entry(&block)
|
12
|
+
@entries << Cheatset::DSL::Entry.new(&block)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Cheatset
|
2
|
+
module DSL
|
3
|
+
class Cheatsheet < Base
|
4
|
+
attr_reader :categories
|
5
|
+
define_attrs :title, :short_name, :source_url
|
6
|
+
define_markdown_attrs :introduction, :notes
|
7
|
+
|
8
|
+
def initialize(&block)
|
9
|
+
@categories = []
|
10
|
+
super(&block)
|
11
|
+
end
|
12
|
+
|
13
|
+
def category(&block)
|
14
|
+
@categories << Cheatset::DSL::Category.new(&block)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Cheatset
|
2
|
+
module DSL
|
3
|
+
class Context
|
4
|
+
def initialize(filename)
|
5
|
+
instance_eval(File.read(filename))
|
6
|
+
end
|
7
|
+
def generate
|
8
|
+
Cheatset::Creator.new(@data).generate
|
9
|
+
end
|
10
|
+
private
|
11
|
+
|
12
|
+
def cheatsheet(&block)
|
13
|
+
@data = Cheatset::DSL::Cheatsheet.new(&block)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
Binary file
|
Binary file
|
@@ -0,0 +1,317 @@
|
|
1
|
+
h1, h2, h3, p, blockquote {
|
2
|
+
margin: 0;
|
3
|
+
padding: 0; }
|
4
|
+
|
5
|
+
@font-face {
|
6
|
+
font-family: 'Open Sans';
|
7
|
+
font-style: normal;
|
8
|
+
font-weight: 400;
|
9
|
+
src: local("Open Sans"), local("OpenSans"), url(res/Open_Sans.woff) format("woff"); }
|
10
|
+
|
11
|
+
body {
|
12
|
+
font-family: 'Open Sans', sans-serif;
|
13
|
+
font-size: 14px;
|
14
|
+
color: black;
|
15
|
+
background-color: white;
|
16
|
+
margin: 0; }
|
17
|
+
|
18
|
+
code, pre {
|
19
|
+
font-family: Menlo, Consolas, "Liberation Mono", Courier, monospace;
|
20
|
+
font-size: 13px; }
|
21
|
+
|
22
|
+
code {
|
23
|
+
margin: 0;
|
24
|
+
border: 1px solid #ddd;
|
25
|
+
background-color: #f8f8f8;
|
26
|
+
border-radius: 3px; }
|
27
|
+
|
28
|
+
code:before, code:after {
|
29
|
+
content: "\00a0"; }
|
30
|
+
|
31
|
+
header {
|
32
|
+
color: #efefef;
|
33
|
+
background-color: #666666;
|
34
|
+
padding: 0px 10px 3px 10px; }
|
35
|
+
|
36
|
+
h1 {
|
37
|
+
font-size: 35px; }
|
38
|
+
|
39
|
+
footer {
|
40
|
+
margin: 1em;
|
41
|
+
background-color: #666666;
|
42
|
+
color: #efefef;
|
43
|
+
border-radius: 10px;
|
44
|
+
text-align: center; }
|
45
|
+
footer a {
|
46
|
+
color: #efefef; }
|
47
|
+
|
48
|
+
section.notes {
|
49
|
+
margin-top: 1em; }
|
50
|
+
section.notes h2 {
|
51
|
+
color: #666666;
|
52
|
+
font-size: 1.5em; }
|
53
|
+
|
54
|
+
article {
|
55
|
+
margin: 2em 1em; }
|
56
|
+
|
57
|
+
section.category {
|
58
|
+
border: 2px solid #666666;
|
59
|
+
border-radius: 10px;
|
60
|
+
background-color: #666666;
|
61
|
+
margin: 2em 0;
|
62
|
+
overflow: hidden;
|
63
|
+
padding-bottom: 5px; }
|
64
|
+
section.category h2 {
|
65
|
+
color: white;
|
66
|
+
font-size: 1.5em;
|
67
|
+
text-align: center;
|
68
|
+
margin-top: -2px; }
|
69
|
+
|
70
|
+
table {
|
71
|
+
background-color: white;
|
72
|
+
border-collapse: collapse;
|
73
|
+
width: 100%; }
|
74
|
+
|
75
|
+
td {
|
76
|
+
padding: 6px 2px 2px 8px; }
|
77
|
+
|
78
|
+
td.command {
|
79
|
+
width: 1%;
|
80
|
+
white-space: nowrap;
|
81
|
+
vertical-align: top;
|
82
|
+
padding: 8px 8px 0 7px; }
|
83
|
+
td.command code {
|
84
|
+
padding: .1em .6em;
|
85
|
+
box-shadow: 0 1px 0px rgba(0, 0, 0, 0.2), 0 0 0 2px white inset;
|
86
|
+
border-radius: 3px;
|
87
|
+
border: 1px solid #ccc;
|
88
|
+
background-color: #efefef;
|
89
|
+
color: #333; }
|
90
|
+
|
91
|
+
td.description .name {
|
92
|
+
font-size: 1.2em; }
|
93
|
+
|
94
|
+
tr:nth-child(even) {
|
95
|
+
background: #efefef; }
|
96
|
+
|
97
|
+
a {
|
98
|
+
color: #666666; }
|
99
|
+
|
100
|
+
p {
|
101
|
+
margin: 0 0 4px; }
|
102
|
+
|
103
|
+
.highlight {
|
104
|
+
background-color: #f8f8f8;
|
105
|
+
border: 1px solid #ccc;
|
106
|
+
padding: 6px 10px;
|
107
|
+
border-radius: 3px;
|
108
|
+
margin-right: 15px;
|
109
|
+
white-space: pre-wrap;
|
110
|
+
word-wrap: break-word; }
|
111
|
+
|
112
|
+
.c {
|
113
|
+
color: #999988;
|
114
|
+
font-style: italic; }
|
115
|
+
|
116
|
+
.err {
|
117
|
+
color: #a61717;
|
118
|
+
background-color: #e3d2d2; }
|
119
|
+
|
120
|
+
.k {
|
121
|
+
font-weight: bold; }
|
122
|
+
|
123
|
+
.o {
|
124
|
+
font-weight: bold; }
|
125
|
+
|
126
|
+
.cm {
|
127
|
+
color: #999988;
|
128
|
+
font-style: italic; }
|
129
|
+
|
130
|
+
.cp {
|
131
|
+
color: #999999;
|
132
|
+
font-weight: bold; }
|
133
|
+
|
134
|
+
.c1 {
|
135
|
+
color: #999988;
|
136
|
+
font-style: italic; }
|
137
|
+
|
138
|
+
.cs {
|
139
|
+
color: #999999;
|
140
|
+
font-weight: bold;
|
141
|
+
font-style: italic; }
|
142
|
+
|
143
|
+
.gd {
|
144
|
+
color: #000000;
|
145
|
+
background-color: #ffdddd; }
|
146
|
+
|
147
|
+
.gd .x {
|
148
|
+
color: #000000;
|
149
|
+
background-color: #ffaaaa; }
|
150
|
+
|
151
|
+
.ge {
|
152
|
+
font-style: italic; }
|
153
|
+
|
154
|
+
.gr {
|
155
|
+
color: #aa0000; }
|
156
|
+
|
157
|
+
.gh {
|
158
|
+
color: #999999; }
|
159
|
+
|
160
|
+
.gi {
|
161
|
+
color: #000000;
|
162
|
+
background-color: #ddffdd; }
|
163
|
+
|
164
|
+
.gi .x {
|
165
|
+
color: #000000;
|
166
|
+
background-color: #aaffaa; }
|
167
|
+
|
168
|
+
.go {
|
169
|
+
color: #888888; }
|
170
|
+
|
171
|
+
.gp {
|
172
|
+
color: #555555; }
|
173
|
+
|
174
|
+
.gs {
|
175
|
+
font-weight: bold; }
|
176
|
+
|
177
|
+
.gu {
|
178
|
+
color: #800080;
|
179
|
+
font-weight: bold; }
|
180
|
+
|
181
|
+
.gt {
|
182
|
+
color: #aa0000; }
|
183
|
+
|
184
|
+
.kc {
|
185
|
+
font-weight: bold; }
|
186
|
+
|
187
|
+
.kd {
|
188
|
+
font-weight: bold; }
|
189
|
+
|
190
|
+
.kn {
|
191
|
+
font-weight: bold; }
|
192
|
+
|
193
|
+
.kp {
|
194
|
+
font-weight: bold; }
|
195
|
+
|
196
|
+
.kr {
|
197
|
+
font-weight: bold; }
|
198
|
+
|
199
|
+
.kt {
|
200
|
+
color: #445588;
|
201
|
+
font-weight: bold; }
|
202
|
+
|
203
|
+
.m {
|
204
|
+
color: #009999; }
|
205
|
+
|
206
|
+
.s {
|
207
|
+
color: #dd1144; }
|
208
|
+
|
209
|
+
.n {
|
210
|
+
color: #333333; }
|
211
|
+
|
212
|
+
.na {
|
213
|
+
color: teal; }
|
214
|
+
|
215
|
+
.nb {
|
216
|
+
color: #0086b3; }
|
217
|
+
|
218
|
+
.nc {
|
219
|
+
color: #445588;
|
220
|
+
font-weight: bold; }
|
221
|
+
|
222
|
+
.no {
|
223
|
+
color: teal; }
|
224
|
+
|
225
|
+
.ni {
|
226
|
+
color: purple; }
|
227
|
+
|
228
|
+
.ne {
|
229
|
+
color: #990000;
|
230
|
+
font-weight: bold; }
|
231
|
+
|
232
|
+
.nf {
|
233
|
+
color: #990000;
|
234
|
+
font-weight: bold; }
|
235
|
+
|
236
|
+
.nn {
|
237
|
+
color: #555555; }
|
238
|
+
|
239
|
+
.nt {
|
240
|
+
color: navy; }
|
241
|
+
|
242
|
+
.nv {
|
243
|
+
color: teal; }
|
244
|
+
|
245
|
+
.ow {
|
246
|
+
font-weight: bold; }
|
247
|
+
|
248
|
+
.w {
|
249
|
+
color: #bbbbbb; }
|
250
|
+
|
251
|
+
.mf {
|
252
|
+
color: #009999; }
|
253
|
+
|
254
|
+
.mh {
|
255
|
+
color: #009999; }
|
256
|
+
|
257
|
+
.mi {
|
258
|
+
color: #009999; }
|
259
|
+
|
260
|
+
.mo {
|
261
|
+
color: #009999; }
|
262
|
+
|
263
|
+
.sb {
|
264
|
+
color: #dd1144; }
|
265
|
+
|
266
|
+
.sc {
|
267
|
+
color: #dd1144; }
|
268
|
+
|
269
|
+
.sd {
|
270
|
+
color: #dd1144; }
|
271
|
+
|
272
|
+
.s2 {
|
273
|
+
color: #dd1144; }
|
274
|
+
|
275
|
+
.se {
|
276
|
+
color: #dd1144; }
|
277
|
+
|
278
|
+
.sh {
|
279
|
+
color: #dd1144; }
|
280
|
+
|
281
|
+
.si {
|
282
|
+
color: #dd1144; }
|
283
|
+
|
284
|
+
.sx {
|
285
|
+
color: #dd1144; }
|
286
|
+
|
287
|
+
.sr {
|
288
|
+
color: #009926; }
|
289
|
+
|
290
|
+
.s1 {
|
291
|
+
color: #dd1144; }
|
292
|
+
|
293
|
+
.ss {
|
294
|
+
color: #990073; }
|
295
|
+
|
296
|
+
.bp {
|
297
|
+
color: #999999; }
|
298
|
+
|
299
|
+
.vc {
|
300
|
+
color: teal; }
|
301
|
+
|
302
|
+
.vg {
|
303
|
+
color: teal; }
|
304
|
+
|
305
|
+
.vi {
|
306
|
+
color: teal; }
|
307
|
+
|
308
|
+
.il {
|
309
|
+
color: #009999; }
|
310
|
+
|
311
|
+
.gc {
|
312
|
+
color: #999;
|
313
|
+
background-color: #EAF2F5; }
|
314
|
+
|
315
|
+
pre {
|
316
|
+
padding: 15px;
|
317
|
+
line-height: 17px; }
|
@@ -0,0 +1,198 @@
|
|
1
|
+
$white: #fff;
|
2
|
+
$light_gray: #efefef;
|
3
|
+
$dark_gray: #666;
|
4
|
+
$black: #000;
|
5
|
+
////////////////////////////////////////////////////////////////////////////////
|
6
|
+
h1, h2, h3, p, blockquote {
|
7
|
+
margin: 0;
|
8
|
+
padding: 0;
|
9
|
+
}
|
10
|
+
@font-face {
|
11
|
+
font-family: 'Open Sans';
|
12
|
+
font-style: normal;
|
13
|
+
font-weight: 400;
|
14
|
+
src: local('Open Sans'), local('OpenSans'), url(res/Open_Sans.woff) format('woff');
|
15
|
+
}
|
16
|
+
|
17
|
+
body {
|
18
|
+
font-family: 'Open Sans', sans-serif;
|
19
|
+
font-size: 14px;
|
20
|
+
color: $black;
|
21
|
+
background-color: $white;
|
22
|
+
margin: 0;
|
23
|
+
}
|
24
|
+
code, pre {
|
25
|
+
font-family: Menlo, Consolas, "Liberation Mono", Courier, monospace;
|
26
|
+
font-size:13px;
|
27
|
+
}
|
28
|
+
|
29
|
+
code {
|
30
|
+
margin:0;
|
31
|
+
border:1px solid #ddd;
|
32
|
+
background-color:#f8f8f8;
|
33
|
+
border-radius:3px;
|
34
|
+
}
|
35
|
+
|
36
|
+
code:before, code:after {
|
37
|
+
content: "\00a0";
|
38
|
+
}
|
39
|
+
|
40
|
+
////////////////////////////////////////////////////////////////////////////////
|
41
|
+
header {
|
42
|
+
color: $light_gray;
|
43
|
+
background-color: $dark_gray;
|
44
|
+
padding: 0px 10px 3px 10px;
|
45
|
+
}
|
46
|
+
h1 {
|
47
|
+
font-size: 35px;
|
48
|
+
}
|
49
|
+
|
50
|
+
////////////////////////////////////////////////////////////////////////////////
|
51
|
+
footer {
|
52
|
+
margin: 1em;
|
53
|
+
background-color: $dark_gray;
|
54
|
+
color: $light_gray;
|
55
|
+
border-radius: 10px;
|
56
|
+
text-align: center;
|
57
|
+
a {
|
58
|
+
color: $light_gray;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
////////////////////////////////////////////////////////////////////////////////
|
62
|
+
// notes
|
63
|
+
section.notes {
|
64
|
+
margin-top: 1em;
|
65
|
+
h2 {
|
66
|
+
color: $dark_gray;
|
67
|
+
font-size: 1.5em;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
////////////////////////////////////////////////////////////////////////////////
|
71
|
+
article {
|
72
|
+
margin: 2em 1em;
|
73
|
+
}
|
74
|
+
section.category {
|
75
|
+
border: 2px solid $dark_gray;
|
76
|
+
border-radius: 10px;
|
77
|
+
background-color: $dark_gray;
|
78
|
+
margin: 2em 0;
|
79
|
+
overflow: hidden;
|
80
|
+
h2 {
|
81
|
+
color: $white;
|
82
|
+
font-size: 1.5em;
|
83
|
+
text-align: center;
|
84
|
+
margin-top: -2px;
|
85
|
+
}
|
86
|
+
padding-bottom: 5px;
|
87
|
+
}
|
88
|
+
table {
|
89
|
+
background-color: $white;
|
90
|
+
border-collapse: collapse;
|
91
|
+
width: 100%;
|
92
|
+
}
|
93
|
+
td {
|
94
|
+
padding: 6px 2px 2px 8px;
|
95
|
+
}
|
96
|
+
td.command {
|
97
|
+
width: 1%;
|
98
|
+
white-space: nowrap;
|
99
|
+
vertical-align: top;
|
100
|
+
padding: 8px 8px 0 7px;
|
101
|
+
code {
|
102
|
+
// Nice key styling:
|
103
|
+
// https://developers.google.com/chrome-developer-tools/docs/shortcuts
|
104
|
+
padding: .1em .6em;
|
105
|
+
box-shadow: 0 1px 0px rgba(0, 0, 0, 0.2), 0 0 0 2px #fff inset;
|
106
|
+
border-radius: 3px;
|
107
|
+
border: 1px solid #ccc;
|
108
|
+
background-color: $light_gray;
|
109
|
+
color: #333;
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
113
|
+
td.description {
|
114
|
+
.name {
|
115
|
+
font-size: 1.2em;
|
116
|
+
}
|
117
|
+
}
|
118
|
+
tr:nth-child(even) {
|
119
|
+
background: $light_gray;
|
120
|
+
}
|
121
|
+
|
122
|
+
a {
|
123
|
+
color: $dark_gray;
|
124
|
+
}
|
125
|
+
|
126
|
+
p {
|
127
|
+
margin:0 0 4px;
|
128
|
+
}
|
129
|
+
|
130
|
+
.highlight { background-color: #f8f8f8; border: 1px solid #ccc; padding: 6px 10px; border-radius: 3px; margin-right:15px; white-space: pre-wrap; word-wrap:break-word;}
|
131
|
+
.c { color: #999988; font-style: italic; }
|
132
|
+
.err { color: #a61717; background-color: #e3d2d2; }
|
133
|
+
.k { font-weight: bold; }
|
134
|
+
.o { font-weight: bold; }
|
135
|
+
.cm { color: #999988; font-style: italic; }
|
136
|
+
.cp { color: #999999; font-weight: bold; }
|
137
|
+
.c1 { color: #999988; font-style: italic; }
|
138
|
+
.cs { color: #999999; font-weight: bold; font-style: italic; }
|
139
|
+
.gd { color: #000000; background-color: #ffdddd; }
|
140
|
+
.gd .x { color: #000000; background-color: #ffaaaa; }
|
141
|
+
.ge { font-style: italic; }
|
142
|
+
.gr { color: #aa0000; }
|
143
|
+
.gh { color: #999999; }
|
144
|
+
.gi { color: #000000; background-color: #ddffdd; }
|
145
|
+
.gi .x { color: #000000; background-color: #aaffaa; }
|
146
|
+
.go { color: #888888; }
|
147
|
+
.gp { color: #555555; }
|
148
|
+
.gs { font-weight: bold; }
|
149
|
+
.gu { color: #800080; font-weight: bold; }
|
150
|
+
.gt { color: #aa0000; }
|
151
|
+
.kc { font-weight: bold; }
|
152
|
+
.kd { font-weight: bold; }
|
153
|
+
.kn { font-weight: bold; }
|
154
|
+
.kp { font-weight: bold; }
|
155
|
+
.kr { font-weight: bold; }
|
156
|
+
.kt { color: #445588; font-weight: bold; }
|
157
|
+
.m { color: #009999; }
|
158
|
+
.s { color: #dd1144; }
|
159
|
+
.n { color: #333333; }
|
160
|
+
.na { color: teal; }
|
161
|
+
.nb { color: #0086b3; }
|
162
|
+
.nc { color: #445588; font-weight: bold; }
|
163
|
+
.no { color: teal; }
|
164
|
+
.ni { color: purple; }
|
165
|
+
.ne { color: #990000; font-weight: bold; }
|
166
|
+
.nf { color: #990000; font-weight: bold; }
|
167
|
+
.nn { color: #555555; }
|
168
|
+
.nt { color: navy; }
|
169
|
+
.nv { color: teal; }
|
170
|
+
.ow { font-weight: bold; }
|
171
|
+
.w { color: #bbbbbb; }
|
172
|
+
.mf { color: #009999; }
|
173
|
+
.mh { color: #009999; }
|
174
|
+
.mi { color: #009999; }
|
175
|
+
.mo { color: #009999; }
|
176
|
+
.sb { color: #dd1144; }
|
177
|
+
.sc { color: #dd1144; }
|
178
|
+
.sd { color: #dd1144; }
|
179
|
+
.s2 { color: #dd1144; }
|
180
|
+
.se { color: #dd1144; }
|
181
|
+
.sh { color: #dd1144; }
|
182
|
+
.si { color: #dd1144; }
|
183
|
+
.sx { color: #dd1144; }
|
184
|
+
.sr { color: #009926; }
|
185
|
+
.s1 { color: #dd1144; }
|
186
|
+
.ss { color: #990073; }
|
187
|
+
.bp { color: #999999; }
|
188
|
+
.vc { color: teal; }
|
189
|
+
.vg { color: teal; }
|
190
|
+
.vi { color: teal; }
|
191
|
+
.il { color: #009999; }
|
192
|
+
.gc { color: #999; background-color: #EAF2F5; }
|
193
|
+
|
194
|
+
pre {
|
195
|
+
padding: 15px;
|
196
|
+
line-height: 17px;
|
197
|
+
}
|
198
|
+
|
@@ -0,0 +1,36 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%meta{charset: 'utf-8'}
|
5
|
+
%title= title
|
6
|
+
%link{rel: 'stylesheet', href: 'style.css'}
|
7
|
+
%body
|
8
|
+
%header
|
9
|
+
%h1= title
|
10
|
+
|
11
|
+
%article
|
12
|
+
%p~ introduction
|
13
|
+
|
14
|
+
- categories.each do |category|
|
15
|
+
%section.category
|
16
|
+
%h2= category.id
|
17
|
+
%table
|
18
|
+
- category.entries.each_with_index do |entry, index|
|
19
|
+
%tr{id: "#{category.id}-#{index}"}
|
20
|
+
- if entry.command
|
21
|
+
%td.command
|
22
|
+
- entry.command.each do |command|
|
23
|
+
%p
|
24
|
+
%code= command
|
25
|
+
%td.description
|
26
|
+
.name~ entry.name
|
27
|
+
.notes~ entry.notes
|
28
|
+
- if notes
|
29
|
+
%section.notes
|
30
|
+
%h2 Notes
|
31
|
+
~ notes
|
32
|
+
%footer
|
33
|
+
- if source_url
|
34
|
+
You can modify and improve this cheatsheet <a href="#{source_url}">here</a>.
|
35
|
+
- else
|
36
|
+
Generated with <a href='https://github.com/Kapeli/cheatset#readme'>cheatset</a>.
|
data/lib/cheatset.rb
ADDED
metadata
ADDED
@@ -0,0 +1,206 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cheatset
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bogdan Popescu
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-02-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: haml
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 4.0.3
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 4.0.3
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sqlite3
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.3.8
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.3.8
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: plist
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 3.1.0
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 3.1.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: redcarpet
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ~>
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 3.1.1
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 3.1.1
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rouge
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.3.2
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ~>
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.3.2
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: sanitize
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ~>
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 2.0.6
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ~>
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 2.0.6
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: unindent
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ~>
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '1.0'
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ~>
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '1.0'
|
153
|
+
description: Generate cheatsheets for Dash
|
154
|
+
email:
|
155
|
+
executables:
|
156
|
+
- cheatset
|
157
|
+
extensions: []
|
158
|
+
extra_rdoc_files: []
|
159
|
+
files:
|
160
|
+
- .gitignore
|
161
|
+
- Gemfile
|
162
|
+
- LICENSE.txt
|
163
|
+
- README.md
|
164
|
+
- Rakefile
|
165
|
+
- bin/cheatset
|
166
|
+
- cheatset.gemspec
|
167
|
+
- lib/cheatset.rb
|
168
|
+
- lib/cheatset/cli.rb
|
169
|
+
- lib/cheatset/creator.rb
|
170
|
+
- lib/cheatset/dsl/base.rb
|
171
|
+
- lib/cheatset/dsl/category.rb
|
172
|
+
- lib/cheatset/dsl/cheatsheet.rb
|
173
|
+
- lib/cheatset/dsl/context.rb
|
174
|
+
- lib/cheatset/dsl/entry.rb
|
175
|
+
- lib/cheatset/templates/.sass-cache/c0630dfea9543a0a71b68aca4887e98819b89684/style.scssc
|
176
|
+
- lib/cheatset/templates/res/Open_Sans.woff
|
177
|
+
- lib/cheatset/templates/style.css
|
178
|
+
- lib/cheatset/templates/style.scss
|
179
|
+
- lib/cheatset/templates/template.haml
|
180
|
+
- lib/cheatset/version.rb
|
181
|
+
homepage: https://github.com/Kapeli/cheatset
|
182
|
+
licenses:
|
183
|
+
- MIT
|
184
|
+
metadata: {}
|
185
|
+
post_install_message:
|
186
|
+
rdoc_options: []
|
187
|
+
require_paths:
|
188
|
+
- lib
|
189
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- - '>='
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '0'
|
194
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
195
|
+
requirements:
|
196
|
+
- - '>='
|
197
|
+
- !ruby/object:Gem::Version
|
198
|
+
version: '0'
|
199
|
+
requirements: []
|
200
|
+
rubyforge_project:
|
201
|
+
rubygems_version: 2.2.2
|
202
|
+
signing_key:
|
203
|
+
specification_version: 4
|
204
|
+
summary: Generate cheatsheets for Dash
|
205
|
+
test_files: []
|
206
|
+
has_rdoc:
|