marked-conductor 1.0.8 → 1.0.9

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
  SHA256:
3
- metadata.gz: fc01f58de2ca4d81c45420e08128c3ae0dd3f125badce5d62a8cc568c599d202
4
- data.tar.gz: ad0724664a346aea50e4467d7a492737d885b6b2916f04077a73866b3ba0e915
3
+ metadata.gz: 3a9a26a3ab2e4ec5e86b55290f01f7af7d00ef589e74192550c36c37c2faa256
4
+ data.tar.gz: 0d2bd24779518b49d29c40e1b0f8936c15f040219abccca6341d80a89618e99b
5
5
  SHA512:
6
- metadata.gz: b812adad30a746bc2b38f302047a595796d8ec2886b503a198b1384dd570d0b61d41de1029788c95b3f6a579c98c4571bef01c00c8f866aeb6245028676ab104
7
- data.tar.gz: 11f506aa92cdc7ea0c5f219b84d694615c32da729ba57dfafa0f4eb9aa258d33c69c36383d858b0d0764c03362eb7e6db0b3fe4862b441db3d326e5c5f678f36
6
+ metadata.gz: dec71a5077f59b7c4129dafa5fd74bf0dc093117b37b3cd6bd48e3f32693ed7a2f193e7f5f05334f9bb4e1f941337996ec73059143fe67041bdcb06c4148e01a
7
+ data.tar.gz: b2b2772e94096709bf4cb212f800789a37425edcb508e766ba21571521bcfd987a224d14ce8cf134c3afa43c49932bba81ea8e354f0f905ec5d0bf420adf87f5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ### 1.0.9
2
+
3
+ 2024-04-27 16:00
4
+
5
+ #### NEW
6
+
7
+ - Test for pandoc metadata (%%) with `is pandoc` or `is not pandoc`
8
+
9
+ #### FIXED
10
+
11
+ - Filename comparison not working
12
+
1
13
  ### 1.0.8
2
14
 
3
15
  2024-04-27 14:01
@@ -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)?)(:\S+)?/i)
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] =~ /^m/i ? "mmd" : "yaml"
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)?|\*=)/i
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(filepath),
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/marked-conductor/",
33
- filepath: "/Users/ttscoff/Desktop/Code/marked-conductor/README.md",
34
- filename: "README.md",
35
- phase: "PREPROCESS",
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/Dropbox/Writing/brettterpstra.com/_drafts/"
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Conductor
4
- VERSION = "1.0.8"
4
+ VERSION = '1.0.9'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marked-conductor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra