diff --git a/utils/ug2leadsheets.workflow/Contents/QuickLook/Preview.png b/utils/ug2leadsheets.workflow/Contents/QuickLook/Preview.png index 53cdd37..d46a204 100644 Binary files a/utils/ug2leadsheets.workflow/Contents/QuickLook/Preview.png and b/utils/ug2leadsheets.workflow/Contents/QuickLook/Preview.png differ diff --git a/utils/ug2leadsheets.workflow/Contents/document.wflow b/utils/ug2leadsheets.workflow/Contents/document.wflow index 40348b2..6735aa6 100644 --- a/utils/ug2leadsheets.workflow/Contents/document.wflow +++ b/utils/ug2leadsheets.workflow/Contents/document.wflow @@ -51,12 +51,7 @@ ActionParameters source - // 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"); } + // 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"); } BundleIdentifier com.apple.Automator.RunJavaScript