marked-conductor 1.0.21 → 1.0.23

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: 5e859f85b430fafdb74633e795caefd6cfc14ce26585970026d77c20ddce06c2
4
- data.tar.gz: 292fbc78bdeaeb3480092872afa558c25fa156c1cb80784eee98c87dca55f253
3
+ metadata.gz: 0bd701f59c197143e9a8744da69209db39e2b2f124cd239cd0c21bd11f791b81
4
+ data.tar.gz: e18d60353643a68a1b93f1f73c7f7f7e2bf26884593e2b7b2895f0b775a8c102
5
5
  SHA512:
6
- metadata.gz: 5ea468effe4d2be8b534d7bc9ea27dbb09a57f756393d7aebe4a33cda998326fb0eaa8b31194bc8c17e21487d3dd28aeaf3cedf21b707e61bda65a2253a609b8
7
- data.tar.gz: 893e362f929e2a26a4815bc3782d758d6f4d25270ca2137867c56de846b5755adbb4dc1bf3983b996b88a61e904731220d2c76123f523825d88be39dc5bb4ebd
6
+ metadata.gz: 86811c1cee6bc68847e79231af591abe4f94aa45fea9eb8e9ac9c3f288dd92e26db64068b405a647523829fa1109d4fa8fea699cfa73a0e3d527a924ae1db074
7
+ data.tar.gz: ca22bf9fa7db8390b7a0b0851d1d71e58c8cb45e4454d21d49b9cac455343f09ca67068e343acb2373df7250284c69b791d9d4510bbee58fccd6bf490294565b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ ### 1.0.23
2
+
3
+ 2024-07-17 15:51
4
+
5
+ #### FIXED
6
+
7
+ - Environment variable escaping was hyperactive, only escape includes array
8
+
9
+ ### 1.0.22
10
+
11
+ 2024-07-16 12:30
12
+
13
+ #### IMPROVED
14
+
15
+ - When injecting CSS or JS paths, URL encode the path
16
+
17
+ #### FIXED
18
+
19
+ - Shell escape environment variables
20
+
1
21
  ### 1.0.21
2
22
 
3
23
  2024-07-10 12:18
data/README.md CHANGED
@@ -177,9 +177,9 @@ If the path for `insertScript` or `insertCSS` is a URL instead of a filename, th
177
177
 
178
178
  For all of the prepend/append file filters, you can store files in `~/.config/conductor/files` and reference them with just a filename. Otherwise a full path will be assumed.
179
179
 
180
- For `autoLink`, any URL that's not contained in parenthesis or following a `[]: url` pattern will be autolinked (surrounded by angle brackets). URLs must contain `//` to be recognized, but any protocol will work, e.g. `x-marked://refresh`. Must be run on Markdown, not HTML.
180
+ For `autoLink`, any URL that's not contained in parenthesis or following a `[]: url` pattern will be autolinked (surrounded by angle brackets). URLs must contain `//` to be recognized, but any protocol will work, e.g. `x-marked://refresh`. Must be run on Markdown (prior to any postprocessor HTML conversion).
181
181
 
182
- For `fixHeaders`, it will be ensured that the document has an h1, and all header levels will be adapted to never jump more than one header level when increasing. If no H1 exists in the document, the first header of the lowest existing level will be turned into an H1 and all other headers will be decremented to fit the hierarchy. It's not perfect, but it does a pretty good job. When saving the document as Markdown from Marked, the new headers will be applied.
182
+ For `fixHeaders`, it will be ensured that the document has an h1, and all header levels will be adapted to never jump more than one header level when increasing. If no H1 exists in the document, the first header of the lowest existing level will be turned into an H1 and all other headers will be decremented to fit the hierarchy. It's not perfect, but it does a pretty good job. When saving the document as Markdown from Marked, the new headers will be applied. Must be run on Markdown (prior to any postprocessor HTML conversion).
183
183
 
184
184
  **Note:** successive filters in a sequence that insert or prepend will always insert content before/above the result of the previous insert filter. So if you have an `insertTitle` filter followed by an `insertCSS` filter, the CSS will appear above the inserted title. If you want elements inserted in reverse order, reverse the order of the inserts in the sequence.
185
185
 
data/buildnotes.md ADDED
@@ -0,0 +1,41 @@
1
+ template: git, gem, project
2
+ project: conductor
3
+ readme: src/_README.md
4
+
5
+ # marked-conductor
6
+
7
+ Train conductor for Marked
8
+
9
+ ## File Structure
10
+
11
+ Standard gem structure.
12
+
13
+ ## Deploy
14
+
15
+ You no longer need to manually bump the version, it will be incremented when this task runs.
16
+
17
+ ```run Update Changelog
18
+ #!/bin/bash
19
+
20
+ changelog -u
21
+ ```
22
+
23
+ @include(project:Update GitHub README)
24
+
25
+ ```run Commit with changelog
26
+ #!/bin/bash
27
+
28
+ changelog | git commit -a -F -
29
+ git pull
30
+ git push
31
+ ```
32
+
33
+ @include(gem:Release Gem) Release Gem
34
+ @include(project:Update Blog Project) Update Blog Project
35
+ @run(rake bump[patch]) Bump Version
36
+
37
+ @run(git commit -am 'Version bump')
38
+
39
+ @after
40
+ Don't forget to publish the website!
41
+ @end
data/lib/conductor/env.rb CHANGED
@@ -56,7 +56,7 @@ 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.escape(@env[:includes]),
60
60
  "MARKED_PATH" => @env[:filepath],
61
61
  "MARKED_PHASE" => @env[:phase],
62
62
  "OUTLINE" => @env[:outline],
@@ -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,6 +142,7 @@ class ::String
124
142
  end
125
143
 
126
144
  def insert_stylesheet(path)
145
+ path = find_file_in(['css', 'styles'], path, 'css') unless path =~ /^http/
127
146
  inject_after_meta(%(<link rel="stylesheet" href="#{path.strip}">))
128
147
  end
129
148
 
@@ -200,7 +219,7 @@ class ::String
200
219
  end
201
220
 
202
221
  def insert_javascript(path)
203
- %(#{self}\n<script type="javascript" src="#{path.strip}"></script>\n)
222
+ %(#{self}\n<script type="javascript" src="#{ERB::Util.url_encode(path.strip)}"></script>\n)
204
223
  end
205
224
 
206
225
  def insert_raw_javascript(content)
@@ -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.21'
4
+ VERSION = '1.0.23'
5
5
  end
data/lib/conductor.rb CHANGED
@@ -7,6 +7,7 @@ require "fcntl"
7
7
  require "time"
8
8
  require "chronic"
9
9
  require "fileutils"
10
+ require "erb"
10
11
  require_relative "conductor/version"
11
12
  require_relative "conductor/env"
12
13
  require_relative "conductor/config"
data/src/_README.md CHANGED
@@ -177,9 +177,9 @@ If the path for `insertScript` or `insertCSS` is a URL instead of a filename, th
177
177
 
178
178
  For all of the prepend/append file filters, you can store files in `~/.config/conductor/files` and reference them with just a filename. Otherwise a full path will be assumed.
179
179
 
180
- For `autoLink`, any URL that's not contained in parenthesis or following a `[]: url` pattern will be autolinked (surrounded by angle brackets). URLs must contain `//` to be recognized, but any protocol will work, e.g. `x-marked://refresh`. Must be run on Markdown, not HTML.
180
+ For `autoLink`, any URL that's not contained in parenthesis or following a `[]: url` pattern will be autolinked (surrounded by angle brackets). URLs must contain `//` to be recognized, but any protocol will work, e.g. `x-marked://refresh`. Must be run on Markdown (prior to any postprocessor HTML conversion).
181
181
 
182
- For `fixHeaders`, it will be ensured that the document has an h1, and all header levels will be adapted to never jump more than one header level when increasing. If no H1 exists in the document, the first header of the lowest existing level will be turned into an H1 and all other headers will be decremented to fit the hierarchy. It's not perfect, but it does a pretty good job. When saving the document as Markdown from Marked, the new headers will be applied.
182
+ For `fixHeaders`, it will be ensured that the document has an h1, and all header levels will be adapted to never jump more than one header level when increasing. If no H1 exists in the document, the first header of the lowest existing level will be turned into an H1 and all other headers will be decremented to fit the hierarchy. It's not perfect, but it does a pretty good job. When saving the document as Markdown from Marked, the new headers will be applied. Must be run on Markdown (prior to any postprocessor HTML conversion).
183
183
 
184
184
  **Note:** successive filters in a sequence that insert or prepend will always insert content before/above the result of the previous insert filter. So if you have an `insertTitle` filter followed by an `insertCSS` filter, the CSS will appear above the inserted title. If you want elements inserted in reverse order, reverse the order of the inserts in the sequence.
185
185
 
data/test.sh CHANGED
@@ -49,7 +49,7 @@ if [[ -z $1 ]]; then
49
49
  exit 1
50
50
  fi
51
51
 
52
- FILE=$(realpath $1)
52
+ FILE=$(realpath "$1")
53
53
  FILENAME=$(basename -- "$FILE")
54
54
  EXTENSION="${FILENAME##*.}"
55
55
  PHASE=$(echo $PHASE | tr [a-z] [A-Z])
@@ -67,7 +67,7 @@ export MARKED_EXT="$EXTENSION"
67
67
  export MARKED_CSS_PATH="/Applications/Marked 2.app/Contents/Resources/swiss.css"
68
68
  export PATH="$PATH:$(dirname "$FILE")"
69
69
  export MARKED_PATH="$FILE"
70
- export MARKED_INCLUDES=""
70
+ export MARKED_INCLUDES="/Applications/Marked 2.app/Contents/Resources/tocstyle.css"
71
71
  export MARKED_PHASE="$PHASE"
72
72
 
73
73
  if [[ $STD =~ ^(STD)?E ]]; then
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.21
4
+ version: 1.0.23
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-10 00:00:00.000000000 Z
11
+ date: 2024-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print
@@ -204,6 +204,7 @@ files:
204
204
  - README.rdoc
205
205
  - Rakefile
206
206
  - bin/conductor
207
+ - buildnotes.md
207
208
  - images/preferences.jpg
208
209
  - lib/conductor.rb
209
210
  - lib/conductor/array.rb
@@ -243,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
243
244
  - !ruby/object:Gem::Version
244
245
  version: '0'
245
246
  requirements: []
246
- rubygems_version: 3.2.16
247
+ rubygems_version: 3.2.15
247
248
  signing_key:
248
249
  specification_version: 4
249
250
  summary: A custom processor manager for Marked 2 (Mac)