cheatset 1.1.2 → 1.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 287b19e5092a86f311ac04482869208985284075
4
- data.tar.gz: 42bb3abd7ca555231ea61f562e07c306fe8532a0
3
+ metadata.gz: 6ff7c204890ac4b633dd4d8f6e572552ad729668
4
+ data.tar.gz: d528124246da08fec16b427f9b45be02ada11b9c
5
5
  SHA512:
6
- metadata.gz: 880142429021cdcb6ba297bd43cb326ccaa7e2a366036e14e56cd1c6b892be2d3acb018e1be8fccbbfbcc3ceed9c581401e66db32f252b29a8c7241821a52b85
7
- data.tar.gz: 10f45dbf94feaba424ea11ab49999f46afbdd2532a81e33aa0849930e408ee81c41ec21778da6b91c51b2f3feb65c5cf5fc93b35fd559ad0ac2217b05d877cfe
6
+ metadata.gz: ab416caa56ba8d044075c7d70d8ef51a44245695aa10a47a49c6a4a04394a7b49795dcf11dbcba1370c222e4c999ff10eda3a7b6e9b13bb7d91ad4930a09a4fb
7
+ data.tar.gz: abf59ef9dde9210cb76c9723cd385e496cc65efa0a74094aa03465900fbdef884b4dc8e6608a4d24f65d1983c340be31c78f2cf898487fde06f41c61c51c1d94
data/README.md CHANGED
@@ -16,7 +16,7 @@ Write a file (here `sample.cheatsheet`) containing your cheatsheet data, e.g.:
16
16
 
17
17
  ```ruby
18
18
  cheatsheet do
19
- title 'Sample Cheatsheet' # Will be displayed by Dash in the docset list
19
+ title 'Sample' # Will be displayed by Dash in the docset list
20
20
  short_name 'sample' # Used for the filename of the docset
21
21
  introduction 'My *awesome* cheatsheet' # Can contain markdown and multiple lines
22
22
 
@@ -26,7 +26,7 @@ cheatsheet do
26
26
 
27
27
  entry do
28
28
  command 'CMD-n' # Optional
29
- command 'CMD-N' # Can have more than one command
29
+ command 'CMD-N' # Multiple commands are supported
30
30
  name 'Create window' # A short name, can contain markdown
31
31
  notes 'Some notes' # Optional longer explanation, can contain markdown
32
32
  end
@@ -3,6 +3,7 @@ require 'sqlite3'
3
3
  require 'fileutils'
4
4
  require 'haml'
5
5
  require 'ostruct'
6
+ require 'uri'
6
7
 
7
8
  class Cheatset::Creator
8
9
  def initialize(cheatsheet)
@@ -67,7 +68,7 @@ class Cheatset::Creator
67
68
  CREATE UNIQUE INDEX anchor ON searchIndex (name, type, path);
68
69
  SQL
69
70
  @cheatsheet.categories.each do |category|
70
- category_strip = category.id.strip.gsub(/\//, '%2F');
71
+ category_strip = URI.escape(category.id.strip).gsub(/\//, '%252F');
71
72
  sql = 'INSERT INTO searchIndex(name, type, path) VALUES (?, ?, ?)'
72
73
  db.execute(sql, category.id, 'Category',
73
74
  "index.html\#//dash_ref/Category/#{category_strip}/1")
@@ -75,11 +76,13 @@ class Cheatset::Creator
75
76
  if entry.command
76
77
  entry.command.each do |command|
77
78
  db.execute(sql, command.strip, 'Command',
78
- "index.html\#//dash_ref_#{category_strip}/Entry/#{entry.tags_stripped_name.strip.gsub(/\//, '%2F')}/0")
79
+ "index.html\#//dash_ref_#{category_strip}/Entry/#{URI.escape(entry.tags_stripped_name.strip).gsub(/\//, '%252F')}/0")
79
80
  end
80
81
  end
81
- db.execute(sql, entry.tags_stripped_name.strip, 'Entry',
82
- "index.html\#//dash_ref_#{category_strip}/Entry/#{entry.tags_stripped_name.strip.gsub(/\//, '%2F')}/0")
82
+ if entry.name
83
+ db.execute(sql, entry.tags_stripped_name.strip, 'Entry',
84
+ "index.html\#//dash_ref_#{category_strip}/Entry/#{URI.escape(entry.tags_stripped_name.strip).gsub(/\//, '%252F')}/0")
85
+ end
83
86
  end
84
87
  end
85
88
  end
@@ -79,7 +79,8 @@ td.command {
79
79
  width: 1%;
80
80
  white-space: nowrap;
81
81
  vertical-align: top;
82
- padding: 8px 8px 0 7px; }
82
+ padding: 8px 8px 4px 7px;
83
+ text-align: right; }
83
84
  td.command code {
84
85
  padding: .1em .6em;
85
86
  box-shadow: 0 1px 0px rgba(0, 0, 0, 0.2), 0 0 0 2px white inset;
@@ -97,7 +97,8 @@ td.command {
97
97
  width: 1%;
98
98
  white-space: nowrap;
99
99
  vertical-align: top;
100
- padding: 8px 8px 0 7px;
100
+ padding: 8px 8px 4px 7px;
101
+ text-align:right;
101
102
  code {
102
103
  // Nice key styling:
103
104
  // https://developers.google.com/chrome-developer-tools/docs/shortcuts
@@ -7,7 +7,8 @@
7
7
  - categories.each do |category|
8
8
  %link{href: "//dash_ref/Category/#{category.id.strip.gsub(/\//, '%2F')}/1"}
9
9
  - category.entries.each_with_index do |entry, index|
10
- %link{href: "//dash_ref_#{category.id.strip.gsub(/\//, '%2F')}/Entry/#{entry.tags_stripped_name.strip.gsub(/\//, '%2F')}/0"}
10
+ - if entry.name
11
+ %link{href: "//dash_ref_#{category.id.strip.gsub(/\//, '%2F')}/Entry/#{entry.tags_stripped_name.strip.gsub(/\//, '%2F')}/0"}
11
12
  %body
12
13
  %header
13
14
  %h1= title
@@ -21,13 +22,13 @@
21
22
  = category.id
22
23
  %table
23
24
  - category.entries.each_with_index do |entry, index|
24
- %tr{id: "//dash_ref_#{category.id.strip.gsub(/\//, '%2F')}/Entry/#{entry.tags_stripped_name.strip.gsub(/\//, '%2F')}/0"}
25
+ %tr{id: ("//dash_ref_#{category.id.strip.gsub(/\//, '%2F')}/Entry/#{entry.tags_stripped_name.strip.gsub(/\//, '%2F')}/0" if entry.name)}
25
26
  - if entry.command
26
27
  %td.command
27
28
  - entry.command.each do |command|
28
29
  %p
29
- %code= command
30
- %td.description
30
+ %code= CGI.escapeHTML(command)
31
+ %td.description{:colspan => ("2" unless entry.command)}
31
32
  .name~ entry.name
32
33
  .notes~ entry.notes
33
34
  - if notes
@@ -36,6 +37,6 @@
36
37
  ~ notes
37
38
  %footer
38
39
  - if source_url
39
- You can modify and improve this cheatsheet <a href="#{source_url}">here</a>.
40
+ You can modify and improve this cheatsheet <a onclick="window.dash.openExternal_(this.href); return false;" href="#{source_url}">here</a>.
40
41
  - else
41
- Generated with <a href='https://github.com/Kapeli/cheatset#readme'>cheatset</a>.
42
+ Generated with <a onclick="window.dash.openExternal_(this.href); return false;" href='https://github.com/Kapeli/cheatset#readme'>cheatset</a>.
@@ -1,3 +1,3 @@
1
1
  module Cheatset
2
- VERSION = '1.1.2'
2
+ VERSION = '1.1.3'
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.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bogdan Popescu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-19 00:00:00.000000000 Z
11
+ date: 2014-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler