marked-conductor 1.0.22 → 1.0.24

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4dd28de6ae0aaf52e49579cb6d42e7d5ae46c5e74fa9016c661f983330ba1163
4
- data.tar.gz: 4a376f1832720b796dca464b62e3ee4bc47217892658b043fd0eeaf53417cf13
3
+ metadata.gz: 69dbd324dd85fed4c343563e7431920138a99d4968b8aa8af99ba7fcd5c82087
4
+ data.tar.gz: ae2eb1f5251187fb67498139dae2d73b6fbce62778f2ef0197a01cb57561fe2c
5
5
  SHA512:
6
- metadata.gz: bdfe7d8bfd2834f5bd21ef4c2294f5b1295e26c0e065154f671bcde34ac81af5c79b2beb9405f8b71a69156a69143ead64609ee327459f41f37bfbf7fe0ad739
7
- data.tar.gz: 5aece7af60fd7a296cc21ab28ea64d8cd5fe8fd22e2dd93c6fe1b7579080aba8bc6aca61fb945c015ecb3899114a2663b4ff98c69b7eadb24c24f79987fc3568
6
+ metadata.gz: 055a623d15c8bb843b97d6f1931342cab64ec596564f812ffb1b473a85dba9547f7091149619952baacc2d5c9b17e44597f9625aa5b7f2818b72c10760b51a66
7
+ data.tar.gz: 4f998b8b19bca44f0f08ded4ad89f043802f62e4770d692b9b779c93aa8a52e6cd519fc675716f7b7c1dabaff66fbdbf4eea6611f224ac5db7cc61d7e22d704c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ### 1.0.24
2
+
3
+ 2024-07-18 11:32
4
+
5
+ #### IMPROVED
6
+
7
+ - Use Shellwords.shellsplit/join instead of escaping MARKED_INCLUDES environment variable
8
+
9
+ ### 1.0.23
10
+
11
+ 2024-07-17 15:51
12
+
13
+ #### FIXED
14
+
15
+ - Environment variable escaping was hyperactive, only escape includes array
16
+
1
17
  ### 1.0.22
2
18
 
3
19
  2024-07-16 12:30
data/lib/conductor/env.rb CHANGED
@@ -14,7 +14,7 @@ module Conductor
14
14
  home: ENV["HOME"],
15
15
  css_path: ENV["MARKED_CSS_PATH"],
16
16
  ext: ENV["MARKED_EXT"],
17
- includes: ENV["MARKED_INCLUDES"],
17
+ includes: Shellwords.shellsplit(ENV["MARKED_INCLUDES"]),
18
18
  origin: ENV["MARKED_ORIGIN"],
19
19
  filepath: ENV["MARKED_PATH"],
20
20
  filename: File.basename(ENV["MARKED_PATH"]),
@@ -56,12 +56,12 @@ module Conductor
56
56
  "MARKED_CSS_PATH" => @env[:css_path],
57
57
  "MARKED_EXT" => @env[:ext],
58
58
  "MARKED_ORIGIN" => @env[:origin],
59
- "MARKED_INCLUDES" => @env[:includes],
59
+ "MARKED_INCLUDES" => Shellwords.join(@env[:includes]),
60
60
  "MARKED_PATH" => @env[:filepath],
61
61
  "MARKED_PHASE" => @env[:phase],
62
62
  "OUTLINE" => @env[:outline],
63
63
  "PATH" => @env[:path]
64
- }.map { |k, v| %(#{k}="#{Shellwords.escape(v)}") }.join(" ")
64
+ }.map { |k, v| %(#{k}="#{v}") }.join(" ")
65
65
  end
66
66
  end
67
67
  end
@@ -2,6 +2,19 @@
2
2
 
3
3
  # String helpers
4
4
  class ::String
5
+ def find_file_in(paths, filename, ext)
6
+ return filename if File.exist?(filename)
7
+
8
+ filename = File.basename(filename, ".#{ext}")
9
+
10
+ paths.each do |path|
11
+ exp = File.join(File.expand_path('~/.config/conductor/'), path, "#{filename}.#{ext}")
12
+ return exp if File.exist?(exp)
13
+ end
14
+
15
+ "#{filename}.#{ext}"
16
+ end
17
+
5
18
  def normalize_filter
6
19
  parts = match(/(?<filter>[\w_]+)(?:\((?<paren>.*?)\))?$/i)
7
20
  filter = parts["filter"].downcase.gsub(/_/, "")
@@ -9,6 +22,11 @@ class ::String
9
22
  [filter, params]
10
23
  end
11
24
 
25
+ ##
26
+ ## Determine type of metadata (yaml, mmd, none)
27
+ ##
28
+ ## @return [Symbol] metadata type
29
+ ##
12
30
  def meta_type
13
31
  lines = split(/\n/)
14
32
  case lines[0]
@@ -124,7 +142,8 @@ class ::String
124
142
  end
125
143
 
126
144
  def insert_stylesheet(path)
127
- inject_after_meta(%(<link rel="stylesheet" href="#{ERB::Util.url_encode(path.strip)}">))
145
+ path = find_file_in(['css', 'styles'], path, 'css') unless path =~ /^http/
146
+ inject_after_meta(%(<link rel="stylesheet" href="#{path.strip}">))
128
147
  end
129
148
 
130
149
  def insert_css(path)
@@ -514,6 +533,11 @@ class Filter < String
514
533
  content = Conductor.stdin
515
534
 
516
535
  case @filter
536
+ when /(insert|add|inject)stylesheet/
537
+ @params.each do |sheet|
538
+ content = content.insert_stylesheet(sheet)
539
+ end
540
+ content
517
541
  when /(insert|add|inject)(css|style)/
518
542
  @params.each do |css|
519
543
  content = content.insert_css(css)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Conductor
4
- VERSION = '1.0.22'
4
+ VERSION = '1.0.24'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marked-conductor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.22
4
+ version: 1.0.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-16 00:00:00.000000000 Z
11
+ date: 2024-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print