codeblock 1.0 → 1.1
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 +4 -4
- data/README.md +2 -1
- data/lib/codeblock.rb +10 -10
- 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: d4fcbff474c44f532ea3422cec17d0b7b7e88533341595ee8ea53746e3f56c56
|
4
|
+
data.tar.gz: a4106d62f580d1c3ffaeb952f8e2f25674d218da68ff0868235ada7c86c64a8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 275460199c33063d412b987e00c0d802cb0c046bc6918049fd039fd7ad397c13267ba3f2dd2e803a74600c69f69d8296fe13993ad4149d1e0d8f8df771901e4d
|
7
|
+
data.tar.gz: 21bd455594236dcf0c6e0cbcdc8ecd762951cff754c554feaebc516299d19425e69c3c6d18bf7a7d13ce9ce73810ecdf1eb9f7250cc2567c114869c6bd59ba54
|
data/README.md
CHANGED
@@ -188,4 +188,5 @@ mike@idocs.com
|
|
188
188
|
|
189
189
|
| version | date | notes |
|
190
190
|
|---------|---------------|-------------------------------------------------------|
|
191
|
-
| 1.0 | June 18, 2020 | Initial upload. |
|
191
|
+
| 1.0 | June 18, 2020 | Initial upload. |
|
192
|
+
| 1.1 | June 19, 2020 | Fixed bug with skip_skips. |
|
data/lib/codeblock.rb
CHANGED
@@ -6,7 +6,7 @@ require 'attparser'
|
|
6
6
|
#
|
7
7
|
class CodeBlock
|
8
8
|
# Version
|
9
|
-
VERSION = '1.
|
9
|
+
VERSION = '1.1'
|
10
10
|
|
11
11
|
#---------------------------------------------------------------------------
|
12
12
|
# initialize
|
@@ -35,6 +35,7 @@ class CodeBlock
|
|
35
35
|
@tab = opts['tab'] || ' '
|
36
36
|
@indent = opts['indent']
|
37
37
|
@line_nums = opts['line_nums']
|
38
|
+
@skip_skips = opts['skip_skips'] ? true : false
|
38
39
|
|
39
40
|
# if 'se' param, set start and end to "start" and "end"
|
40
41
|
if opts['se']
|
@@ -45,20 +46,13 @@ class CodeBlock
|
|
45
46
|
@end = opts['end']
|
46
47
|
end
|
47
48
|
|
48
|
-
#
|
49
|
+
# default collapse to true
|
49
50
|
if opts.has_key?('collapse')
|
50
51
|
@collapse = opts['collapse']
|
51
52
|
else
|
52
53
|
@collapse = true
|
53
54
|
end
|
54
55
|
|
55
|
-
# if skip_skips is defined
|
56
|
-
if opts.has_key?('skip_skips')
|
57
|
-
@skip_skips = opts['skip_skips']
|
58
|
-
else
|
59
|
-
@skip_skips = true
|
60
|
-
end
|
61
|
-
|
62
56
|
# initialize block object
|
63
57
|
@block_ob = nil
|
64
58
|
end
|
@@ -276,7 +270,13 @@ class CodeBlock::Line
|
|
276
270
|
if @raw.match(/\#\#/mu)
|
277
271
|
raw_atts = @raw.sub(/\A.*\#\#\s*/mu, '')
|
278
272
|
raw_atts = raw_atts.rstrip
|
279
|
-
|
273
|
+
|
274
|
+
# if raw atts are a single string without =, use that as the name
|
275
|
+
if raw_atts.match(/\A\S+\z/mu) and (not raw_atts.match(/\=/mu))
|
276
|
+
@atts = {'name'=>raw_atts}
|
277
|
+
else
|
278
|
+
@atts = AttParser.parse(raw_atts, 'infer'=>true)
|
279
|
+
end
|
280
280
|
else
|
281
281
|
@atts = {}
|
282
282
|
end
|