marked-conductor 1.0.12 → 1.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/README.md +41 -7
- data/bin/conductor +8 -0
- data/html/Conductor.html +10 -2
- data/html/Filter.html +243 -0
- data/html/Object.html +1 -1
- data/html/String.html +671 -12
- data/html/created.rid +6 -5
- data/html/index.html +1 -0
- data/html/js/search_index.js +1 -1
- data/html/js/search_index.js.gz +0 -0
- data/html/table_of_contents.html +132 -9
- data/lib/conductor/filter.rb +272 -0
- data/lib/conductor/string.rb +9 -0
- data/lib/conductor/version.rb +1 -1
- data/lib/conductor.rb +1 -0
- data/src/_README.md +41 -7
- data/test.sh +83 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69c655b0c85492536b091259aeb5000c04c5830cc1296cb241ceeb507210bd7d
|
4
|
+
data.tar.gz: 42ed08e2e792dc85945e4c3dbcb0facfbbad2eb1f51553d5999843d042a00703
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 003ec761e335649d21c3bdc209cca365ce6de2152678f896bf623e422f9e161f4d7466231b8915949cdff535874465de4b3ba773f6683780895897a8caf09f47
|
7
|
+
data.tar.gz: 6bc9fd32c5a46fca3c7b11184b95dc62c31ade54b5cbd4802e2c3f3e4bef6cfe73c01631fe50a6761a3e804786f567ae897d387e304e265fec5b5689168b8039
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
### 1.0.14
|
2
|
+
|
3
|
+
2024-05-25 06:41
|
4
|
+
|
5
|
+
#### NEW
|
6
|
+
|
7
|
+
- InsertTitle filter will extract title from metadata or filename and insert an H1 title into the content
|
8
|
+
- InsertScript will inject a javascript at the end of the content, allows passing multiple scripts separated by comma, and if the path is just a filename, it will look for it in ~/.config/conductor/javascript and insert an absolute path
|
9
|
+
|
10
|
+
### 1.0.13
|
11
|
+
|
12
|
+
2024-05-24 13:12
|
13
|
+
|
14
|
+
#### NEW
|
15
|
+
|
16
|
+
- New type of command -- filter: filterName(parameters), allows things like setStyle(github) or replace_all(regex, pattern) instead of having to write scripts for simple things like this. Can be run in sequences.
|
17
|
+
|
1
18
|
### 1.0.12
|
2
19
|
|
3
20
|
2024-05-01 13:06
|
data/README.md
CHANGED
@@ -23,7 +23,7 @@ If you use Homebrew, you can run
|
|
23
23
|
|
24
24
|
To use Conductor, you need to set up a configuration file in `~/.config/conductor/tracks.yaml`. Run `conductor` once to create the directory and an empty configuration. See [Configuration](#configuration) below for details on setting up your "tracks."
|
25
25
|
|
26
|
-
Once configured, you can set up conductor as a Custom Processor in Marked. Run `which conductor | pbcopy` to get the full path to the binary and copy it, then open
|
26
|
+
Once configured, you can set up conductor as a Custom Processor in Marked. Run `which conductor | pbcopy` to get the full path to the binary and copy it, then open **Marked Preferences > Advanced** and select either Custom Processor or Custom Preprocessor (or both) and paste into the **Path:** field. You can select *Automatically enable for new windows* to have the processor enabled by default when opening documents.
|
27
27
|
|
28
28
|
|
29
29
|
![Marked preferences](images/preferences.jpg)
|
@@ -122,13 +122,45 @@ Conditions can be combined with AND or OR (must be uppercase) and simple parenth
|
|
122
122
|
|
123
123
|
### Actions
|
124
124
|
|
125
|
-
The action can be
|
125
|
+
The action can be `script`, `command`, or `filter`.
|
126
126
|
|
127
|
-
Scripts are located in `~/.config/conductor/scripts/` and should be executable files that take input on STDIN (unless `$file` is specified in the `script` definition). If a script is defined starting with `~` or `/`, that will be interpreted as a full path to an alternate location.
|
127
|
+
**Scripts** are located in `~/.config/conductor/scripts/` and should be executable files that take input on STDIN (unless `$file` is specified in the `script` definition). If a script is defined starting with `~` or `/`, that will be interpreted as a full path to an alternate location.
|
128
128
|
|
129
|
-
|
129
|
+
> Example:
|
130
|
+
>
|
131
|
+
> script: github_pre
|
130
132
|
|
131
|
-
|
133
|
+
**Commands** are interpreted as shell commands. If a command exists in the `$PATH`, a full path will automatically be determined, so a command can be as simple as just `pandoc`. Add any arguments needed after the command.
|
134
|
+
|
135
|
+
> Example:
|
136
|
+
>
|
137
|
+
> command: multimarkdown
|
138
|
+
|
139
|
+
|
140
|
+
> Using `$file` as an argument to a script or command will bypass processing of STDIN input, and instead use the value of $MARKED_PATH to read the contents of the specified file.
|
141
|
+
|
142
|
+
**Filters** are simple actions that can be run on the content without having to write a separate script for it. Available filters are:
|
143
|
+
| filter | description |
|
144
|
+
| :---- | :---------- |
|
145
|
+
| `setMeta(key, value)` | adds or updates a meta key, aware of YAML and MMD |
|
146
|
+
| `stripMeta` | strips all metadata (YAML or MMD) from the content |
|
147
|
+
| `stripMeta(key)` | removes a specific key (YAML or MMD) |
|
148
|
+
| `setStyle(name)` | sets the Marked preview style to a preconfigured Style name
|
149
|
+
| `replace(search, replace)` | performs a (single) search and replace on content |
|
150
|
+
| `replaceAll(search, replace)` | global version of `replaceAll`) |
|
151
|
+
| `insertTitle` | adds a title to the document, either from metadata or filename |
|
152
|
+
| `insertScript(path[,path])` | injects javascript(s) |
|
153
|
+
|
154
|
+
For `insertScript`, if path is just a filename it will look for a match in `~/.config/conductor/javascript` or `~/.config/conductor/scripts` and turn that into an absolute path if the file is found.
|
155
|
+
|
156
|
+
For `replace` and `replaceAll`: If *search* is surrounded with forward slashes followed by optional flags (*i* for case-insensitive, *m* to make dot match newlines), e.g. `/contribut(ing)?/i`, it will be interpreted as a regular expression. The *replace* value can include numeric capture groups, e.g. `Follow$2`.
|
157
|
+
|
158
|
+
> Example:
|
159
|
+
>
|
160
|
+
> filter: setStyle(github)
|
161
|
+
|
162
|
+
|
163
|
+
> Filters can be camel case (replaceAll) or snake case (replace_all), either will work, case insensitive.
|
132
164
|
|
133
165
|
## Custom Processors
|
134
166
|
|
@@ -142,8 +174,8 @@ A script run by Conductor already knows it has the right type of file with the e
|
|
142
174
|
## Tips
|
143
175
|
|
144
176
|
- Config file must be valid YAML. Any value containing colons, brackets, or other special characters should be quoted, e.g. (`condition: "text contains my:text"`)
|
145
|
-
- You can see what condition matched in Marked by opening
|
146
|
-
- To run [a custom processor for Bear](https://brettterpstra.com/2023/10/08/marked-and-bear/), use the condition `"text contains <!-- source: bear.app -->"
|
177
|
+
- You can see what condition matched in Marked by opening **Help->Show Custom Processor Log** and checking the STDERR output.
|
178
|
+
- To run [a custom processor for Bear](https://brettterpstra.com/2023/10/08/marked-and-bear/), use the condition `"text contains <!-- source: bear.app -->"`. You might consider running a commonmark CLI with Bear to support more of its syntax.
|
147
179
|
- To run a custom processor for Obsidian, use the condition `tree contains .obsidian`
|
148
180
|
|
149
181
|
## Testing
|
@@ -154,6 +186,8 @@ In Marked's Custom Processor Log, you can see both the STDOUT output and the STD
|
|
154
186
|
|
155
187
|
### From the command line
|
156
188
|
|
189
|
+
> There's a script included in the repo called [test.sh](https://github.com/ttscoff/marked-conductor/blob/main/test.sh) that will take a file path as an argument and set all of the environment variables for testing. Run `test.sh -h` for usage instructions.
|
190
|
+
|
157
191
|
In order to test from the command line, you'll need certain environment variables set. This can be done by exporting the following variables with your own definitions, or by running conductor with all of the variables preceding the command, e.g. `$ MARKED_ORIGIN=/path/to/markdown_file.md [...] conductor`.
|
158
192
|
|
159
193
|
The following need to be defined. Some can be left as empty or to defaults, such as `MARKED_INCLUDES` and `MARKED_OUTLINE`, but all need to be set to something.
|
data/bin/conductor
CHANGED
@@ -25,6 +25,10 @@ module Conductor
|
|
25
25
|
command = Command.new(cmd[:command])
|
26
26
|
|
27
27
|
res = command.run
|
28
|
+
elsif cmd[:filter]
|
29
|
+
filter = Filter.new(cmd[:filter])
|
30
|
+
|
31
|
+
res = filter.process
|
28
32
|
end
|
29
33
|
|
30
34
|
Conductor.stdin = res unless res.nil?
|
@@ -37,6 +41,10 @@ module Conductor
|
|
37
41
|
command = Command.new(track[:command])
|
38
42
|
|
39
43
|
Conductor.stdin = command.run
|
44
|
+
elsif track[:filter]
|
45
|
+
filter = Filter.new(track[:filter])
|
46
|
+
|
47
|
+
Conductor.stdin = filter.process
|
40
48
|
end
|
41
49
|
|
42
50
|
Conductor.stdin
|
data/html/Conductor.html
CHANGED
@@ -154,7 +154,7 @@ sub-tracks.</pre>
|
|
154
154
|
<p>@return [Array] result, matched condition(s)</p>
|
155
155
|
|
156
156
|
<div class="method-source-code" id="conduct-source">
|
157
|
-
<pre><span class="ruby-comment"># File bin/conductor, line
|
157
|
+
<pre><span class="ruby-comment"># File bin/conductor, line 64</span>
|
158
158
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">conduct</span>(<span class="ruby-identifier">tracks</span>, <span class="ruby-identifier">res</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">condition</span> = <span class="ruby-keyword">nil</span>)
|
159
159
|
<span class="ruby-identifier">tracks</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">track</span><span class="ruby-operator">|</span>
|
160
160
|
<span class="ruby-identifier">cond</span> = <span class="ruby-constant">Condition</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">track</span>[<span class="ruby-value">:condition</span>])
|
@@ -221,6 +221,10 @@ sub-tracks.</pre>
|
|
221
221
|
<span class="ruby-identifier">command</span> = <span class="ruby-constant">Command</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">cmd</span>[<span class="ruby-value">:command</span>])
|
222
222
|
|
223
223
|
<span class="ruby-identifier">res</span> = <span class="ruby-identifier">command</span>.<span class="ruby-identifier">run</span>
|
224
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">cmd</span>[<span class="ruby-value">:filter</span>]
|
225
|
+
<span class="ruby-identifier">filter</span> = <span class="ruby-constant">Filter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">cmd</span>[<span class="ruby-value">:filter</span>])
|
226
|
+
|
227
|
+
<span class="ruby-identifier">res</span> = <span class="ruby-identifier">filter</span>.<span class="ruby-identifier">process</span>
|
224
228
|
<span class="ruby-keyword">end</span>
|
225
229
|
|
226
230
|
<span class="ruby-constant">Conductor</span>.<span class="ruby-identifier">stdin</span> = <span class="ruby-identifier">res</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">nil?</span>
|
@@ -233,6 +237,10 @@ sub-tracks.</pre>
|
|
233
237
|
<span class="ruby-identifier">command</span> = <span class="ruby-constant">Command</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">track</span>[<span class="ruby-value">:command</span>])
|
234
238
|
|
235
239
|
<span class="ruby-constant">Conductor</span>.<span class="ruby-identifier">stdin</span> = <span class="ruby-identifier">command</span>.<span class="ruby-identifier">run</span>
|
240
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">track</span>[<span class="ruby-value">:filter</span>]
|
241
|
+
<span class="ruby-identifier">filter</span> = <span class="ruby-constant">Filter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">track</span>[<span class="ruby-value">:filter</span>])
|
242
|
+
|
243
|
+
<span class="ruby-constant">Conductor</span>.<span class="ruby-identifier">stdin</span> = <span class="ruby-identifier">filter</span>.<span class="ruby-identifier">process</span>
|
236
244
|
<span class="ruby-keyword">end</span>
|
237
245
|
|
238
246
|
<span class="ruby-constant">Conductor</span>.<span class="ruby-identifier">stdin</span>
|
@@ -256,7 +264,7 @@ sub-tracks.</pre>
|
|
256
264
|
|
257
265
|
|
258
266
|
<div class="method-source-code" id="stdin-source">
|
259
|
-
<pre><span class="ruby-comment"># File lib/conductor.rb, line
|
267
|
+
<pre><span class="ruby-comment"># File lib/conductor.rb, line 27</span>
|
260
268
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">stdin</span>
|
261
269
|
<span class="ruby-identifier">warn</span> <span class="ruby-string">"input on STDIN required"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">$stdin</span>.<span class="ruby-identifier">stat</span>.<span class="ruby-identifier">size</span>.<span class="ruby-identifier">positive?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">$stdin</span>.<span class="ruby-identifier">fcntl</span>(<span class="ruby-constant">Fcntl</span><span class="ruby-operator">::</span><span class="ruby-constant">F_GETFL</span>, <span class="ruby-value">0</span>).<span class="ruby-identifier">zero?</span>
|
262
270
|
<span class="ruby-ivar">@stdin</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">$stdin</span>.<span class="ruby-identifier">read</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">"utf-8"</span>)
|
data/html/Filter.html
ADDED
@@ -0,0 +1,243 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class Filter - Marked Conductor</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "./";
|
11
|
+
var index_rel_prefix = "./";
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<script src="./js/navigation.js" defer></script>
|
15
|
+
<script src="./js/search.js" defer></script>
|
16
|
+
<script src="./js/search_index.js" defer></script>
|
17
|
+
<script src="./js/searcher.js" defer></script>
|
18
|
+
<script src="./js/darkfish.js" defer></script>
|
19
|
+
|
20
|
+
<link href="./css/fonts.css" rel="stylesheet">
|
21
|
+
<link href="./css/rdoc.css" rel="stylesheet">
|
22
|
+
|
23
|
+
|
24
|
+
<body id="top" role="document" class="class">
|
25
|
+
<nav role="navigation">
|
26
|
+
<div id="project-navigation">
|
27
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
28
|
+
<h2>
|
29
|
+
<a href="./index.html" rel="home">Home</a>
|
30
|
+
</h2>
|
31
|
+
|
32
|
+
<div id="table-of-contents-navigation">
|
33
|
+
<a href="./table_of_contents.html#pages">Pages</a>
|
34
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
35
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
40
|
+
<form action="#" method="get" accept-charset="utf-8">
|
41
|
+
<div id="search-field-wrapper">
|
42
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
43
|
+
aria-autocomplete="list" aria-controls="search-results"
|
44
|
+
type="text" name="search" placeholder="Search (/) for a class, method, ..." spellcheck="false"
|
45
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
46
|
+
</div>
|
47
|
+
|
48
|
+
<ul id="search-results" aria-label="Search Results"
|
49
|
+
aria-busy="false" aria-expanded="false"
|
50
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
51
|
+
</form>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
</div>
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
<div id="class-metadata">
|
59
|
+
|
60
|
+
|
61
|
+
<div id="parent-class-section" class="nav-section">
|
62
|
+
<h3>Parent</h3>
|
63
|
+
|
64
|
+
<p class="link"><a href="String.html">String</a>
|
65
|
+
</div>
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
<!-- Method Quickref -->
|
71
|
+
<div id="method-list-section" class="nav-section">
|
72
|
+
<h3>Methods</h3>
|
73
|
+
|
74
|
+
<ul class="link-list" role="directory">
|
75
|
+
<li class="calls-super" ><a href="#method-c-new">::new</a>
|
76
|
+
<li ><a href="#method-i-process">#process</a>
|
77
|
+
</ul>
|
78
|
+
</div>
|
79
|
+
|
80
|
+
</div>
|
81
|
+
</nav>
|
82
|
+
|
83
|
+
<main role="main" aria-labelledby="class-Filter">
|
84
|
+
<h1 id="class-Filter" class="class">
|
85
|
+
class Filter
|
86
|
+
</h1>
|
87
|
+
|
88
|
+
<section class="description">
|
89
|
+
|
90
|
+
<p><a href="String.html"><code>String</code></a> filtering</p>
|
91
|
+
|
92
|
+
</section>
|
93
|
+
|
94
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
<section class="attribute-method-details" class="method-section">
|
99
|
+
<header>
|
100
|
+
<h3>Attributes</h3>
|
101
|
+
</header>
|
102
|
+
|
103
|
+
<div id="attribute-i-filter" class="method-detail">
|
104
|
+
<div class="method-heading attribute-method-heading">
|
105
|
+
<span class="method-name">filter</span><span
|
106
|
+
class="attribute-access-type">[R]</span>
|
107
|
+
</div>
|
108
|
+
|
109
|
+
<div class="method-description">
|
110
|
+
|
111
|
+
</div>
|
112
|
+
</div>
|
113
|
+
<div id="attribute-i-params" class="method-detail">
|
114
|
+
<div class="method-heading attribute-method-heading">
|
115
|
+
<span class="method-name">params</span><span
|
116
|
+
class="attribute-access-type">[R]</span>
|
117
|
+
</div>
|
118
|
+
|
119
|
+
<div class="method-description">
|
120
|
+
|
121
|
+
</div>
|
122
|
+
</div>
|
123
|
+
</section>
|
124
|
+
|
125
|
+
|
126
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
127
|
+
<header>
|
128
|
+
<h3>Public Class Methods</h3>
|
129
|
+
</header>
|
130
|
+
|
131
|
+
<div id="method-c-new" class="method-detail ">
|
132
|
+
<div class="method-header">
|
133
|
+
<div class="method-heading">
|
134
|
+
<span class="method-name">new</span><span
|
135
|
+
class="method-args">(filter)</span>
|
136
|
+
<span class="method-click-advice">click to toggle source</span>
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
|
140
|
+
<div class="method-description">
|
141
|
+
|
142
|
+
<div class="method-calls-super">
|
143
|
+
Calls superclass method
|
144
|
+
|
145
|
+
</div>
|
146
|
+
|
147
|
+
<div class="method-source-code" id="new-source">
|
148
|
+
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 221</span>
|
149
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">filter</span>)
|
150
|
+
<span class="ruby-ivar">@filter</span>, <span class="ruby-ivar">@params</span> = <span class="ruby-identifier">filter</span>.<span class="ruby-identifier">normalize_filter</span>
|
151
|
+
<span class="ruby-keyword">super</span>
|
152
|
+
<span class="ruby-keyword">end</span></pre>
|
153
|
+
</div>
|
154
|
+
</div>
|
155
|
+
|
156
|
+
|
157
|
+
</div>
|
158
|
+
|
159
|
+
</section>
|
160
|
+
|
161
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
162
|
+
<header>
|
163
|
+
<h3>Public Instance Methods</h3>
|
164
|
+
</header>
|
165
|
+
|
166
|
+
<div id="method-i-process" class="method-detail ">
|
167
|
+
<div class="method-header">
|
168
|
+
<div class="method-heading">
|
169
|
+
<span class="method-name">process</span><span
|
170
|
+
class="method-args">()</span>
|
171
|
+
<span class="method-click-advice">click to toggle source</span>
|
172
|
+
</div>
|
173
|
+
</div>
|
174
|
+
|
175
|
+
<div class="method-description">
|
176
|
+
|
177
|
+
|
178
|
+
<div class="method-source-code" id="process-source">
|
179
|
+
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 226</span>
|
180
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">process</span>
|
181
|
+
<span class="ruby-identifier">content</span> = <span class="ruby-constant">Conductor</span>.<span class="ruby-identifier">stdin</span>
|
182
|
+
|
183
|
+
<span class="ruby-keyword">case</span> <span class="ruby-ivar">@filter</span>
|
184
|
+
<span class="ruby-keyword">when</span> <span class="ruby-regexp">/(insert|add|inject)title/</span>
|
185
|
+
<span class="ruby-identifier">content</span>.<span class="ruby-identifier">insert_title</span>
|
186
|
+
<span class="ruby-keyword">when</span> <span class="ruby-regexp">/(insert|add|inject)script/</span>
|
187
|
+
<span class="ruby-identifier">content</span> = <span class="ruby-identifier">content</span>.<span class="ruby-identifier">append</span>(<span class="ruby-string">"\n\n<div>"</span>)
|
188
|
+
<span class="ruby-ivar">@params</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">script</span><span class="ruby-operator">|</span>
|
189
|
+
<span class="ruby-identifier">content</span> = <span class="ruby-identifier">content</span>.<span class="ruby-identifier">insert_script</span>(<span class="ruby-identifier">script</span>)
|
190
|
+
<span class="ruby-keyword">end</span>
|
191
|
+
<span class="ruby-node">"#{content}</div>"</span>
|
192
|
+
<span class="ruby-keyword">when</span> <span class="ruby-regexp">/(add|set)meta/</span>
|
193
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-ivar">@params</span>.<span class="ruby-identifier">count</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span>
|
194
|
+
<span class="ruby-identifier">warn</span> <span class="ruby-node">"Invalid filter parameters: #{@filter}(#{@params.join(",")})"</span>
|
195
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">content</span>
|
196
|
+
<span class="ruby-keyword">end</span>
|
197
|
+
|
198
|
+
<span class="ruby-comment"># needs to test for existing meta, setting key if exists, adding if not</span>
|
199
|
+
<span class="ruby-comment"># should recognize yaml and mmd</span>
|
200
|
+
<span class="ruby-identifier">content</span>.<span class="ruby-identifier">set_meta</span>(<span class="ruby-ivar">@params</span>[<span class="ruby-value">0</span>], <span class="ruby-ivar">@params</span>[<span class="ruby-value">1</span>], <span class="ruby-value">style:</span> <span class="ruby-identifier">content</span>.<span class="ruby-identifier">meta_type</span>)
|
201
|
+
<span class="ruby-keyword">when</span> <span class="ruby-regexp">/(strip|remove)meta/</span>
|
202
|
+
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@params</span>
|
203
|
+
<span class="ruby-identifier">content</span>.<span class="ruby-identifier">delete_meta</span>(<span class="ruby-ivar">@params</span>[<span class="ruby-value">0</span>])
|
204
|
+
<span class="ruby-keyword">else</span>
|
205
|
+
<span class="ruby-identifier">content</span>.<span class="ruby-identifier">strip_meta</span>
|
206
|
+
<span class="ruby-keyword">end</span>
|
207
|
+
<span class="ruby-keyword">when</span> <span class="ruby-regexp">/setstyle/</span>
|
208
|
+
<span class="ruby-comment"># Should check for existing style first</span>
|
209
|
+
<span class="ruby-identifier">content</span>.<span class="ruby-identifier">set_meta</span>(<span class="ruby-string">"marked style"</span>, <span class="ruby-ivar">@params</span>[<span class="ruby-value">0</span>], <span class="ruby-value">style:</span> <span class="ruby-value">:comment</span>)
|
210
|
+
<span class="ruby-keyword">when</span> <span class="ruby-regexp">/replaceall/</span>
|
211
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-ivar">@params</span>.<span class="ruby-identifier">count</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span>
|
212
|
+
<span class="ruby-identifier">warn</span> <span class="ruby-node">"Invalid filter parameters: #{@filter}(#{@params.join(",")})"</span>
|
213
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">content</span>
|
214
|
+
<span class="ruby-keyword">end</span>
|
215
|
+
|
216
|
+
<span class="ruby-identifier">content</span>.<span class="ruby-identifier">replace_all</span>(<span class="ruby-ivar">@params</span>[<span class="ruby-value">0</span>], <span class="ruby-ivar">@params</span>[<span class="ruby-value">1</span>])
|
217
|
+
<span class="ruby-keyword">when</span> <span class="ruby-regexp">/replace$/</span>
|
218
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-ivar">@params</span>.<span class="ruby-identifier">count</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span>
|
219
|
+
<span class="ruby-identifier">warn</span> <span class="ruby-node">"Invalid filter parameters: #{@filter}(#{@params.join(",")})"</span>
|
220
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">content</span>
|
221
|
+
<span class="ruby-keyword">end</span>
|
222
|
+
|
223
|
+
<span class="ruby-identifier">content</span>.<span class="ruby-identifier">replace</span>(<span class="ruby-ivar">@params</span>[<span class="ruby-value">0</span>], <span class="ruby-ivar">@params</span>[<span class="ruby-value">1</span>])
|
224
|
+
<span class="ruby-keyword">end</span>
|
225
|
+
<span class="ruby-keyword">end</span></pre>
|
226
|
+
</div>
|
227
|
+
</div>
|
228
|
+
|
229
|
+
|
230
|
+
</div>
|
231
|
+
|
232
|
+
</section>
|
233
|
+
|
234
|
+
</section>
|
235
|
+
</main>
|
236
|
+
|
237
|
+
|
238
|
+
<footer id="validator-badges" role="contentinfo">
|
239
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
240
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.6.2.
|
241
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
242
|
+
</footer>
|
243
|
+
|
data/html/Object.html
CHANGED
@@ -114,7 +114,7 @@
|
|
114
114
|
<p>@param condition The condition</p>
|
115
115
|
|
116
116
|
<div class="method-source-code" id="clean_condition-source">
|
117
|
-
<pre><span class="ruby-comment"># File bin/conductor, line
|
117
|
+
<pre><span class="ruby-comment"># File bin/conductor, line 127</span>
|
118
118
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">clean_condition</span>(<span class="ruby-identifier">condition</span>)
|
119
119
|
<span class="ruby-identifier">condition</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">""</span>).<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/ *(->|,) *$/</span>, <span class="ruby-string">""</span>)
|
120
120
|
<span class="ruby-keyword">end</span></pre>
|