snibbets 2.0.17 → 2.0.19
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 +17 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/snibbets/lexers.rb +2 -2
- data/lib/snibbets/string.rb +2 -3
- 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: c0317bfeaf37247a0bcb128127a4b5f93022826c4a926684561585ff03b806b2
|
4
|
+
data.tar.gz: 76bf63ed29f6948539bc5ebface580fdbc2d4934e5a3e287746fe4f556e3cb7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 250da1aaebe3ccf91dddf3c6d296c3d2864d77d9959b7cccd065cab58e2deeb27b05ed1bc018d6b42a01c9456f621b2f759368b2d7ec814aa4f7bc989255b8bc
|
7
|
+
data.tar.gz: ea0c220d5415ca2c0717e5602cda7602db28740c889013cfa2d00f70441ed98153d769bab74deced677da0b30b322951237d85dab5b65eac2b93bffd4d5d6afa
|
data/CHANGELOG.md.orig
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
### 2.0.19
|
2
|
+
|
3
|
+
2023-04-16 08:05
|
4
|
+
|
5
|
+
#### FIXED
|
6
|
+
|
7
|
+
- A fenced code block following a line containing only 4+ spaces or tabs would get parsed as an indented code block
|
8
|
+
- Last fenced code block in a snippet might not be recognized
|
9
|
+
|
10
|
+
### 2.0.18
|
11
|
+
|
12
|
+
2023-04-16 06:57
|
13
|
+
|
14
|
+
#### FIXED
|
15
|
+
|
16
|
+
- If an invalid language (without a lexer) is supplied when using `--paste`, just use the input as the extension and tag
|
17
|
+
|
1
18
|
### 2.0.17
|
2
19
|
|
3
20
|
2023-04-16 06:31
|
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.19
|
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/string.rb
CHANGED
@@ -117,7 +117,7 @@ module Snibbets
|
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
120
|
-
sans_blocks = sans_blocks.gsub(
|
120
|
+
sans_blocks = sans_blocks.gsub(/(?mi)^(`{3,})( *\w+)? *\n([\s\S]*?)\n\1 *(\n|\Z)/) do
|
121
121
|
counter += 1
|
122
122
|
lang = Regexp.last_match(2)
|
123
123
|
lang = "<lang:#{lang.strip}>\n" if lang
|
@@ -125,12 +125,11 @@ module Snibbets
|
|
125
125
|
"<block#{counter}>\n"
|
126
126
|
end
|
127
127
|
|
128
|
-
sans_blocks = sans_blocks.gsub(/(?mi)^((
|
128
|
+
sans_blocks = sans_blocks.gsub(/(?mi)^((?: {4,}|\t+)\S[\S\s]*?)(?=\n\S|\Z)/) do
|
129
129
|
counter += 1
|
130
130
|
code = Regexp.last_match(1).split(/\n/)
|
131
131
|
|
132
132
|
code_blocks["block#{counter}"] = code.join("\n").outdent
|
133
|
-
|
134
133
|
"<block#{counter}>\n"
|
135
134
|
end
|
136
135
|
|
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
|
|