fixes
This commit is contained in:
parent
82ed7e81e4
commit
b87809a0aa
Binary file not shown.
Before Width: | Height: | Size: 159 KiB After Width: | Height: | Size: 144 KiB |
@ -51,12 +51,7 @@
|
|||||||
<key>ActionParameters</key>
|
<key>ActionParameters</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>source</key>
|
<key>source</key>
|
||||||
<string>// To make this work as a keyboard shortcut see:
|
<string>// To make this work as a keyboard shortcut see:
// https://apple.stackexchange.com/a/276839
function run(input, parameters) {
var out = [];
var a = input[0].split("\n");
var chords = null;
var chordsWidth = 0;
for (var i = 0; i < a.length; i++) {
var l = a[i].replace(/\s+$/, '');
if (l.length == 0) {
chords = null;
out.push("");
continue;
}
if (chords == null) {
chords = [];
var re = /[\w#]+/g;
while ((match = re.exec(l)) != null) {
chords.push(match);
}
chordsWidth = l.length;
} else {
l = l.padEnd(chordsWidth, ' ');
for (var j = chords.length - 1; j >= 0; j--) {
var c = chords[j];
l = [l.slice(0, c.index), "^{" + c[0] + "}", l.slice(c.index)].join('');
}
out.push(l + ' \\\\');
chords = null;
}
}
return out.join("\n");
}</string>
|
||||||
// https://apple.stackexchange.com/a/276839
|
|
||||||
function run(input, parameters) {
var out = [];
var a = input[0].split("\n");
var chords = null;
|
|
||||||
var chordsWidth = 0;
for (var i = 0; i < a.length; i++) {
var l = a[i].replace(/\s+$/, '');
if (l.length == 0) {
chords = null;
out.push("");
continue;
}
if (chords == null) {
chords = [];
var re = /\w+/g;
while ((match = re.exec(l)) != null) {
chords.push(match);
}
|
|
||||||
chordsWidth = l.length;
} else {
|
|
||||||
l = l.padEnd(chordsWidth, ' ');
for (var j = chords.length - 1; j >= 0; j--) {
var c = chords[j];
l = [l.slice(0, c.index), "^{" + c[0] + "}", l.slice(c.index)].join('');
}
out.push(l);
chords = null;
}
}
return out.join("\n");
}</string>
|
|
||||||
</dict>
|
</dict>
|
||||||
<key>BundleIdentifier</key>
|
<key>BundleIdentifier</key>
|
||||||
<string>com.apple.Automator.RunJavaScript</string>
|
<string>com.apple.Automator.RunJavaScript</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user