cheatset 1.4.1 → 1.4.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d6e82e43c4402b68c129a13be55550581f4633e6a41e2abc969c84437e6936ed
4
- data.tar.gz: 9f073f4fce052749b72935977bac5f6f91f36734466a5fc9908b808132fcc587
3
+ metadata.gz: 8a7cff5cf1487c0fef78f6013283e7b167cc1a64ec9938defbc317a21adf059f
4
+ data.tar.gz: 0bb0916201eb1d27677fb9cb8f5146a1887a54cebd9e9d88b70a8faf69e1bbb5
5
5
  SHA512:
6
- metadata.gz: 54c3999aae21439650008792948b94a975ca002ff743703e6a8f15fa36ed42f874ba6332e319a1bcbc118de99f90f5ad0659ed2520f28a100eda3c4cdbf25d4a
7
- data.tar.gz: 79ca59e3666d0c1d6ae22bdfdca10ab556c94a92120f3b4846fa20bb2cc15051af77f563123e7635054278247d3f42e9f0e9ace0e4e81693072d09c3205dfccc
6
+ metadata.gz: 26a07fdcd1ba96f17d9c25e46208321ef5239bb709d5c54ecbe271634e14113e40f84f8e3f47c354c8c9469f94bf2fba1bc9f2fd888d0b9c9e142e6932c14259
7
+ data.tar.gz: 24a70af2864c96f6bf7c02cfc6af0eac0681425c921cd7898077e145df376a28ec65365e959f12ab52f1e2366a625bed59f8c6dc3e5be0a073e21490301fb600
data/README.md CHANGED
@@ -13,7 +13,7 @@ language (Ruby DSL).
13
13
  Note: this requires the Xcode Command Line Tools to be installed. Install them using this:
14
14
 
15
15
  $ xcode-select --install
16
-
16
+
17
17
  ## Contributions
18
18
 
19
19
  If you make a useful cheat sheet, please [contribute it](https://github.com/Kapeli/cheatsheets#readme) to Dash.
@@ -28,7 +28,7 @@ cheatsheet do
28
28
  docset_file_name 'Sample' # Used for the filename of the docset
29
29
  keyword 'sample' # Used as the initial search keyword (listed in Preferences > Docsets)
30
30
  # resources 'resources_dir' # An optional resources folder which can contain images or anything else
31
-
31
+
32
32
  introduction 'My *awesome* cheat sheet' # Optional, can contain Markdown or HTML
33
33
 
34
34
  # A cheat sheet must consist of categories
@@ -78,6 +78,15 @@ Syntax highlighting is supported (see Ruby code in the sample). For a list of su
78
78
  For more complete examples look at some of
79
79
  [the actual cheat sheets](https://github.com/Kapeli/cheatsheets/tree/master/cheatsheets).
80
80
 
81
+ If you do not use Ruby or lack a working Ruby toolchain and still want to generate cheatsheets.
82
+
83
+ You can use the `cheatset` Docker image.
84
+
85
+ $ docker pull jonasbn/cheatset:lastest
86
+ $ docker run --rm -it --volume $PWD:/tmp --name cheatset jonasbn/cheatset:latest generate samble.rb
87
+
88
+ For more details on the Docker image please visit the repositories on [DockerHub](https://hub.docker.com/repository/docker/jonasbn/cheatset) or [GitHub](https://github.com/jonasbn/docker-cheatset)
89
+
81
90
  ## Advanced Usage
82
91
 
83
92
  Apart from the attributes listed in the sample cheat sheet above, you can also use these:
@@ -85,7 +94,8 @@ Apart from the attributes listed in the sample cheat sheet above, you can also u
85
94
  * `style` (under `cheatsheet`) - define any CSS style you want. See example [here](https://github.com/Kapeli/cheatsheets/blob/f9e40e30b6fde9063b7a0fb5de8fb203851b17df/cheatsheets/CSS_Named_Colors.rb#L7-L12)
86
95
  * `html_class` (under `category`) - define a HTML class to be added to a category. This can be used to define custom styling for each category
87
96
  * `td_command` (under `entry`) - just like `command`, but multiple ones are added in a separate column (as opposed to a separate row)
88
- * `td_notes` (under `entry`) - just like `notes`, but multiple ones are added in a separate column (as opposed to a separate row)
97
+ * `td_notes` (under `entry`) - just like `notes` but can be repeated multiple times, each becoming a separate column
98
+ * `html_notes` (under `entry`) - just like `notes`, but doesn't support Markdown
89
99
  * `index_name` (under `entry`) - this is not displayed in the cheat sheet at all. You can use it to define a separate index name (i.e what gets added to Dash's search index and is searchable in Dash). In other words, if this entry is not present, the value in `name` is used.
90
100
 
91
101
  ## Thanks
data/bin/cheatset ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH << File.expand_path('../../lib', __FILE__)
4
+ require 'cheatset'
5
+ require 'cheatset/cli'
6
+ Cheatset::CLI.start
@@ -3,7 +3,7 @@ require 'sqlite3'
3
3
  require 'fileutils'
4
4
  require 'haml'
5
5
  require 'ostruct'
6
- require 'uri'
6
+ require 'cgi'
7
7
  require 'pathname'
8
8
 
9
9
  class Cheatset::Creator
@@ -84,9 +84,9 @@ class Cheatset::Creator
84
84
  sql = 'INSERT INTO searchIndex(name, type, path) VALUES (?, ?, ?)'
85
85
  db.execute(sql, @cheatsheet.title, 'Category',
86
86
  "index.html")
87
-
87
+
88
88
  @cheatsheet.categories.each do |category|
89
- category_strip = URI.escape(category.id.strip).gsub(/\//, '%252F');
89
+ category_strip = CGI.escape(category.id.strip).gsub(/\//, '%252F');
90
90
  if @cheatsheet.title != category.id
91
91
  db.execute(sql, category.id, 'Category',
92
92
  "index.html\#//dash_ref/Category/#{category_strip}/1")
@@ -96,7 +96,7 @@ class Cheatset::Creator
96
96
  if entry.command && entry.command.length > 0
97
97
  first_command = entry.command.first
98
98
  end
99
- href = (entry.name || entry.index_name) ? "index.html\#//dash_ref_#{category_strip}/Entry/#{URI.escape((entry.index_name) ? entry.index_name.strip : entry.tags_stripped_name.strip).gsub(/\//, '%252F')}/0" : (first_command) ? "index.html\#//dash_ref_#{category_strip}/Command/#{URI.escape(first_command).gsub(/\//, '%252F')}/0" : ""
99
+ href = (entry.name || entry.index_name) ? "index.html\#//dash_ref_#{category_strip}/Entry/#{CGI.escape((entry.index_name) ? entry.index_name.strip : entry.tags_stripped_name.strip).gsub(/\//, '%252F')}/0" : (first_command) ? "index.html\#//dash_ref_#{category_strip}/Command/#{URI.escape(first_command).gsub(/\//, '%252F')}/0" : ""
100
100
  if entry.command
101
101
  entry.command.each do |command|
102
102
  if(!command.strip.empty? && !entry.not_in_main_index)
@@ -124,4 +124,4 @@ class Cheatset::Creator
124
124
  end
125
125
  end
126
126
  end
127
- end
127
+ end
@@ -2,7 +2,7 @@ module Cheatset
2
2
  module DSL
3
3
  class Entry < Base
4
4
  define_list_attrs :command, :td_command, :extra_index_name
5
- define_attrs :index_name, :not_in_main_index
5
+ define_attrs :index_name, :not_in_main_index, :html_notes
6
6
  define_markdown_attrs :name, :notes
7
7
  define_markdown_list_attrs :td_notes
8
8
  end
@@ -92,6 +92,13 @@ section.notes {
92
92
  article {
93
93
  margin: 2em 1em; }
94
94
 
95
+ @media print {
96
+ section.category {
97
+ page-break-inside: avoid;
98
+ break-inside: avoid;
99
+ }
100
+ }
101
+
95
102
  section.category {
96
103
  border: 2px solid #666;
97
104
  border-radius: 6px 6px;
@@ -69,7 +69,7 @@ code, pre {
69
69
  font-size:13px;
70
70
  }
71
71
 
72
- code {
72
+ code {
73
73
  margin:0;
74
74
  border:1px solid #ddd;
75
75
  background-color:#f8f8f8;
@@ -119,6 +119,14 @@ section.notes {
119
119
  article {
120
120
  margin: 2em 1em;
121
121
  }
122
+
123
+ @media print {
124
+ section.category {
125
+ page-break-inside: avoid;
126
+ break-inside: avoid;
127
+ }
128
+ }
129
+
122
130
  section.category {
123
131
  border: 2px solid $dark_gray;
124
132
  border-radius: 6px 6px;
@@ -145,7 +153,7 @@ td {
145
153
  }
146
154
  th {
147
155
  border-left:1px solid $lighter_gray;
148
- }
156
+ }
149
157
  tr {
150
158
  border-bottom:1px dotted $lighter_gray;
151
159
  }
@@ -53,10 +53,11 @@
53
53
  %td.td_command
54
54
  - if !command.empty?
55
55
  %code= CGI.escapeHTML(command)
56
- - if entry.name || entry.notes
56
+ - if entry.name || entry.notes || entry.html_notes
57
57
  %td.description{:colspan => ("2" unless entry.command || entry.td_command || entry.td_notes)}
58
58
  .name~ entry.name
59
59
  .notes~ entry.notes
60
+ .notes~ entry.html_notes
60
61
  - if entry.td_notes
61
62
  - entry.td_notes.each do |notes|
62
63
  %td.td_notes
@@ -1,3 +1,3 @@
1
1
  module Cheatset
2
- VERSION = '1.4.1'
2
+ VERSION = '1.4.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cheatset
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bogdan Popescu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-29 00:00:00.000000000 Z
11
+ date: 2022-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -152,7 +152,8 @@ dependencies:
152
152
  version: '0'
153
153
  description: Generate cheat sheets for Dash
154
154
  email:
155
- executables: []
155
+ executables:
156
+ - cheatset
156
157
  extensions: []
157
158
  extra_rdoc_files: []
158
159
  files:
@@ -161,6 +162,7 @@ files:
161
162
  - LICENSE.txt
162
163
  - README.md
163
164
  - Rakefile
165
+ - bin/cheatset
164
166
  - cheatset.gemspec
165
167
  - lib/cheatset.rb
166
168
  - lib/cheatset/cli.rb
@@ -202,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
204
  - !ruby/object:Gem::Version
203
205
  version: '0'
204
206
  requirements: []
205
- rubygems_version: 3.0.1
207
+ rubygems_version: 3.0.3.1
206
208
  signing_key:
207
209
  specification_version: 4
208
210
  summary: Generate cheat sheets for Dash