snibbets 2.0.17 → 2.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md.orig +8 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/snibbets/lexers.rb +2 -2
- data/lib/snibbets/version.rb +1 -1
- data/lib/snibbets.rb +4 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fb3029d9d0ba7c3ced5f5f0701edc62571565812b54f4d10dec34e87c10713e
|
4
|
+
data.tar.gz: 43f09bfbb8d822a5bcf5a49dca54aafe604926a9aba0f84af2d9a65b34842082
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5b60a62cd24bdf2e6981db74eae3e4ca59b0e161c63cbb89c6c7fcfade6f7369ed425fcaaa059bb945d774cca02a4b12553c37dcf86e6450103306265b95970
|
7
|
+
data.tar.gz: a146b815c9c69965c6120750edd5cf0985f8cf9ca52eedaef1368b2d0ca842dfc33fc1bb4fd2b16700efca80db5a0b637dda132264e147783e53ff925995b02f
|
data/CHANGELOG.md.orig
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -155,7 +155,7 @@ Snibbet's implementation of Skylighting has limited but better-looking themes, a
|
|
155
155
|
### Usage
|
156
156
|
|
157
157
|
```
|
158
|
-
Snibbets v2.0.
|
158
|
+
Snibbets v2.0.18
|
159
159
|
|
160
160
|
Usage: snibbets [options] query
|
161
161
|
-a, --all If a file contains multiple snippets, output all of them (no menu)
|
data/lib/snibbets/lexers.rb
CHANGED
@@ -29,12 +29,12 @@ module Snibbets
|
|
29
29
|
|
30
30
|
def ext_to_lang(ext)
|
31
31
|
matches = lexers.select { |lex| lex[:extensions].map(&:downcase).include?(ext.downcase) }
|
32
|
-
matches.map { |lex| lex[:lexer] }.first
|
32
|
+
matches.map { |lex| lex[:lexer] }.first || ext
|
33
33
|
end
|
34
34
|
|
35
35
|
def lang_to_ext(lexer)
|
36
36
|
matches = lexers.select { |lex| lex[:lexer] == lexer || lex[:aliases].map(&:downcase).include?(lexer.downcase) }
|
37
|
-
matches.map { |lex| lex[:extensions].first }.first
|
37
|
+
matches.map { |lex| lex[:extensions].first }.first || lexer
|
38
38
|
end
|
39
39
|
|
40
40
|
def syntax_from_extension(filename)
|
data/lib/snibbets/version.rb
CHANGED
data/lib/snibbets.rb
CHANGED
@@ -157,8 +157,10 @@ module Snibbets
|
|
157
157
|
printf 'What language(s) does it use (separate with spaces, full names or file extensions will work)? '
|
158
158
|
input = $stdin.gets.chomp
|
159
159
|
langs = input.split(/ +/).map(&:strip) unless input.empty?
|
160
|
-
exts = langs.map { |lang| Lexers.lang_to_ext(lang) }
|
161
|
-
tags = langs.map { |lang| Lexers.ext_to_lang(lang) }.concat(langs).sort.uniq
|
160
|
+
exts = langs.map { |lang| Lexers.lang_to_ext(lang) }.delete_if(&:nil?)
|
161
|
+
tags = langs.map { |lang| Lexers.ext_to_lang(lang) }.concat(langs).delete_if(&:nil?).sort.uniq
|
162
|
+
|
163
|
+
exts = langs if exts.empty?
|
162
164
|
|
163
165
|
filename = "#{title}.#{exts.join('.')}.#{Snibbets.options[:extension]}"
|
164
166
|
|