marked-conductor 1.0.8 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/conductor/condition.rb +18 -3
- data/lib/conductor/env.rb +6 -6
- data/lib/conductor/version.rb +1 -1
- 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: 3a9a26a3ab2e4ec5e86b55290f01f7af7d00ef589e74192550c36c37c2faa256
|
4
|
+
data.tar.gz: 0d2bd24779518b49d29c40e1b0f8936c15f040219abccca6341d80a89618e99b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dec71a5077f59b7c4129dafa5fd74bf0dc093117b37b3cd6bd48e3f32693ed7a2f193e7f5f05334f9bb4e1f941337996ec73059143fe67041bdcb06c4148e01a
|
7
|
+
data.tar.gz: b2b2772e94096709bf4cb212f800789a37425edcb508e766ba21571521bcfd987a224d14ce8cf134c3afa43c49932bba81ea8e354f0f905ec5d0bf420adf87f5
|
data/CHANGELOG.md
CHANGED
data/lib/conductor/condition.rb
CHANGED
@@ -86,12 +86,20 @@ module Conductor
|
|
86
86
|
## @return [Array] Value, value to compare, operator
|
87
87
|
##
|
88
88
|
def split_condition(condition)
|
89
|
-
if condition.match(/(?:((?:does )?not)?(?:ha(?:s|ve)|contains?|includes?) +)?(yaml|headers|frontmatter|mmd|meta(?:data)
|
89
|
+
if condition.match(/(?:((?:does )?not)?(?:ha(?:s|ve)|contains?|includes?) +)?(yaml|headers|frontmatter|mmd|meta(?:data)?|pandoc)(:\S+)?/i)
|
90
90
|
m = Regexp.last_match
|
91
91
|
op = m[1].nil? ? :contains : :not_contains
|
92
|
-
type = m[2]
|
92
|
+
type = case m[2]
|
93
|
+
when /^m/i
|
94
|
+
"mmd"
|
95
|
+
when /^p/i
|
96
|
+
"pandoc"
|
97
|
+
else
|
98
|
+
"yaml"
|
99
|
+
end
|
93
100
|
return ["#{type}#{m[3]}", nil, op]
|
94
101
|
end
|
102
|
+
|
95
103
|
res = condition.match(/^(?<val1>.*?)(?:(?: +(?<op>(?:is|does)(?: not)?(?: an?|type(?: of)?|equals?(?: to))?|!?==?|[gl]t|(?:greater|less)(?: than)?|<|>|(?:starts|ends) with|(?:ha(?:s|ve) )?(?:prefix|suffix)|has|contains?|includes?) +)(?<val2>.*?))?$/i)
|
96
104
|
[res["val1"], res["val2"], operator_to_symbol(res["op"])]
|
97
105
|
end
|
@@ -312,6 +320,11 @@ module Conductor
|
|
312
320
|
end
|
313
321
|
end
|
314
322
|
|
323
|
+
def test_pandoc(content, operator)
|
324
|
+
res = content.match(/^%% /)
|
325
|
+
%i[not_contains not_equal].include?(operator) ? !res.nil? : res.nil?
|
326
|
+
end
|
327
|
+
|
315
328
|
def test_condition(condition)
|
316
329
|
type, value, operator = split_condition(condition)
|
317
330
|
|
@@ -343,6 +356,8 @@ module Conductor
|
|
343
356
|
when /^(?:mmd|meta(?:data)?)(?::(.*?))?$/i
|
344
357
|
key = Regexp.last_match(1) || nil
|
345
358
|
Conductor.stdin.meta? ? test_meta(Conductor.stdin, value, key, operator) : false
|
359
|
+
when /^pandoc/
|
360
|
+
test_pandoc(Conductor.stdin, operator)
|
346
361
|
else
|
347
362
|
false
|
348
363
|
end
|
@@ -356,7 +371,7 @@ module Conductor
|
|
356
371
|
:gt
|
357
372
|
when /(lt|less( than)?|<|(?:is )?before)/i
|
358
373
|
:lt
|
359
|
-
when /not (ha(?:s|ve)|contains|includes|match(es)
|
374
|
+
when /not (ha(?:s|ve)|contains|includes|match(es)?)/i
|
360
375
|
:not_contains
|
361
376
|
when /(ha(?:s|ve)|contains|includes|match(es)?|\*=)/i
|
362
377
|
:contains
|
data/lib/conductor/env.rb
CHANGED
@@ -13,7 +13,7 @@ module Conductor
|
|
13
13
|
includes: ENV["MARKED_INCLUDES"],
|
14
14
|
origin: ENV["MARKED_ORIGIN"],
|
15
15
|
filepath: ENV["MARKED_PATH"],
|
16
|
-
filename: File.basename(
|
16
|
+
filename: File.basename(ENV["MARKED_PATH"]),
|
17
17
|
phase: ENV["MARKED_PHASE"],
|
18
18
|
outline: ENV["OUTLINE"],
|
19
19
|
path: ENV["PATH"]
|
@@ -29,12 +29,12 @@ module Conductor
|
|
29
29
|
css_path: "/Applications/Marked 2.app/Contents/Resources/swiss.css",
|
30
30
|
ext: "md",
|
31
31
|
includes: [],
|
32
|
-
origin: "/Users/ttscoff/Desktop/Code/
|
33
|
-
filepath: "/Users/ttscoff/Desktop/Code/
|
34
|
-
filename: "
|
35
|
-
phase: "
|
32
|
+
origin: "/Users/ttscoff/Desktop/Code/nvultra-docs/content/",
|
33
|
+
filepath: "/Users/ttscoff/Desktop/Code/nvultra-docs/content/advanced-features.md",
|
34
|
+
filename: "advanced-features.md",
|
35
|
+
phase: "PROCESS",
|
36
36
|
outline: "NONE",
|
37
|
-
path: "/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/ttscoff/
|
37
|
+
path: "/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/ttscoff/Desktop/Code/nvultra-docs/content/"
|
38
38
|
}
|
39
39
|
end
|
40
40
|
|
data/lib/conductor/version.rb
CHANGED