chordsheetjs 6.1.0 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +481 -572
- package/lib/bundle.js +15393 -0
- package/lib/index.js +6290 -216
- package/lib/index.js.map +1 -0
- package/lib/main.d.ts +1095 -0
- package/lib/main.d.ts.map +1 -0
- package/package.json +43 -21
- package/.husky/pre-commit +0 -5
- package/lib/chord.js +0 -496
- package/lib/chord_sheet/chord_lyrics_pair.js +0 -80
- package/lib/chord_sheet/chord_pro/composite.js +0 -54
- package/lib/chord_sheet/chord_pro/evaluation_error.js +0 -58
- package/lib/chord_sheet/chord_pro/literal.js +0 -42
- package/lib/chord_sheet/chord_pro/ternary.js +0 -126
- package/lib/chord_sheet/comment.js +0 -55
- package/lib/chord_sheet/line.js +0 -207
- package/lib/chord_sheet/metadata.js +0 -216
- package/lib/chord_sheet/paragraph.js +0 -88
- package/lib/chord_sheet/song.js +0 -531
- package/lib/chord_sheet/tag.js +0 -359
- package/lib/chord_sheet_serializer.js +0 -278
- package/lib/constants.js +0 -54
- package/lib/formatter/chord_pro_formatter.js +0 -184
- package/lib/formatter/html_div_formatter.js +0 -130
- package/lib/formatter/html_formatter.js +0 -44
- package/lib/formatter/html_table_formatter.js +0 -154
- package/lib/formatter/templates/html_div_formatter.js +0 -544
- package/lib/formatter/templates/html_table_formatter.js +0 -731
- package/lib/formatter/text_formatter.js +0 -184
- package/lib/helpers.js +0 -56
- package/lib/key.js +0 -386
- package/lib/normalize_mappings/enharmonic-normalize.js +0 -124
- package/lib/normalize_mappings/generate-suffix-normalize-mapping.js +0 -36
- package/lib/normalize_mappings/suffix-normalize-mapping.js +0 -914
- package/lib/note.js +0 -264
- package/lib/parser/chord_pro_parser.js +0 -64
- package/lib/parser/chord_pro_peg_parser.js +0 -2069
- package/lib/parser/chord_sheet_parser.js +0 -175
- package/lib/parser/parser_warning.js +0 -62
- package/lib/parser/ultimate_guitar_parser.js +0 -154
- package/lib/template_helpers.js +0 -98
- package/lib/utilities.js +0 -110
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ChordSheetJS [](https://codeclimate.com/github/martijnversluis/ChordSheetJS)
|
|
2
2
|
|
|
3
3
|
A JavaScript library for parsing and formatting chord sheets
|
|
4
4
|
|
|
@@ -11,6 +11,8 @@ A JavaScript library for parsing and formatting chord sheets
|
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
|
+
### Package managers
|
|
15
|
+
|
|
14
16
|
`ChordSheetJS` is on npm, to install run:
|
|
15
17
|
|
|
16
18
|
```bash
|
|
@@ -29,6 +31,19 @@ or `require()`:
|
|
|
29
31
|
var ChordSheetJS = require('chordsheetjs').default;
|
|
30
32
|
```
|
|
31
33
|
|
|
34
|
+
### Standalone bundle file
|
|
35
|
+
|
|
36
|
+
If you're not using a build tool, you can download and use the `bundle.js` from the
|
|
37
|
+
[latest release](https://github.com/martijnversluis/ChordSheetJS/releases/latest):
|
|
38
|
+
|
|
39
|
+
```html
|
|
40
|
+
<script src="bundle.js"></script>
|
|
41
|
+
<script>
|
|
42
|
+
// ChordSheetJS is available in global namespace now
|
|
43
|
+
const parser = new ChordSheetJS.ChordProParser();
|
|
44
|
+
</script>
|
|
45
|
+
```
|
|
46
|
+
|
|
32
47
|
## How to ...?
|
|
33
48
|
|
|
34
49
|
### Parse chord sheet
|
|
@@ -343,174 +358,132 @@ subject to breaking changes between major versions.
|
|
|
343
358
|
|
|
344
359
|
<dl>
|
|
345
360
|
<dt><a href="#ChordLyricsPair">ChordLyricsPair</a></dt>
|
|
346
|
-
<dd><p>Represents a chord with the corresponding (partial) lyrics</p>
|
|
347
|
-
</dd>
|
|
361
|
+
<dd><p>Represents a chord with the corresponding (partial) lyrics</p></dd>
|
|
348
362
|
<dt><a href="#Comment">Comment</a></dt>
|
|
349
|
-
<dd><p>Represents a comment. See
|
|
350
|
-
</dd>
|
|
351
|
-
<dt><a href="#Line">Line</a></dt>
|
|
352
|
-
<dd><p>Represents a line in a chord sheet, consisting of items of type ChordLyricsPair or Tag</p>
|
|
353
|
-
</dd>
|
|
363
|
+
<dd><p>Represents a comment. See https://www.chordpro.org/chordpro/chordpro-file-format-specification/#overview</p></dd>
|
|
354
364
|
<dt><a href="#Metadata">Metadata</a></dt>
|
|
355
365
|
<dd><p>Stores song metadata. Properties can be accessed using the get() method:</p>
|
|
356
|
-
<p>const metadata = new Metadata({ author:
|
|
357
|
-
metadata.get(
|
|
358
|
-
<p>See
|
|
359
|
-
</dd>
|
|
366
|
+
<p>const metadata = new Metadata({ author: 'John' });
|
|
367
|
+
metadata.get('author') // => 'John'</p>
|
|
368
|
+
<p>See [get](#Metadata+get)</p></dd>
|
|
360
369
|
<dt><a href="#Paragraph">Paragraph</a></dt>
|
|
361
|
-
<dd><p>Represents a paragraph of lines in a chord sheet</p>
|
|
362
|
-
</dd>
|
|
370
|
+
<dd><p>Represents a paragraph of lines in a chord sheet</p></dd>
|
|
363
371
|
<dt><a href="#Song">Song</a></dt>
|
|
364
|
-
<dd><p>Represents a song in a chord sheet. Currently a chord sheet can only have one song.</p>
|
|
365
|
-
</dd>
|
|
372
|
+
<dd><p>Represents a song in a chord sheet. Currently a chord sheet can only have one song.</p></dd>
|
|
366
373
|
<dt><a href="#Tag">Tag</a></dt>
|
|
367
|
-
<dd><p>Represents a tag/directive. See
|
|
368
|
-
</dd>
|
|
374
|
+
<dd><p>Represents a tag/directive. See https://www.chordpro.org/chordpro/chordpro-directives/</p></dd>
|
|
369
375
|
<dt><a href="#ChordProFormatter">ChordProFormatter</a></dt>
|
|
370
|
-
<dd><p>Formats a song into a ChordPro chord sheet</p>
|
|
371
|
-
</
|
|
376
|
+
<dd><p>Formats a song into a ChordPro chord sheet</p></dd>
|
|
377
|
+
<dt><a href="#Formatter">Formatter</a></dt>
|
|
378
|
+
<dd><p>Base class for all formatters, taking care of receiving a configuration wrapping that inside a Configuration object</p></dd>
|
|
372
379
|
<dt><a href="#HtmlDivFormatter">HtmlDivFormatter</a></dt>
|
|
373
|
-
<dd><p>Formats a song into HTML. It uses DIVs to align lyrics with chords, which makes it useful for responsive web pages.</p>
|
|
374
|
-
</dd>
|
|
380
|
+
<dd><p>Formats a song into HTML. It uses DIVs to align lyrics with chords, which makes it useful for responsive web pages.</p></dd>
|
|
375
381
|
<dt><a href="#HtmlFormatter">HtmlFormatter</a></dt>
|
|
376
|
-
<dd><p>Acts as a base class for HTML formatters, taking care of whitelisting prototype property access.</p>
|
|
377
|
-
</dd>
|
|
382
|
+
<dd><p>Acts as a base class for HTML formatters, taking care of whitelisting prototype property access.</p></dd>
|
|
378
383
|
<dt><a href="#HtmlTableFormatter">HtmlTableFormatter</a></dt>
|
|
379
384
|
<dd><p>Formats a song into HTML. It uses TABLEs to align lyrics with chords, which makes the HTML for things like
|
|
380
|
-
PDF conversion.</p>
|
|
381
|
-
</dd>
|
|
385
|
+
PDF conversion.</p></dd>
|
|
382
386
|
<dt><a href="#TextFormatter">TextFormatter</a></dt>
|
|
383
|
-
<dd><p>Formats a song into a plain text chord sheet</p>
|
|
384
|
-
</dd>
|
|
387
|
+
<dd><p>Formats a song into a plain text chord sheet</p></dd>
|
|
385
388
|
<dt><a href="#ChordProParser">ChordProParser</a></dt>
|
|
386
|
-
<dd><p>Parses a ChordPro chord sheet</p>
|
|
387
|
-
</dd>
|
|
389
|
+
<dd><p>Parses a ChordPro chord sheet</p></dd>
|
|
388
390
|
<dt><a href="#ChordSheetParser">ChordSheetParser</a></dt>
|
|
389
|
-
<dd><p>Parses a normal chord sheet</p>
|
|
390
|
-
</dd>
|
|
391
|
+
<dd><p>Parses a normal chord sheet</p></dd>
|
|
391
392
|
<dt><a href="#ParserWarning">ParserWarning</a></dt>
|
|
392
|
-
<dd><p>Represents a parser warning, currently only used by ChordProParser.</p>
|
|
393
|
-
</dd>
|
|
393
|
+
<dd><p>Represents a parser warning, currently only used by ChordProParser.</p></dd>
|
|
394
394
|
<dt><a href="#UltimateGuitarParser">UltimateGuitarParser</a></dt>
|
|
395
395
|
<dd><p>Parses an Ultimate Guitar chord sheet with metadata
|
|
396
|
-
Inherits from
|
|
397
|
-
</dd>
|
|
396
|
+
Inherits from [ChordSheetParser](#ChordSheetParser)</p></dd>
|
|
398
397
|
<dt><a href="#Chord">Chord</a></dt>
|
|
399
|
-
<dd><p>Represents a Chord, consisting of a root, suffix (quality) and bass</p>
|
|
400
|
-
</dd>
|
|
398
|
+
<dd><p>Represents a Chord, consisting of a root, suffix (quality) and bass</p></dd>
|
|
401
399
|
<dt><a href="#ChordSheetSerializer">ChordSheetSerializer</a></dt>
|
|
402
|
-
<dd><p>Serializes a song into een plain object, and deserializes the serialized object back into a
|
|
403
|
-
</dd>
|
|
400
|
+
<dd><p>Serializes a song into een plain object, and deserializes the serialized object back into a [Song](#Song)</p></dd>
|
|
404
401
|
</dl>
|
|
405
402
|
|
|
406
|
-
##
|
|
403
|
+
## Members
|
|
407
404
|
|
|
408
405
|
<dl>
|
|
409
406
|
<dt><a href="#ALBUM">ALBUM</a> : <code>string</code></dt>
|
|
410
|
-
<dd><p>
|
|
411
|
-
</dd>
|
|
407
|
+
<dd><p>Artist meta directive. See https://www.chordpro.org/chordpro/directives-artist/</p></dd>
|
|
412
408
|
<dt><a href="#ARTIST">ARTIST</a> : <code>string</code></dt>
|
|
413
|
-
<dd><p>
|
|
414
|
-
</dd>
|
|
409
|
+
<dd><p>Capo meta directive. See https://www.chordpro.org/chordpro/directives-capo/</p></dd>
|
|
415
410
|
<dt><a href="#CAPO">CAPO</a> : <code>string</code></dt>
|
|
416
|
-
<dd><p>
|
|
417
|
-
</dd>
|
|
411
|
+
<dd><p>Comment directive. See https://www.chordpro.org/chordpro/directives-comment/</p></dd>
|
|
418
412
|
<dt><a href="#COMMENT">COMMENT</a> : <code>string</code></dt>
|
|
419
|
-
<dd><p>
|
|
420
|
-
</dd>
|
|
413
|
+
<dd><p>Composer meta directive. See https://www.chordpro.org/chordpro/directives-composer/</p></dd>
|
|
421
414
|
<dt><a href="#COMPOSER">COMPOSER</a> : <code>string</code></dt>
|
|
422
|
-
<dd><p>
|
|
423
|
-
</dd>
|
|
415
|
+
<dd><p>Copyright meta directive. See https://www.chordpro.org/chordpro/directives-copyright/</p></dd>
|
|
424
416
|
<dt><a href="#COPYRIGHT">COPYRIGHT</a> : <code>string</code></dt>
|
|
425
|
-
<dd><p>
|
|
426
|
-
</dd>
|
|
417
|
+
<dd><p>Duration meta directive. See https://www.chordpro.org/chordpro/directives-duration/</p></dd>
|
|
427
418
|
<dt><a href="#DURATION">DURATION</a> : <code>string</code></dt>
|
|
428
|
-
<dd><p>
|
|
429
|
-
</dd>
|
|
419
|
+
<dd><p>End of chorus directive. See https://www.chordpro.org/chordpro/directives-env_chorus/</p></dd>
|
|
430
420
|
<dt><a href="#END_OF_CHORUS">END_OF_CHORUS</a> : <code>string</code></dt>
|
|
431
|
-
<dd><p>End of
|
|
432
|
-
</dd>
|
|
421
|
+
<dd><p>End of tab directive. See https://www.chordpro.org/chordpro/directives-env_tab/</p></dd>
|
|
433
422
|
<dt><a href="#END_OF_TAB">END_OF_TAB</a> : <code>string</code></dt>
|
|
434
|
-
<dd><p>End of
|
|
435
|
-
</dd>
|
|
423
|
+
<dd><p>End of verse directive. See https://www.chordpro.org/chordpro/directives-env_verse/</p></dd>
|
|
436
424
|
<dt><a href="#END_OF_VERSE">END_OF_VERSE</a> : <code>string</code></dt>
|
|
437
|
-
<dd><p>
|
|
438
|
-
</dd>
|
|
425
|
+
<dd><p>Key meta directive. See https://www.chordpro.org/chordpro/directives-key/</p></dd>
|
|
439
426
|
<dt><a href="#KEY">KEY</a> : <code>string</code></dt>
|
|
440
|
-
<dd><p>Key meta directive. See
|
|
441
|
-
</dd>
|
|
427
|
+
<dd><p>Key meta directive. See https://www.chordpro.org/chordpro/directives-key/</p></dd>
|
|
442
428
|
<dt><a href="#_KEY">_KEY</a> : <code>string</code></dt>
|
|
443
|
-
<dd><p>
|
|
444
|
-
</dd>
|
|
429
|
+
<dd><p>Lyricist meta directive. See https://www.chordpro.org/chordpro/directives-lyricist/</p></dd>
|
|
445
430
|
<dt><a href="#LYRICIST">LYRICIST</a> : <code>string</code></dt>
|
|
446
|
-
<dd><p>
|
|
447
|
-
</dd>
|
|
431
|
+
<dd><p>Start of chorus directive. See https://www.chordpro.org/chordpro/directives-env_chorus/</p></dd>
|
|
448
432
|
<dt><a href="#START_OF_CHORUS">START_OF_CHORUS</a> : <code>string</code></dt>
|
|
449
|
-
<dd><p>Start of
|
|
450
|
-
</dd>
|
|
433
|
+
<dd><p>Start of tab directive. See https://www.chordpro.org/chordpro/directives-env_tab/</p></dd>
|
|
451
434
|
<dt><a href="#START_OF_TAB">START_OF_TAB</a> : <code>string</code></dt>
|
|
452
|
-
<dd><p>Start of
|
|
453
|
-
</dd>
|
|
435
|
+
<dd><p>Start of verse directive. See https://www.chordpro.org/chordpro/directives-env_verse/</p></dd>
|
|
454
436
|
<dt><a href="#START_OF_VERSE">START_OF_VERSE</a> : <code>string</code></dt>
|
|
455
|
-
<dd><p>
|
|
456
|
-
</dd>
|
|
437
|
+
<dd><p>Subtitle meta directive. See https://www.chordpro.org/chordpro/directives-subtitle/</p></dd>
|
|
457
438
|
<dt><a href="#SUBTITLE">SUBTITLE</a> : <code>string</code></dt>
|
|
458
|
-
<dd><p>
|
|
459
|
-
</dd>
|
|
439
|
+
<dd><p>Tempo meta directive. See https://www.chordpro.org/chordpro/directives-tempo/</p></dd>
|
|
460
440
|
<dt><a href="#TEMPO">TEMPO</a> : <code>string</code></dt>
|
|
461
|
-
<dd><p>
|
|
462
|
-
</dd>
|
|
441
|
+
<dd><p>Time meta directive. See https://www.chordpro.org/chordpro/directives-time/</p></dd>
|
|
463
442
|
<dt><a href="#TIME">TIME</a> : <code>string</code></dt>
|
|
464
|
-
<dd><p>
|
|
465
|
-
</dd>
|
|
443
|
+
<dd><p>Title meta directive. See https://www.chordpro.org/chordpro/directives-title/</p></dd>
|
|
466
444
|
<dt><a href="#TITLE">TITLE</a> : <code>string</code></dt>
|
|
467
|
-
<dd><p>
|
|
468
|
-
</dd>
|
|
445
|
+
<dd><p>Transpose meta directive. See: https://www.chordpro.org/chordpro/directives-transpose/</p></dd>
|
|
469
446
|
<dt><a href="#TRANSPOSE">TRANSPOSE</a> : <code>string</code></dt>
|
|
470
|
-
<dd><p>
|
|
471
|
-
</dd>
|
|
447
|
+
<dd><p>New Key meta directive. See: https://github.com/PraiseCharts/ChordChartJS/issues/53</p></dd>
|
|
472
448
|
<dt><a href="#NEW_KEY">NEW_KEY</a> : <code>string</code></dt>
|
|
473
|
-
<dd><p>
|
|
474
|
-
</
|
|
475
|
-
<
|
|
476
|
-
|
|
477
|
-
|
|
449
|
+
<dd><p>Year meta directive. See https://www.chordpro.org/chordpro/directives-year/</p></dd>
|
|
450
|
+
<dt><a href="#defaultCss">defaultCss</a> ⇒ <code>string</code></dt>
|
|
451
|
+
<dd><p>Generates basic CSS, scoped within the provided selector, to use with output generated by [HtmlTableFormatter](#HtmlTableFormatter)</p></dd>
|
|
452
|
+
</dl>
|
|
453
|
+
|
|
454
|
+
## Constants
|
|
455
|
+
|
|
456
|
+
<dl>
|
|
478
457
|
<dt><a href="#defaultCss">defaultCss</a> : <code>Object.<string, Object.<string, string>></code></dt>
|
|
479
458
|
<dd><p>Basic CSS, in object style à la useStyles, to use with output generated by {@link }HtmlTableFormatter}
|
|
480
|
-
For a CSS string see
|
|
481
|
-
</dd>
|
|
459
|
+
For a CSS string see [scopedCss](scopedCss)</p></dd>
|
|
482
460
|
<dt><a href="#VERSE">VERSE</a> : <code>string</code></dt>
|
|
483
|
-
<dd><p>Used to mark a paragraph as verse</p>
|
|
484
|
-
</
|
|
461
|
+
<dd><p>Used to mark a paragraph as verse</p></dd>
|
|
462
|
+
<dt><a href="#VERSE">VERSE</a> : <code>string</code></dt>
|
|
463
|
+
<dd><p>Used to mark a paragraph as chorus</p></dd>
|
|
485
464
|
<dt><a href="#CHORUS">CHORUS</a> : <code>string</code></dt>
|
|
486
|
-
<dd><p>Used to mark a paragraph as
|
|
487
|
-
</dd>
|
|
465
|
+
<dd><p>Used to mark a paragraph as not containing a line marked with a type</p></dd>
|
|
488
466
|
<dt><a href="#NONE">NONE</a> : <code>string</code></dt>
|
|
489
|
-
<dd><p>Used to mark a paragraph as
|
|
490
|
-
</dd>
|
|
467
|
+
<dd><p>Used to mark a paragraph as containing lines with both verse and chorus type</p></dd>
|
|
491
468
|
<dt><a href="#INDETERMINATE">INDETERMINATE</a> : <code>string</code></dt>
|
|
492
|
-
<dd><p>Used to mark a paragraph as
|
|
493
|
-
</dd>
|
|
494
|
-
<dt><a href="#TAB">TAB</a> : <code>string</code></dt>
|
|
495
|
-
<dd><p>Used to mark a paragraph as tab</p>
|
|
496
|
-
</dd>
|
|
469
|
+
<dd><p>Used to mark a paragraph as tab</p></dd>
|
|
497
470
|
</dl>
|
|
498
471
|
|
|
499
472
|
## Functions
|
|
500
473
|
|
|
501
474
|
<dl>
|
|
502
|
-
<dt><a href="#scopedCss">scopedCss(scope)</a> ⇒ <code>string</code></dt>
|
|
503
|
-
<dd><p>Generates basic CSS, scoped within the provided selector, to use with output generated by <a href="#HtmlTableFormatter">HtmlTableFormatter</a></p>
|
|
504
|
-
</dd>
|
|
505
475
|
<dt><del><a href="#parseChord">parseChord(chordString)</a> ⇒ <code>null</code> | <code><a href="#Chord">Chord</a></code></del></dt>
|
|
506
|
-
<dd><p>Tries to parse a chord string into a chord</p>
|
|
507
|
-
</
|
|
476
|
+
<dd><p>Tries to parse a chord string into a chord</p></dd>
|
|
477
|
+
<dt><a href="#getCapos">getCapos(key)</a> ⇒ <code>Object.<string, string></code></dt>
|
|
478
|
+
<dd><p>Returns applicable capos for the provided key</p></dd>
|
|
479
|
+
<dt><a href="#getKeys">getKeys(key)</a> ⇒ <code>Array.<string></code></dt>
|
|
480
|
+
<dd><p>Returns applicable keys to transpose to from the provided key</p></dd>
|
|
508
481
|
</dl>
|
|
509
482
|
|
|
510
483
|
<a name="ChordLyricsPair"></a>
|
|
511
484
|
|
|
512
485
|
## ChordLyricsPair
|
|
513
|
-
Represents a chord with the corresponding (partial) lyrics
|
|
486
|
+
<p>Represents a chord with the corresponding (partial) lyrics</p>
|
|
514
487
|
|
|
515
488
|
**Kind**: global class
|
|
516
489
|
|
|
@@ -524,42 +497,42 @@ Represents a chord with the corresponding (partial) lyrics
|
|
|
524
497
|
<a name="new_ChordLyricsPair_new"></a>
|
|
525
498
|
|
|
526
499
|
### new ChordLyricsPair(chords, lyrics)
|
|
527
|
-
Initialises a ChordLyricsPair
|
|
500
|
+
<p>Initialises a ChordLyricsPair</p>
|
|
528
501
|
|
|
529
502
|
|
|
530
503
|
| Param | Type | Description |
|
|
531
504
|
| --- | --- | --- |
|
|
532
|
-
| chords | <code>string</code> | The chords |
|
|
533
|
-
| lyrics | <code>string</code> | The lyrics |
|
|
505
|
+
| chords | <code>string</code> | <p>The chords</p> |
|
|
506
|
+
| lyrics | <code>string</code> | <p>The lyrics</p> |
|
|
534
507
|
|
|
535
508
|
<a name="ChordLyricsPair+chords"></a>
|
|
536
509
|
|
|
537
510
|
### chordLyricsPair.chords : <code>string</code>
|
|
538
|
-
The chords
|
|
511
|
+
<p>The chords</p>
|
|
539
512
|
|
|
540
513
|
**Kind**: instance property of [<code>ChordLyricsPair</code>](#ChordLyricsPair)
|
|
541
514
|
<a name="ChordLyricsPair+lyrics"></a>
|
|
542
515
|
|
|
543
516
|
### chordLyricsPair.lyrics : <code>string</code>
|
|
544
|
-
The lyrics
|
|
517
|
+
<p>The lyrics</p>
|
|
545
518
|
|
|
546
519
|
**Kind**: instance property of [<code>ChordLyricsPair</code>](#ChordLyricsPair)
|
|
547
520
|
<a name="ChordLyricsPair+isRenderable"></a>
|
|
548
521
|
|
|
549
522
|
### chordLyricsPair.isRenderable() ⇒ <code>boolean</code>
|
|
550
|
-
Indicates whether a ChordLyricsPair should be visible in a formatted chord sheet (except for ChordPro sheets)
|
|
523
|
+
<p>Indicates whether a ChordLyricsPair should be visible in a formatted chord sheet (except for ChordPro sheets)</p>
|
|
551
524
|
|
|
552
525
|
**Kind**: instance method of [<code>ChordLyricsPair</code>](#ChordLyricsPair)
|
|
553
526
|
<a name="ChordLyricsPair+clone"></a>
|
|
554
527
|
|
|
555
528
|
### chordLyricsPair.clone() ⇒ [<code>ChordLyricsPair</code>](#ChordLyricsPair)
|
|
556
|
-
Returns a deep copy of the ChordLyricsPair, useful when programmatically transforming a song
|
|
529
|
+
<p>Returns a deep copy of the ChordLyricsPair, useful when programmatically transforming a song</p>
|
|
557
530
|
|
|
558
531
|
**Kind**: instance method of [<code>ChordLyricsPair</code>](#ChordLyricsPair)
|
|
559
532
|
<a name="Comment"></a>
|
|
560
533
|
|
|
561
534
|
## Comment
|
|
562
|
-
Represents a comment. See https://www.chordpro.org/chordpro/chordpro-file-format-specification/#overview
|
|
535
|
+
<p>Represents a comment. See https://www.chordpro.org/chordpro/chordpro-file-format-specification/#overview</p>
|
|
563
536
|
|
|
564
537
|
**Kind**: global class
|
|
565
538
|
|
|
@@ -570,104 +543,22 @@ Represents a comment. See https://www.chordpro.org/chordpro/chordpro-file-format
|
|
|
570
543
|
<a name="Comment+isRenderable"></a>
|
|
571
544
|
|
|
572
545
|
### comment.isRenderable() ⇒ <code>boolean</code>
|
|
573
|
-
Indicates whether a Comment should be visible in a formatted chord sheet (except for ChordPro sheets)
|
|
546
|
+
<p>Indicates whether a Comment should be visible in a formatted chord sheet (except for ChordPro sheets)</p>
|
|
574
547
|
|
|
575
548
|
**Kind**: instance method of [<code>Comment</code>](#Comment)
|
|
576
549
|
<a name="Comment+clone"></a>
|
|
577
550
|
|
|
578
551
|
### comment.clone() ⇒ [<code>Comment</code>](#Comment)
|
|
579
|
-
Returns a deep copy of the Comment, useful when programmatically transforming a song
|
|
552
|
+
<p>Returns a deep copy of the Comment, useful when programmatically transforming a song</p>
|
|
580
553
|
|
|
581
554
|
**Kind**: instance method of [<code>Comment</code>](#Comment)
|
|
582
|
-
<a name="Line"></a>
|
|
583
|
-
|
|
584
|
-
## Line
|
|
585
|
-
Represents a line in a chord sheet, consisting of items of type ChordLyricsPair or Tag
|
|
586
|
-
|
|
587
|
-
**Kind**: global class
|
|
588
|
-
|
|
589
|
-
* [Line](#Line)
|
|
590
|
-
* [.items](#Line+items) : <code>Array.<(ChordLyricsPair\|Tag\|Comment)></code>
|
|
591
|
-
* [.type](#Line+type) : <code>string</code>
|
|
592
|
-
* [.isEmpty()](#Line+isEmpty) ⇒ <code>boolean</code>
|
|
593
|
-
* [.addItem(item)](#Line+addItem)
|
|
594
|
-
* [.hasRenderableItems()](#Line+hasRenderableItems) ⇒ <code>boolean</code>
|
|
595
|
-
* [.clone()](#Line+clone) ⇒ [<code>Line</code>](#Line)
|
|
596
|
-
* [.isVerse()](#Line+isVerse) ⇒ <code>boolean</code>
|
|
597
|
-
* [.isChorus()](#Line+isChorus) ⇒ <code>boolean</code>
|
|
598
|
-
* ~~[.hasContent()](#Line+hasContent) ⇒ <code>boolean</code>~~
|
|
599
|
-
|
|
600
|
-
<a name="Line+items"></a>
|
|
601
|
-
|
|
602
|
-
### line.items : <code>Array.<(ChordLyricsPair\|Tag\|Comment)></code>
|
|
603
|
-
The items ([ChordLyricsPair](#ChordLyricsPair) or [Tag](#Tag) or [Comment](#Comment)) of which the line consists
|
|
604
|
-
|
|
605
|
-
**Kind**: instance property of [<code>Line</code>](#Line)
|
|
606
|
-
<a name="Line+type"></a>
|
|
607
|
-
|
|
608
|
-
### line.type : <code>string</code>
|
|
609
|
-
The line type, This is set by the ChordProParser when it read tags like {start_of_chorus} or {start_of_verse}
|
|
610
|
-
Values can be [VERSE](#VERSE), [CHORUS](#CHORUS) or [NONE](#NONE)
|
|
611
|
-
|
|
612
|
-
**Kind**: instance property of [<code>Line</code>](#Line)
|
|
613
|
-
<a name="Line+isEmpty"></a>
|
|
614
|
-
|
|
615
|
-
### line.isEmpty() ⇒ <code>boolean</code>
|
|
616
|
-
Indicates whether the line contains any items
|
|
617
|
-
|
|
618
|
-
**Kind**: instance method of [<code>Line</code>](#Line)
|
|
619
|
-
<a name="Line+addItem"></a>
|
|
620
|
-
|
|
621
|
-
### line.addItem(item)
|
|
622
|
-
Adds an item ([ChordLyricsPair](#ChordLyricsPair) or [Tag](#Tag)) to the line
|
|
623
|
-
|
|
624
|
-
**Kind**: instance method of [<code>Line</code>](#Line)
|
|
625
|
-
|
|
626
|
-
| Param | Type | Description |
|
|
627
|
-
| --- | --- | --- |
|
|
628
|
-
| item | [<code>ChordLyricsPair</code>](#ChordLyricsPair) \| [<code>Tag</code>](#Tag) | The item to be added |
|
|
629
|
-
|
|
630
|
-
<a name="Line+hasRenderableItems"></a>
|
|
631
|
-
|
|
632
|
-
### line.hasRenderableItems() ⇒ <code>boolean</code>
|
|
633
|
-
Indicates whether the line contains items that are renderable
|
|
634
|
-
|
|
635
|
-
**Kind**: instance method of [<code>Line</code>](#Line)
|
|
636
|
-
<a name="Line+clone"></a>
|
|
637
|
-
|
|
638
|
-
### line.clone() ⇒ [<code>Line</code>](#Line)
|
|
639
|
-
Returns a deep copy of the line and all of its items
|
|
640
|
-
|
|
641
|
-
**Kind**: instance method of [<code>Line</code>](#Line)
|
|
642
|
-
<a name="Line+isVerse"></a>
|
|
643
|
-
|
|
644
|
-
### line.isVerse() ⇒ <code>boolean</code>
|
|
645
|
-
Indicates whether the line type is [VERSE](#VERSE)
|
|
646
|
-
|
|
647
|
-
**Kind**: instance method of [<code>Line</code>](#Line)
|
|
648
|
-
<a name="Line+isChorus"></a>
|
|
649
|
-
|
|
650
|
-
### line.isChorus() ⇒ <code>boolean</code>
|
|
651
|
-
Indicates whether the line type is [CHORUS](#CHORUS)
|
|
652
|
-
|
|
653
|
-
**Kind**: instance method of [<code>Line</code>](#Line)
|
|
654
|
-
<a name="Line+hasContent"></a>
|
|
655
|
-
|
|
656
|
-
### ~~line.hasContent() ⇒ <code>boolean</code>~~
|
|
657
|
-
***Deprecated***
|
|
658
|
-
|
|
659
|
-
Indicates whether the line contains items that are renderable. Please use [hasRenderableItems](hasRenderableItems)
|
|
660
|
-
|
|
661
|
-
**Kind**: instance method of [<code>Line</code>](#Line)
|
|
662
555
|
<a name="Metadata"></a>
|
|
663
556
|
|
|
664
557
|
## Metadata
|
|
665
|
-
Stores song metadata. Properties can be accessed using the get() method
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
See [get](#Metadata+get)
|
|
558
|
+
<p>Stores song metadata. Properties can be accessed using the get() method:</p>
|
|
559
|
+
<p>const metadata = new Metadata({ author: 'John' });
|
|
560
|
+
metadata.get('author') // => 'John'</p>
|
|
561
|
+
<p>See [get](#Metadata+get)</p>
|
|
671
562
|
|
|
672
563
|
**Kind**: global class
|
|
673
564
|
|
|
@@ -678,184 +569,209 @@ See [get](#Metadata+get)
|
|
|
678
569
|
<a name="Metadata+get"></a>
|
|
679
570
|
|
|
680
571
|
### metadata.get(prop) ⇒ <code>Array.<String></code> \| <code>String</code>
|
|
681
|
-
Reads a metadata value by key. This method supports simple value lookup, as fetching single array values
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
metadata.get('
|
|
689
|
-
|
|
690
|
-
metadata
|
|
691
|
-
metadata.get('author
|
|
692
|
-
|
|
693
|
-
Using a negative index will start counting at the end of the list:
|
|
694
|
-
|
|
695
|
-
const metadata = new Metadata({ lyricist: 'Pete', author: ['John', 'Mary'] });
|
|
696
|
-
metadata.get('author.-1') // => 'Mary'
|
|
697
|
-
metadata.get('author.-2') // => 'John'
|
|
572
|
+
<p>Reads a metadata value by key. This method supports simple value lookup, as fetching single array values.</p>
|
|
573
|
+
<p>This method deprecates direct property access, eg: metadata['author']</p>
|
|
574
|
+
<p>Examples:</p>
|
|
575
|
+
<p>const metadata = new Metadata({ lyricist: 'Pete', author: ['John', 'Mary'] });
|
|
576
|
+
metadata.get('lyricist') // => 'Pete'
|
|
577
|
+
metadata.get('author') // => ['John', 'Mary']
|
|
578
|
+
metadata.get('author.1') // => 'John'
|
|
579
|
+
metadata.get('author.2') // => 'Mary'</p>
|
|
580
|
+
<p>Using a negative index will start counting at the end of the list:</p>
|
|
581
|
+
<p>const metadata = new Metadata({ lyricist: 'Pete', author: ['John', 'Mary'] });
|
|
582
|
+
metadata.get('author.-1') // => 'Mary'
|
|
583
|
+
metadata.get('author.-2') // => 'John'</p>
|
|
698
584
|
|
|
699
585
|
**Kind**: instance method of [<code>Metadata</code>](#Metadata)
|
|
700
|
-
**Returns**: <code>Array.<String></code> \| <code>String</code> - the metadata value(s). If there is only one value, it will return a String,
|
|
701
|
-
else it returns an array of strings
|
|
586
|
+
**Returns**: <code>Array.<String></code> \| <code>String</code> - <p>the metadata value(s). If there is only one value, it will return a String,
|
|
587
|
+
else it returns an array of strings.</p>
|
|
702
588
|
|
|
703
589
|
| Param | Description |
|
|
704
590
|
| --- | --- |
|
|
705
|
-
| prop | the property name |
|
|
591
|
+
| prop | <p>the property name</p> |
|
|
706
592
|
|
|
707
593
|
<a name="Metadata+clone"></a>
|
|
708
594
|
|
|
709
595
|
### metadata.clone() ⇒ [<code>Metadata</code>](#Metadata)
|
|
710
|
-
Returns a deep clone of this Metadata object
|
|
596
|
+
<p>Returns a deep clone of this Metadata object</p>
|
|
711
597
|
|
|
712
598
|
**Kind**: instance method of [<code>Metadata</code>](#Metadata)
|
|
713
|
-
**Returns**: [<code>Metadata</code>](#Metadata) - the cloned Metadata object
|
|
599
|
+
**Returns**: [<code>Metadata</code>](#Metadata) - <p>the cloned Metadata object</p>
|
|
714
600
|
<a name="Paragraph"></a>
|
|
715
601
|
|
|
716
602
|
## Paragraph
|
|
717
|
-
Represents a paragraph of lines in a chord sheet
|
|
603
|
+
<p>Represents a paragraph of lines in a chord sheet</p>
|
|
718
604
|
|
|
719
605
|
**Kind**: global class
|
|
720
606
|
|
|
721
607
|
* [Paragraph](#Paragraph)
|
|
722
|
-
* [.lines](#Paragraph+lines) : [<code>Array.<Line></code>](#Line)
|
|
723
608
|
* [.type](#Paragraph+type) ⇒ <code>string</code>
|
|
724
609
|
* [.hasRenderableItems()](#Paragraph+hasRenderableItems) ⇒ <code>boolean</code>
|
|
725
610
|
|
|
726
|
-
<a name="Paragraph+lines"></a>
|
|
727
|
-
|
|
728
|
-
### paragraph.lines : [<code>Array.<Line></code>](#Line)
|
|
729
|
-
The [Line](#Line) items of which the paragraph consists
|
|
730
|
-
|
|
731
|
-
**Kind**: instance property of [<code>Paragraph</code>](#Paragraph)
|
|
732
611
|
<a name="Paragraph+type"></a>
|
|
733
612
|
|
|
734
613
|
### paragraph.type ⇒ <code>string</code>
|
|
735
|
-
Tries to determine the common type for all lines. If the types for all lines are equal, it returns that type.
|
|
736
|
-
If not, it returns [INDETERMINATE](#INDETERMINATE)
|
|
614
|
+
<p>Tries to determine the common type for all lines. If the types for all lines are equal, it returns that type.
|
|
615
|
+
If not, it returns [INDETERMINATE](#INDETERMINATE)</p>
|
|
737
616
|
|
|
738
617
|
**Kind**: instance property of [<code>Paragraph</code>](#Paragraph)
|
|
739
618
|
<a name="Paragraph+hasRenderableItems"></a>
|
|
740
619
|
|
|
741
620
|
### paragraph.hasRenderableItems() ⇒ <code>boolean</code>
|
|
742
|
-
Indicates whether the paragraph contains lines with renderable items
|
|
621
|
+
<p>Indicates whether the paragraph contains lines with renderable items.</p>
|
|
743
622
|
|
|
744
623
|
**Kind**: instance method of [<code>Paragraph</code>](#Paragraph)
|
|
745
624
|
**See**: [Line.hasRenderableItems](Line.hasRenderableItems)
|
|
746
625
|
<a name="Song"></a>
|
|
747
626
|
|
|
748
627
|
## Song
|
|
749
|
-
Represents a song in a chord sheet. Currently a chord sheet can only have one song
|
|
628
|
+
<p>Represents a song in a chord sheet. Currently a chord sheet can only have one song.</p>
|
|
750
629
|
|
|
751
630
|
**Kind**: global class
|
|
752
631
|
|
|
753
632
|
* [Song](#Song)
|
|
754
633
|
* [new Song(metadata)](#new_Song_new)
|
|
755
|
-
* [.
|
|
756
|
-
* [.paragraphs](#Song+paragraphs) : [<code>Array.<Paragraph></code>](#Paragraph)
|
|
757
|
-
* [.metadata](#Song+metadata) : [<code>Metadata</code>](#Metadata)
|
|
758
|
-
* [.bodyLines](#Song+bodyLines) ⇒ [<code>Array.<Line></code>](#Line)
|
|
634
|
+
* [.bodyLines](#Song+bodyLines) ⇒ <code>Array.<Line></code>
|
|
759
635
|
* [.bodyParagraphs](#Song+bodyParagraphs) ⇒ [<code>Array.<Paragraph></code>](#Paragraph)
|
|
636
|
+
* [.paragraphs](#Song+paragraphs) : [<code>Array.<Paragraph></code>](#Paragraph)
|
|
760
637
|
* ~~[.metaData](#Song+metaData) ⇒~~
|
|
761
638
|
* [.clone()](#Song+clone) ⇒ [<code>Song</code>](#Song)
|
|
762
639
|
* [.setCapo(capo)](#Song+setCapo) ⇒ [<code>Song</code>](#Song)
|
|
763
640
|
* [.setKey(key)](#Song+setKey) ⇒ [<code>Song</code>](#Song)
|
|
641
|
+
* [.mapItems(func)](#Song+mapItems) ⇒ [<code>Song</code>](#Song)
|
|
642
|
+
* [.mapLines(func)](#Song+mapLines) ⇒ [<code>Song</code>](#Song)
|
|
764
643
|
|
|
765
644
|
<a name="new_Song_new"></a>
|
|
766
645
|
|
|
767
646
|
### new Song(metadata)
|
|
768
|
-
Creates a new {Song} instance
|
|
647
|
+
<p>Creates a new {Song} instance</p>
|
|
769
648
|
|
|
770
649
|
|
|
771
650
|
| Param | Type | Description |
|
|
772
651
|
| --- | --- | --- |
|
|
773
|
-
| metadata | <code>Object</code> \| [<code>Metadata</code>](#Metadata) | predefined metadata |
|
|
774
|
-
|
|
775
|
-
<a name="Song+lines"></a>
|
|
776
|
-
|
|
777
|
-
### song.lines : [<code>Array.<Line></code>](#Line)
|
|
778
|
-
The [Line](#Line) items of which the song consists
|
|
652
|
+
| metadata | <code>Object</code> \| [<code>Metadata</code>](#Metadata) | <p>predefined metadata</p> |
|
|
779
653
|
|
|
780
|
-
**Kind**: instance property of [<code>Song</code>](#Song)
|
|
781
|
-
<a name="Song+paragraphs"></a>
|
|
782
|
-
|
|
783
|
-
### song.paragraphs : [<code>Array.<Paragraph></code>](#Paragraph)
|
|
784
|
-
The [Paragraph](#Paragraph) items of which the song consists
|
|
785
|
-
|
|
786
|
-
**Kind**: instance property of [<code>Song</code>](#Song)
|
|
787
|
-
<a name="Song+metadata"></a>
|
|
788
|
-
|
|
789
|
-
### song.metadata : [<code>Metadata</code>](#Metadata)
|
|
790
|
-
The song's metadata. When there is only one value for an entry, the value is a string. Else, the value is
|
|
791
|
-
an array containing all unique values for the entry.
|
|
792
|
-
|
|
793
|
-
**Kind**: instance property of [<code>Song</code>](#Song)
|
|
794
654
|
<a name="Song+bodyLines"></a>
|
|
795
655
|
|
|
796
|
-
### song.bodyLines ⇒
|
|
797
|
-
Returns the song lines, skipping the leading empty lines (empty as in not rendering any content). This is useful
|
|
798
|
-
if you want to skip the
|
|
656
|
+
### song.bodyLines ⇒ <code>Array.<Line></code>
|
|
657
|
+
<p>Returns the song lines, skipping the leading empty lines (empty as in not rendering any content). This is useful
|
|
658
|
+
if you want to skip the "header lines": the lines that only contain meta data.</p>
|
|
799
659
|
|
|
800
660
|
**Kind**: instance property of [<code>Song</code>](#Song)
|
|
801
|
-
**Returns**:
|
|
661
|
+
**Returns**: <code>Array.<Line></code> - <p>The song body lines</p>
|
|
802
662
|
<a name="Song+bodyParagraphs"></a>
|
|
803
663
|
|
|
804
664
|
### song.bodyParagraphs ⇒ [<code>Array.<Paragraph></code>](#Paragraph)
|
|
805
|
-
Returns the song paragraphs, skipping the paragraphs that only contain empty lines
|
|
806
|
-
(empty as in not rendering any content)
|
|
665
|
+
<p>Returns the song paragraphs, skipping the paragraphs that only contain empty lines
|
|
666
|
+
(empty as in not rendering any content)</p>
|
|
807
667
|
|
|
808
668
|
**Kind**: instance property of [<code>Song</code>](#Song)
|
|
809
669
|
**See**: [bodyLines](bodyLines)
|
|
670
|
+
<a name="Song+paragraphs"></a>
|
|
671
|
+
|
|
672
|
+
### song.paragraphs : [<code>Array.<Paragraph></code>](#Paragraph)
|
|
673
|
+
<p>The [Paragraph](#Paragraph) items of which the song consists</p>
|
|
674
|
+
|
|
675
|
+
**Kind**: instance property of [<code>Song</code>](#Song)
|
|
810
676
|
<a name="Song+metaData"></a>
|
|
811
677
|
|
|
812
678
|
### ~~song.metaData ⇒~~
|
|
813
679
|
***Deprecated***
|
|
814
680
|
|
|
815
|
-
The song's metadata. Please use [metadata](metadata) instead
|
|
681
|
+
<p>The song's metadata. Please use [metadata](metadata) instead.</p>
|
|
816
682
|
|
|
817
683
|
**Kind**: instance property of [<code>Song</code>](#Song)
|
|
818
|
-
**Returns**: [Metadata](#Metadata) The metadata
|
|
684
|
+
**Returns**: <p>[Metadata](#Metadata) The metadata</p>
|
|
819
685
|
<a name="Song+clone"></a>
|
|
820
686
|
|
|
821
687
|
### song.clone() ⇒ [<code>Song</code>](#Song)
|
|
822
|
-
Returns a deep clone of the song
|
|
688
|
+
<p>Returns a deep clone of the song</p>
|
|
823
689
|
|
|
824
690
|
**Kind**: instance method of [<code>Song</code>](#Song)
|
|
825
|
-
**Returns**: [<code>Song</code>](#Song) - The cloned song
|
|
691
|
+
**Returns**: [<code>Song</code>](#Song) - <p>The cloned song</p>
|
|
826
692
|
<a name="Song+setCapo"></a>
|
|
827
693
|
|
|
828
694
|
### song.setCapo(capo) ⇒ [<code>Song</code>](#Song)
|
|
829
|
-
Returns a copy of the song with the capo value set to the specified capo. It changes
|
|
830
|
-
|
|
831
|
-
|
|
695
|
+
<p>Returns a copy of the song with the capo value set to the specified capo. It changes:</p>
|
|
696
|
+
<ul>
|
|
697
|
+
<li>the value for <code>capo</code> in the <code>metadata</code> set</li>
|
|
698
|
+
<li>any existing <code>capo</code> directive)</li>
|
|
699
|
+
</ul>
|
|
832
700
|
|
|
833
701
|
**Kind**: instance method of [<code>Song</code>](#Song)
|
|
834
|
-
**Returns**: [<code>Song</code>](#Song) - The changed song
|
|
702
|
+
**Returns**: [<code>Song</code>](#Song) - <p>The changed song</p>
|
|
835
703
|
|
|
836
704
|
| Param | Type | Description |
|
|
837
705
|
| --- | --- | --- |
|
|
838
|
-
| capo | <code>number</code> \| <code>null</code> | the capo. Passing
|
|
706
|
+
| capo | <code>number</code> \| <code>null</code> | <p>the capo. Passing <code>null</code> will:</p> <ul> <li>remove the current key from <code>metadata</code></li> <li>remove any <code>capo</code> directive</li> </ul> |
|
|
839
707
|
|
|
840
708
|
<a name="Song+setKey"></a>
|
|
841
709
|
|
|
842
710
|
### song.setKey(key) ⇒ [<code>Song</code>](#Song)
|
|
843
|
-
Returns a copy of the song with the key set to the specified key. It changes
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
711
|
+
<p>Returns a copy of the song with the key set to the specified key. It changes:</p>
|
|
712
|
+
<ul>
|
|
713
|
+
<li>the value for <code>key</code> in the <code>metadata</code> set</li>
|
|
714
|
+
<li>any existing <code>key</code> directive</li>
|
|
715
|
+
<li>all chords, those are transposed according to the distance between the current and the new key</li>
|
|
716
|
+
</ul>
|
|
847
717
|
|
|
848
718
|
**Kind**: instance method of [<code>Song</code>](#Song)
|
|
849
|
-
**Returns**: [<code>Song</code>](#Song) - The changed song
|
|
719
|
+
**Returns**: [<code>Song</code>](#Song) - <p>The changed song</p>
|
|
850
720
|
|
|
851
721
|
| Param | Type | Description |
|
|
852
722
|
| --- | --- | --- |
|
|
853
|
-
| key | <code>string</code> | The new key
|
|
723
|
+
| key | <code>string</code> | <p>The new key.</p> |
|
|
724
|
+
|
|
725
|
+
<a name="Song+mapItems"></a>
|
|
726
|
+
|
|
727
|
+
### song.mapItems(func) ⇒ [<code>Song</code>](#Song)
|
|
728
|
+
<p>Change the song contents inline. Return a new [Item](Item) to replace it. Return <code>null</code> to remove it.</p>
|
|
729
|
+
|
|
730
|
+
**Kind**: instance method of [<code>Song</code>](#Song)
|
|
731
|
+
**Returns**: [<code>Song</code>](#Song) - <p>the changed song</p>
|
|
854
732
|
|
|
733
|
+
| Param | Type | Description |
|
|
734
|
+
| --- | --- | --- |
|
|
735
|
+
| func | <code>MapItemsCallback</code> | <p>the callback function</p> |
|
|
736
|
+
|
|
737
|
+
**Example**
|
|
738
|
+
```js
|
|
739
|
+
// transpose all chords:
|
|
740
|
+
song.mapItems((item) => {
|
|
741
|
+
if (item instanceof ChordLyricsPair) {
|
|
742
|
+
return item.transpose(2, 'D');
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
return item;
|
|
746
|
+
});
|
|
747
|
+
```
|
|
748
|
+
<a name="Song+mapLines"></a>
|
|
749
|
+
|
|
750
|
+
### song.mapLines(func) ⇒ [<code>Song</code>](#Song)
|
|
751
|
+
<p>Change the song contents inline. Return a new [Line](Line) to replace it. Return <code>null</code> to remove it.</p>
|
|
752
|
+
|
|
753
|
+
**Kind**: instance method of [<code>Song</code>](#Song)
|
|
754
|
+
**Returns**: [<code>Song</code>](#Song) - <p>the changed song</p>
|
|
755
|
+
|
|
756
|
+
| Param | Type | Description |
|
|
757
|
+
| --- | --- | --- |
|
|
758
|
+
| func | <code>MapLinesCallback</code> | <p>the callback function</p> |
|
|
759
|
+
|
|
760
|
+
**Example**
|
|
761
|
+
```js
|
|
762
|
+
// remove lines with only Tags:
|
|
763
|
+
song.mapLines((line) => {
|
|
764
|
+
if (line.items.every(item => item instanceof Tag)) {
|
|
765
|
+
return null;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
return line;
|
|
769
|
+
});
|
|
770
|
+
```
|
|
855
771
|
<a name="Tag"></a>
|
|
856
772
|
|
|
857
773
|
## Tag
|
|
858
|
-
Represents a tag/directive. See https://www.chordpro.org/chordpro/chordpro-directives
|
|
774
|
+
<p>Represents a tag/directive. See https://www.chordpro.org/chordpro/chordpro-directives/</p>
|
|
859
775
|
|
|
860
776
|
**Kind**: global class
|
|
861
777
|
|
|
@@ -871,84 +787,87 @@ Represents a tag/directive. See https://www.chordpro.org/chordpro/chordpro-direc
|
|
|
871
787
|
<a name="Tag+name"></a>
|
|
872
788
|
|
|
873
789
|
### tag.name : <code>string</code>
|
|
874
|
-
The tag full name. When the original tag used the short name,
|
|
790
|
+
<p>The tag full name. When the original tag used the short name, <code>name</code> will return the full name.</p>
|
|
875
791
|
|
|
876
792
|
**Kind**: instance property of [<code>Tag</code>](#Tag)
|
|
877
793
|
<a name="Tag+originalName"></a>
|
|
878
794
|
|
|
879
795
|
### tag.originalName : <code>string</code>
|
|
880
|
-
The original tag name that was used to construct the tag
|
|
796
|
+
<p>The original tag name that was used to construct the tag.</p>
|
|
881
797
|
|
|
882
798
|
**Kind**: instance property of [<code>Tag</code>](#Tag)
|
|
883
799
|
<a name="Tag+value"></a>
|
|
884
800
|
|
|
885
801
|
### tag.value : <code>string</code> \| <code>null</code>
|
|
886
|
-
The tag value
|
|
802
|
+
<p>The tag value</p>
|
|
887
803
|
|
|
888
804
|
**Kind**: instance property of [<code>Tag</code>](#Tag)
|
|
889
805
|
<a name="Tag+hasValue"></a>
|
|
890
806
|
|
|
891
807
|
### tag.hasValue() ⇒ <code>boolean</code>
|
|
892
|
-
Checks whether the tag value is a non-empty string
|
|
808
|
+
<p>Checks whether the tag value is a non-empty string.</p>
|
|
893
809
|
|
|
894
810
|
**Kind**: instance method of [<code>Tag</code>](#Tag)
|
|
895
811
|
<a name="Tag+isRenderable"></a>
|
|
896
812
|
|
|
897
813
|
### tag.isRenderable() ⇒ <code>boolean</code>
|
|
898
|
-
Checks whether the tag is usually rendered inline. It currently only applies to comment tags
|
|
814
|
+
<p>Checks whether the tag is usually rendered inline. It currently only applies to comment tags.</p>
|
|
899
815
|
|
|
900
816
|
**Kind**: instance method of [<code>Tag</code>](#Tag)
|
|
901
817
|
<a name="Tag+isMetaTag"></a>
|
|
902
818
|
|
|
903
819
|
### tag.isMetaTag() ⇒ <code>boolean</code>
|
|
904
|
-
Checks whether the tag is either a standard meta tag or a custom meta directive (
|
|
820
|
+
<p>Checks whether the tag is either a standard meta tag or a custom meta directive (<code>{x_some_name}</code>)</p>
|
|
905
821
|
|
|
906
822
|
**Kind**: instance method of [<code>Tag</code>](#Tag)
|
|
907
823
|
<a name="Tag+clone"></a>
|
|
908
824
|
|
|
909
825
|
### tag.clone() ⇒ [<code>Tag</code>](#Tag)
|
|
910
|
-
Returns a clone of the tag
|
|
826
|
+
<p>Returns a clone of the tag.</p>
|
|
911
827
|
|
|
912
828
|
**Kind**: instance method of [<code>Tag</code>](#Tag)
|
|
913
|
-
**Returns**: [<code>Tag</code>](#Tag) - The cloned tag
|
|
829
|
+
**Returns**: [<code>Tag</code>](#Tag) - <p>The cloned tag</p>
|
|
914
830
|
<a name="ChordProFormatter"></a>
|
|
915
831
|
|
|
916
832
|
## ChordProFormatter
|
|
917
|
-
Formats a song into a ChordPro chord sheet
|
|
833
|
+
<p>Formats a song into a ChordPro chord sheet</p>
|
|
918
834
|
|
|
919
835
|
**Kind**: global class
|
|
836
|
+
<a name="ChordProFormatter+format"></a>
|
|
920
837
|
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
* [.format(song)](#ChordProFormatter+format) ⇒ <code>string</code>
|
|
924
|
-
|
|
925
|
-
<a name="new_ChordProFormatter_new"></a>
|
|
926
|
-
|
|
927
|
-
### new ChordProFormatter(options)
|
|
928
|
-
Instantiate
|
|
838
|
+
### chordProFormatter.format(song) ⇒ <code>string</code>
|
|
839
|
+
<p>Formats a song into a ChordPro chord sheet.</p>
|
|
929
840
|
|
|
841
|
+
**Kind**: instance method of [<code>ChordProFormatter</code>](#ChordProFormatter)
|
|
842
|
+
**Returns**: <code>string</code> - <p>The ChordPro string</p>
|
|
930
843
|
|
|
931
844
|
| Param | Type | Description |
|
|
932
845
|
| --- | --- | --- |
|
|
933
|
-
|
|
|
934
|
-
| options.evaluate | <code>boolean</code> | Whether or not to evaluate meta expressions. For more info about meta expression, see: https://bit.ly/2SC9c2u |
|
|
846
|
+
| song | [<code>Song</code>](#Song) | <p>The song to be formatted</p> |
|
|
935
847
|
|
|
936
|
-
<a name="
|
|
848
|
+
<a name="Formatter"></a>
|
|
937
849
|
|
|
938
|
-
|
|
939
|
-
|
|
850
|
+
## Formatter
|
|
851
|
+
<p>Base class for all formatters, taking care of receiving a configuration wrapping that inside a Configuration object</p>
|
|
940
852
|
|
|
941
|
-
**Kind**:
|
|
942
|
-
|
|
853
|
+
**Kind**: global class
|
|
854
|
+
<a name="new_Formatter_new"></a>
|
|
943
855
|
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
856
|
+
### new Formatter([configuration])
|
|
857
|
+
<p>Instantiate</p>
|
|
858
|
+
|
|
859
|
+
|
|
860
|
+
| Param | Type | Default | Description |
|
|
861
|
+
| --- | --- | --- | --- |
|
|
862
|
+
| [configuration] | <code>Object</code> | <code>{}</code> | <p>options</p> |
|
|
863
|
+
| [configuration.evaluate] | <code>boolean</code> | <code>false</code> | <p>Whether or not to evaluate meta expressions. For more info about meta expressions, see: https://bit.ly/2SC9c2u</p> |
|
|
864
|
+
| [configuration.metadata] | <code>object</code> | <code>{}</code> | |
|
|
865
|
+
| [configuration.metadata.separator] | <code>string</code> | <code>"\", \""</code> | <p>The separator to be used when rendering a metadata value that has multiple values. See: https://bit.ly/2SC9c2u</p> |
|
|
947
866
|
|
|
948
867
|
<a name="HtmlDivFormatter"></a>
|
|
949
868
|
|
|
950
869
|
## HtmlDivFormatter
|
|
951
|
-
Formats a song into HTML. It uses DIVs to align lyrics with chords, which makes it useful for responsive web pages
|
|
870
|
+
<p>Formats a song into HTML. It uses DIVs to align lyrics with chords, which makes it useful for responsive web pages.</p>
|
|
952
871
|
|
|
953
872
|
**Kind**: global class
|
|
954
873
|
|
|
@@ -962,60 +881,57 @@ Formats a song into HTML. It uses DIVs to align lyrics with chords, which makes
|
|
|
962
881
|
<a name="HtmlDivFormatter+format"></a>
|
|
963
882
|
|
|
964
883
|
### htmlDivFormatter.format(song) ⇒ <code>string</code>
|
|
965
|
-
Formats a song into HTML
|
|
884
|
+
<p>Formats a song into HTML.</p>
|
|
966
885
|
|
|
967
886
|
**Kind**: instance method of [<code>HtmlDivFormatter</code>](#HtmlDivFormatter)
|
|
968
|
-
**Returns**: <code>string</code> - The HTML string
|
|
887
|
+
**Returns**: <code>string</code> - <p>The HTML string</p>
|
|
969
888
|
|
|
970
889
|
| Param | Type | Description |
|
|
971
890
|
| --- | --- | --- |
|
|
972
|
-
| song | [<code>Song</code>](#Song) | The song to be formatted |
|
|
891
|
+
| song | [<code>Song</code>](#Song) | <p>The song to be formatted</p> |
|
|
973
892
|
|
|
974
893
|
<a name="HtmlDivFormatter.cssString"></a>
|
|
975
894
|
|
|
976
895
|
### HtmlDivFormatter.cssString(scope) ⇒ <code>string</code>
|
|
977
|
-
Generates basic CSS, optionally scoped within the provided selector, to use with output generated by
|
|
978
|
-
[HtmlDivFormatter](#HtmlDivFormatter)
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
}
|
|
896
|
+
<p>Generates basic CSS, optionally scoped within the provided selector, to use with output generated by
|
|
897
|
+
[HtmlDivFormatter](#HtmlDivFormatter)</p>
|
|
898
|
+
<p>For example, execute cssString('.chordSheetViewer') will result in CSS like:</p>
|
|
899
|
+
<pre><code>.chordSheetViewer .paragraph {
|
|
900
|
+
margin-bottom: 1em;
|
|
901
|
+
}
|
|
902
|
+
</code></pre>
|
|
985
903
|
|
|
986
904
|
**Kind**: static method of [<code>HtmlDivFormatter</code>](#HtmlDivFormatter)
|
|
987
|
-
**Returns**: <code>string</code> - the CSS string
|
|
905
|
+
**Returns**: <code>string</code> - <p>the CSS string</p>
|
|
988
906
|
|
|
989
907
|
| Param | Description |
|
|
990
908
|
| --- | --- |
|
|
991
|
-
| scope | the CSS scope to use, for example
|
|
909
|
+
| scope | <p>the CSS scope to use, for example <code>.chordSheetViewer</code></p> |
|
|
992
910
|
|
|
993
911
|
<a name="HtmlDivFormatter.cssObject"></a>
|
|
994
912
|
|
|
995
913
|
### HtmlDivFormatter.cssObject() ⇒ <code>Object.<string, Object.<string, string>></code>
|
|
996
|
-
Basic CSS, in object style à la useStyles, to use with output generated by [HtmlDivFormatter](#HtmlDivFormatter)
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
For a CSS string see [cssString](cssString)
|
|
914
|
+
<p>Basic CSS, in object style à la useStyles, to use with output generated by [HtmlDivFormatter](#HtmlDivFormatter)</p>
|
|
915
|
+
<p>Example:</p>
|
|
916
|
+
<pre><code>'.paragraph': {
|
|
917
|
+
marginBottom: '1em'
|
|
918
|
+
}
|
|
919
|
+
</code></pre>
|
|
920
|
+
<p>For a CSS string see [cssString](cssString)</p>
|
|
1005
921
|
|
|
1006
922
|
**Kind**: static method of [<code>HtmlDivFormatter</code>](#HtmlDivFormatter)
|
|
1007
|
-
**Returns**: <code>Object.<string, Object.<string, string>></code> - the CSS object
|
|
923
|
+
**Returns**: <code>Object.<string, Object.<string, string>></code> - <p>the CSS object</p>
|
|
1008
924
|
<a name="HtmlFormatter"></a>
|
|
1009
925
|
|
|
1010
926
|
## HtmlFormatter
|
|
1011
|
-
Acts as a base class for HTML formatters, taking care of whitelisting prototype property access
|
|
927
|
+
<p>Acts as a base class for HTML formatters, taking care of whitelisting prototype property access.</p>
|
|
1012
928
|
|
|
1013
929
|
**Kind**: global class
|
|
1014
930
|
<a name="HtmlTableFormatter"></a>
|
|
1015
931
|
|
|
1016
932
|
## HtmlTableFormatter
|
|
1017
|
-
Formats a song into HTML. It uses TABLEs to align lyrics with chords, which makes the HTML for things like
|
|
1018
|
-
PDF conversion
|
|
933
|
+
<p>Formats a song into HTML. It uses TABLEs to align lyrics with chords, which makes the HTML for things like
|
|
934
|
+
PDF conversion.</p>
|
|
1019
935
|
|
|
1020
936
|
**Kind**: global class
|
|
1021
937
|
|
|
@@ -1029,70 +945,68 @@ PDF conversion.
|
|
|
1029
945
|
<a name="HtmlTableFormatter+format"></a>
|
|
1030
946
|
|
|
1031
947
|
### htmlTableFormatter.format(song) ⇒ <code>string</code>
|
|
1032
|
-
Formats a song into HTML
|
|
948
|
+
<p>Formats a song into HTML.</p>
|
|
1033
949
|
|
|
1034
950
|
**Kind**: instance method of [<code>HtmlTableFormatter</code>](#HtmlTableFormatter)
|
|
1035
|
-
**Returns**: <code>string</code> - The HTML string
|
|
951
|
+
**Returns**: <code>string</code> - <p>The HTML string</p>
|
|
1036
952
|
|
|
1037
953
|
| Param | Type | Description |
|
|
1038
954
|
| --- | --- | --- |
|
|
1039
|
-
| song | [<code>Song</code>](#Song) | The song to be formatted |
|
|
955
|
+
| song | [<code>Song</code>](#Song) | <p>The song to be formatted</p> |
|
|
1040
956
|
|
|
1041
957
|
<a name="HtmlTableFormatter.cssString"></a>
|
|
1042
958
|
|
|
1043
959
|
### HtmlTableFormatter.cssString(scope) ⇒ <code>string</code>
|
|
1044
|
-
Generates basic CSS, optionally scoped within the provided selector, to use with output generated by
|
|
1045
|
-
[HtmlTableFormatter](#HtmlTableFormatter)
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
}
|
|
960
|
+
<p>Generates basic CSS, optionally scoped within the provided selector, to use with output generated by
|
|
961
|
+
[HtmlTableFormatter](#HtmlTableFormatter)</p>
|
|
962
|
+
<p>For example, execute cssString('.chordSheetViewer') will result in CSS like:</p>
|
|
963
|
+
<pre><code>.chordSheetViewer .paragraph {
|
|
964
|
+
margin-bottom: 1em;
|
|
965
|
+
}
|
|
966
|
+
</code></pre>
|
|
1052
967
|
|
|
1053
968
|
**Kind**: static method of [<code>HtmlTableFormatter</code>](#HtmlTableFormatter)
|
|
1054
|
-
**Returns**: <code>string</code> - the CSS string
|
|
969
|
+
**Returns**: <code>string</code> - <p>the CSS string</p>
|
|
1055
970
|
|
|
1056
971
|
| Param | Description |
|
|
1057
972
|
| --- | --- |
|
|
1058
|
-
| scope | the CSS scope to use, for example
|
|
973
|
+
| scope | <p>the CSS scope to use, for example <code>.chordSheetViewer</code></p> |
|
|
1059
974
|
|
|
1060
975
|
<a name="HtmlTableFormatter.cssObject"></a>
|
|
1061
976
|
|
|
1062
977
|
### HtmlTableFormatter.cssObject() ⇒ <code>Object.<string, Object.<string, string>></code>
|
|
1063
|
-
Basic CSS, in object style à la useStyles, to use with output generated by [HtmlTableFormatter](#HtmlTableFormatter)
|
|
1064
|
-
For a CSS string see [cssString](cssString)
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
}
|
|
978
|
+
<p>Basic CSS, in object style à la useStyles, to use with output generated by [HtmlTableFormatter](#HtmlTableFormatter)
|
|
979
|
+
For a CSS string see [cssString](cssString)</p>
|
|
980
|
+
<p>Example:</p>
|
|
981
|
+
<pre><code>'.paragraph': {
|
|
982
|
+
marginBottom: '1em'
|
|
983
|
+
}
|
|
984
|
+
</code></pre>
|
|
1071
985
|
|
|
1072
986
|
**Kind**: static method of [<code>HtmlTableFormatter</code>](#HtmlTableFormatter)
|
|
1073
|
-
**Returns**: <code>Object.<string, Object.<string, string>></code> - the CSS object
|
|
987
|
+
**Returns**: <code>Object.<string, Object.<string, string>></code> - <p>the CSS object</p>
|
|
1074
988
|
<a name="TextFormatter"></a>
|
|
1075
989
|
|
|
1076
990
|
## TextFormatter
|
|
1077
|
-
Formats a song into a plain text chord sheet
|
|
991
|
+
<p>Formats a song into a plain text chord sheet</p>
|
|
1078
992
|
|
|
1079
993
|
**Kind**: global class
|
|
1080
994
|
<a name="TextFormatter+format"></a>
|
|
1081
995
|
|
|
1082
996
|
### textFormatter.format(song) ⇒ <code>string</code>
|
|
1083
|
-
Formats a song into a plain text chord sheet
|
|
997
|
+
<p>Formats a song into a plain text chord sheet</p>
|
|
1084
998
|
|
|
1085
999
|
**Kind**: instance method of [<code>TextFormatter</code>](#TextFormatter)
|
|
1086
|
-
**Returns**: <code>string</code> - the chord sheet
|
|
1000
|
+
**Returns**: <code>string</code> - <p>the chord sheet</p>
|
|
1087
1001
|
|
|
1088
1002
|
| Param | Type | Description |
|
|
1089
1003
|
| --- | --- | --- |
|
|
1090
|
-
| song | [<code>Song</code>](#Song) | The song to be formatted |
|
|
1004
|
+
| song | [<code>Song</code>](#Song) | <p>The song to be formatted</p> |
|
|
1091
1005
|
|
|
1092
1006
|
<a name="ChordProParser"></a>
|
|
1093
1007
|
|
|
1094
1008
|
## ChordProParser
|
|
1095
|
-
Parses a ChordPro chord sheet
|
|
1009
|
+
<p>Parses a ChordPro chord sheet</p>
|
|
1096
1010
|
|
|
1097
1011
|
**Kind**: global class
|
|
1098
1012
|
|
|
@@ -1103,120 +1017,95 @@ Parses a ChordPro chord sheet
|
|
|
1103
1017
|
<a name="ChordProParser+warnings"></a>
|
|
1104
1018
|
|
|
1105
1019
|
### chordProParser.warnings : [<code>Array.<ParserWarning></code>](#ParserWarning)
|
|
1106
|
-
All warnings raised during parsing the ChordPro chord sheet
|
|
1020
|
+
<p>All warnings raised during parsing the ChordPro chord sheet</p>
|
|
1107
1021
|
|
|
1108
1022
|
**Kind**: instance property of [<code>ChordProParser</code>](#ChordProParser)
|
|
1109
1023
|
<a name="ChordProParser+parse"></a>
|
|
1110
1024
|
|
|
1111
1025
|
### chordProParser.parse(chordProChordSheet) ⇒ [<code>Song</code>](#Song)
|
|
1112
|
-
Parses a ChordPro chord sheet into a song
|
|
1026
|
+
<p>Parses a ChordPro chord sheet into a song</p>
|
|
1113
1027
|
|
|
1114
1028
|
**Kind**: instance method of [<code>ChordProParser</code>](#ChordProParser)
|
|
1115
|
-
**Returns**: [<code>Song</code>](#Song) - The parsed song
|
|
1029
|
+
**Returns**: [<code>Song</code>](#Song) - <p>The parsed song</p>
|
|
1116
1030
|
|
|
1117
1031
|
| Param | Type | Description |
|
|
1118
1032
|
| --- | --- | --- |
|
|
1119
|
-
| chordProChordSheet | <code>string</code> | the ChordPro chord sheet |
|
|
1033
|
+
| chordProChordSheet | <code>string</code> | <p>the ChordPro chord sheet</p> |
|
|
1120
1034
|
|
|
1121
1035
|
<a name="ChordSheetParser"></a>
|
|
1122
1036
|
|
|
1123
1037
|
## ChordSheetParser
|
|
1124
|
-
Parses a normal chord sheet
|
|
1038
|
+
<p>Parses a normal chord sheet</p>
|
|
1125
1039
|
|
|
1126
1040
|
**Kind**: global class
|
|
1127
1041
|
|
|
1128
1042
|
* [ChordSheetParser](#ChordSheetParser)
|
|
1129
|
-
* [new ChordSheetParser(options)](#new_ChordSheetParser_new)
|
|
1130
|
-
* [.parse(chordSheet, options)](#ChordSheetParser+parse) ⇒ [<code>Song</code>](#Song)
|
|
1043
|
+
* [new ChordSheetParser([options])](#new_ChordSheetParser_new)
|
|
1044
|
+
* [.parse(chordSheet, [options])](#ChordSheetParser+parse) ⇒ [<code>Song</code>](#Song)
|
|
1131
1045
|
|
|
1132
1046
|
<a name="new_ChordSheetParser_new"></a>
|
|
1133
1047
|
|
|
1134
|
-
### new ChordSheetParser(options)
|
|
1135
|
-
Instantiate a chord sheet parser
|
|
1048
|
+
### new ChordSheetParser([options])
|
|
1049
|
+
<p>Instantiate a chord sheet parser</p>
|
|
1136
1050
|
|
|
1137
1051
|
|
|
1138
|
-
| Param | Type | Description |
|
|
1139
|
-
| --- | --- | --- |
|
|
1140
|
-
| options | <code>Object</code> | options |
|
|
1141
|
-
| options.preserveWhitespace | <code>boolean</code> | whether to preserve trailing whitespace for chords |
|
|
1052
|
+
| Param | Type | Default | Description |
|
|
1053
|
+
| --- | --- | --- | --- |
|
|
1054
|
+
| [options] | <code>Object</code> | <code>{}</code> | <p>options</p> |
|
|
1055
|
+
| [options.preserveWhitespace] | <code>boolean</code> | <code>true</code> | <p>whether to preserve trailing whitespace for chords</p> |
|
|
1142
1056
|
|
|
1143
1057
|
<a name="ChordSheetParser+parse"></a>
|
|
1144
1058
|
|
|
1145
|
-
### chordSheetParser.parse(chordSheet, options) ⇒ [<code>Song</code>](#Song)
|
|
1146
|
-
Parses a chord sheet into a song
|
|
1059
|
+
### chordSheetParser.parse(chordSheet, [options]) ⇒ [<code>Song</code>](#Song)
|
|
1060
|
+
<p>Parses a chord sheet into a song</p>
|
|
1147
1061
|
|
|
1148
1062
|
**Kind**: instance method of [<code>ChordSheetParser</code>](#ChordSheetParser)
|
|
1149
|
-
**Returns**: [<code>Song</code>](#Song) - The parsed song
|
|
1063
|
+
**Returns**: [<code>Song</code>](#Song) - <p>The parsed song</p>
|
|
1150
1064
|
|
|
1151
|
-
| Param | Type | Description |
|
|
1152
|
-
| --- | --- | --- |
|
|
1153
|
-
| chordSheet | <code>string</code> | The ChordPro chord sheet |
|
|
1154
|
-
| options | <code>Object</code> | Optional parser options |
|
|
1155
|
-
| options.song | [<code>Song</code>](#Song) | The [Song](#Song) to store the song data in |
|
|
1065
|
+
| Param | Type | Default | Description |
|
|
1066
|
+
| --- | --- | --- | --- |
|
|
1067
|
+
| chordSheet | <code>string</code> | | <p>The ChordPro chord sheet</p> |
|
|
1068
|
+
| [options] | <code>Object</code> | <code>{}</code> | <p>Optional parser options</p> |
|
|
1069
|
+
| [options.song] | [<code>Song</code>](#Song) | <code></code> | <p>The [Song](#Song) to store the song data in</p> |
|
|
1156
1070
|
|
|
1157
1071
|
<a name="ParserWarning"></a>
|
|
1158
1072
|
|
|
1159
1073
|
## ParserWarning
|
|
1160
|
-
Represents a parser warning, currently only used by ChordProParser
|
|
1074
|
+
<p>Represents a parser warning, currently only used by ChordProParser.</p>
|
|
1161
1075
|
|
|
1162
1076
|
**Kind**: global class
|
|
1163
|
-
|
|
1164
|
-
* [ParserWarning](#ParserWarning)
|
|
1165
|
-
* [.message](#ParserWarning+message) : <code>string</code>
|
|
1166
|
-
* [.lineNumber](#ParserWarning+lineNumber) : <code>number</code>
|
|
1167
|
-
* [.column](#ParserWarning+column) : <code>number</code>
|
|
1168
|
-
* [.toString()](#ParserWarning+toString) ⇒ <code>string</code>
|
|
1169
|
-
|
|
1170
|
-
<a name="ParserWarning+message"></a>
|
|
1171
|
-
|
|
1172
|
-
### parserWarning.message : <code>string</code>
|
|
1173
|
-
The warning message
|
|
1174
|
-
|
|
1175
|
-
**Kind**: instance property of [<code>ParserWarning</code>](#ParserWarning)
|
|
1176
|
-
<a name="ParserWarning+lineNumber"></a>
|
|
1177
|
-
|
|
1178
|
-
### parserWarning.lineNumber : <code>number</code>
|
|
1179
|
-
The chord sheet line number on which the warning occurred
|
|
1180
|
-
|
|
1181
|
-
**Kind**: instance property of [<code>ParserWarning</code>](#ParserWarning)
|
|
1182
|
-
<a name="ParserWarning+column"></a>
|
|
1183
|
-
|
|
1184
|
-
### parserWarning.column : <code>number</code>
|
|
1185
|
-
The chord sheet column on which the warning occurred
|
|
1186
|
-
|
|
1187
|
-
**Kind**: instance property of [<code>ParserWarning</code>](#ParserWarning)
|
|
1188
1077
|
<a name="ParserWarning+toString"></a>
|
|
1189
1078
|
|
|
1190
1079
|
### parserWarning.toString() ⇒ <code>string</code>
|
|
1191
|
-
Returns a stringified version of the warning
|
|
1080
|
+
<p>Returns a stringified version of the warning</p>
|
|
1192
1081
|
|
|
1193
1082
|
**Kind**: instance method of [<code>ParserWarning</code>](#ParserWarning)
|
|
1194
|
-
**Returns**: <code>string</code> - The string warning
|
|
1083
|
+
**Returns**: <code>string</code> - <p>The string warning</p>
|
|
1195
1084
|
<a name="UltimateGuitarParser"></a>
|
|
1196
1085
|
|
|
1197
1086
|
## UltimateGuitarParser
|
|
1198
|
-
Parses an Ultimate Guitar chord sheet with metadata
|
|
1199
|
-
Inherits from [ChordSheetParser](#ChordSheetParser)
|
|
1087
|
+
<p>Parses an Ultimate Guitar chord sheet with metadata
|
|
1088
|
+
Inherits from [ChordSheetParser](#ChordSheetParser)</p>
|
|
1200
1089
|
|
|
1201
1090
|
**Kind**: global class
|
|
1202
1091
|
<a name="Chord"></a>
|
|
1203
1092
|
|
|
1204
1093
|
## Chord
|
|
1205
|
-
Represents a Chord, consisting of a root, suffix (quality) and bass
|
|
1094
|
+
<p>Represents a Chord, consisting of a root, suffix (quality) and bass</p>
|
|
1206
1095
|
|
|
1207
1096
|
**Kind**: global class
|
|
1208
1097
|
|
|
1209
1098
|
* [Chord](#Chord)
|
|
1210
1099
|
* _instance_
|
|
1211
1100
|
* [.clone()](#Chord+clone) ⇒ [<code>Chord</code>](#Chord)
|
|
1212
|
-
* [.toChordSymbol(key)](#Chord+toChordSymbol) ⇒ [<code>Chord</code>](#Chord)
|
|
1213
|
-
* [.toChordSymbolString(key)](#Chord+toChordSymbolString) ⇒ <code>string</code>
|
|
1101
|
+
* [.toChordSymbol([key])](#Chord+toChordSymbol) ⇒ [<code>Chord</code>](#Chord)
|
|
1102
|
+
* [.toChordSymbolString([key])](#Chord+toChordSymbolString) ⇒ <code>string</code>
|
|
1214
1103
|
* [.isChordSymbol()](#Chord+isChordSymbol) ⇒ <code>boolean</code>
|
|
1215
|
-
* [.toNumeric(key)](#Chord+toNumeric) ⇒ [<code>Chord</code>](#Chord)
|
|
1104
|
+
* [.toNumeric([key])](#Chord+toNumeric) ⇒ [<code>Chord</code>](#Chord)
|
|
1216
1105
|
* [.toNumeral(key)](#Chord+toNumeral) ⇒ [<code>Chord</code>](#Chord)
|
|
1217
|
-
* [.toNumeralString(key)](#Chord+toNumeralString) ⇒ <code>string</code>
|
|
1106
|
+
* [.toNumeralString([key])](#Chord+toNumeralString) ⇒ <code>string</code>
|
|
1218
1107
|
* [.isNumeric()](#Chord+isNumeric) ⇒ <code>boolean</code>
|
|
1219
|
-
* [.toNumericString(key)](#Chord+toNumericString) ⇒ <code>string</code>
|
|
1108
|
+
* [.toNumericString([key])](#Chord+toNumericString) ⇒ <code>string</code>
|
|
1220
1109
|
* [.isNumeral()](#Chord+isNumeral) ⇒ <code>boolean</code>
|
|
1221
1110
|
* [.toString()](#Chord+toString) ⇒ <code>string</code>
|
|
1222
1111
|
* [.normalize()](#Chord+normalize) ⇒ [<code>Chord</code>](#Chord)
|
|
@@ -1230,188 +1119,189 @@ Represents a Chord, consisting of a root, suffix (quality) and bass
|
|
|
1230
1119
|
<a name="Chord+clone"></a>
|
|
1231
1120
|
|
|
1232
1121
|
### chord.clone() ⇒ [<code>Chord</code>](#Chord)
|
|
1233
|
-
Returns a deep copy of the chord
|
|
1122
|
+
<p>Returns a deep copy of the chord</p>
|
|
1234
1123
|
|
|
1235
1124
|
**Kind**: instance method of [<code>Chord</code>](#Chord)
|
|
1236
1125
|
<a name="Chord+toChordSymbol"></a>
|
|
1237
1126
|
|
|
1238
|
-
### chord.toChordSymbol(key) ⇒ [<code>Chord</code>](#Chord)
|
|
1239
|
-
Converts the chord to a chord symbol, using the supplied key as a reference.
|
|
1240
|
-
For example, a numeric chord
|
|
1241
|
-
When the chord is already a chord symbol, it will return a clone of the object
|
|
1127
|
+
### chord.toChordSymbol([key]) ⇒ [<code>Chord</code>](#Chord)
|
|
1128
|
+
<p>Converts the chord to a chord symbol, using the supplied key as a reference.
|
|
1129
|
+
For example, a numeric chord <code>#4</code> with reference key <code>E</code> will return the chord symbol <code>A#</code>.
|
|
1130
|
+
When the chord is already a chord symbol, it will return a clone of the object.</p>
|
|
1242
1131
|
|
|
1243
1132
|
**Kind**: instance method of [<code>Chord</code>](#Chord)
|
|
1244
|
-
**Returns**: [<code>Chord</code>](#Chord) - the chord symbol
|
|
1133
|
+
**Returns**: [<code>Chord</code>](#Chord) - <p>the chord symbol</p>
|
|
1245
1134
|
|
|
1246
|
-
| Param | Type | Description |
|
|
1247
|
-
| --- | --- | --- |
|
|
1248
|
-
| key | <code>Key</code> \| <code>string</code> | the reference key |
|
|
1135
|
+
| Param | Type | Default | Description |
|
|
1136
|
+
| --- | --- | --- | --- |
|
|
1137
|
+
| [key] | <code>Key</code> \| <code>string</code> | <code></code> | <p>the reference key</p> |
|
|
1249
1138
|
|
|
1250
1139
|
<a name="Chord+toChordSymbolString"></a>
|
|
1251
1140
|
|
|
1252
|
-
### chord.toChordSymbolString(key) ⇒ <code>string</code>
|
|
1253
|
-
Converts the chord to a chord symbol string, using the supplied key as a reference.
|
|
1254
|
-
For example, a numeric chord
|
|
1255
|
-
When the chord is already a chord symbol, it will return a string version of the chord
|
|
1141
|
+
### chord.toChordSymbolString([key]) ⇒ <code>string</code>
|
|
1142
|
+
<p>Converts the chord to a chord symbol string, using the supplied key as a reference.
|
|
1143
|
+
For example, a numeric chord <code>#4</code> with reference key <code>E</code> will return the chord symbol <code>A#</code>.
|
|
1144
|
+
When the chord is already a chord symbol, it will return a string version of the chord.</p>
|
|
1256
1145
|
|
|
1257
1146
|
**Kind**: instance method of [<code>Chord</code>](#Chord)
|
|
1258
|
-
**Returns**: <code>string</code> - the chord symbol string
|
|
1147
|
+
**Returns**: <code>string</code> - <p>the chord symbol string</p>
|
|
1259
1148
|
**See**: {toChordSymbol}
|
|
1260
1149
|
|
|
1261
|
-
| Param | Type | Description |
|
|
1262
|
-
| --- | --- | --- |
|
|
1263
|
-
| key | <code>Key</code> \| <code>string</code> | the reference key |
|
|
1150
|
+
| Param | Type | Default | Description |
|
|
1151
|
+
| --- | --- | --- | --- |
|
|
1152
|
+
| [key] | <code>Key</code> \| <code>string</code> | <code></code> | <p>the reference key</p> |
|
|
1264
1153
|
|
|
1265
1154
|
<a name="Chord+isChordSymbol"></a>
|
|
1266
1155
|
|
|
1267
1156
|
### chord.isChordSymbol() ⇒ <code>boolean</code>
|
|
1268
|
-
Determines whether the chord is a chord symbol
|
|
1157
|
+
<p>Determines whether the chord is a chord symbol</p>
|
|
1269
1158
|
|
|
1270
1159
|
**Kind**: instance method of [<code>Chord</code>](#Chord)
|
|
1271
1160
|
<a name="Chord+toNumeric"></a>
|
|
1272
1161
|
|
|
1273
|
-
### chord.toNumeric(key) ⇒ [<code>Chord</code>](#Chord)
|
|
1274
|
-
Converts the chord to a numeric chord, using the supplied key as a reference.
|
|
1275
|
-
For example, a chord symbol A# with reference key E will return the numeric chord #4
|
|
1162
|
+
### chord.toNumeric([key]) ⇒ [<code>Chord</code>](#Chord)
|
|
1163
|
+
<p>Converts the chord to a numeric chord, using the supplied key as a reference.
|
|
1164
|
+
For example, a chord symbol A# with reference key E will return the numeric chord #4.</p>
|
|
1276
1165
|
|
|
1277
1166
|
**Kind**: instance method of [<code>Chord</code>](#Chord)
|
|
1278
|
-
**Returns**: [<code>Chord</code>](#Chord) - the numeric chord
|
|
1167
|
+
**Returns**: [<code>Chord</code>](#Chord) - <p>the numeric chord</p>
|
|
1279
1168
|
|
|
1280
|
-
| Param | Type | Description |
|
|
1281
|
-
| --- | --- | --- |
|
|
1282
|
-
| key | <code>Key</code> \| <code>string</code> | the reference key |
|
|
1169
|
+
| Param | Type | Default | Description |
|
|
1170
|
+
| --- | --- | --- | --- |
|
|
1171
|
+
| [key] | <code>Key</code> \| <code>string</code> | <code></code> | <p>the reference key</p> |
|
|
1283
1172
|
|
|
1284
1173
|
<a name="Chord+toNumeral"></a>
|
|
1285
1174
|
|
|
1286
1175
|
### chord.toNumeral(key) ⇒ [<code>Chord</code>](#Chord)
|
|
1287
|
-
Converts the chord to a numeral chord, using the supplied key as a reference.
|
|
1288
|
-
For example, a chord symbol A# with reference key E will return the numeral chord #IV
|
|
1176
|
+
<p>Converts the chord to a numeral chord, using the supplied key as a reference.
|
|
1177
|
+
For example, a chord symbol A# with reference key E will return the numeral chord #IV.</p>
|
|
1289
1178
|
|
|
1290
1179
|
**Kind**: instance method of [<code>Chord</code>](#Chord)
|
|
1291
|
-
**Returns**: [<code>Chord</code>](#Chord) - the numeral chord
|
|
1180
|
+
**Returns**: [<code>Chord</code>](#Chord) - <p>the numeral chord</p>
|
|
1292
1181
|
|
|
1293
1182
|
| Param | Type | Default | Description |
|
|
1294
1183
|
| --- | --- | --- | --- |
|
|
1295
|
-
| key | <code>Key</code> \| <code>string</code> \| <code>null</code> | <code></code> | the reference key. The key is required when converting a chord symbol |
|
|
1184
|
+
| key | <code>Key</code> \| <code>string</code> \| <code>null</code> | <code></code> | <p>the reference key. The key is required when converting a chord symbol</p> |
|
|
1296
1185
|
|
|
1297
1186
|
<a name="Chord+toNumeralString"></a>
|
|
1298
1187
|
|
|
1299
|
-
### chord.toNumeralString(key) ⇒ <code>string</code>
|
|
1300
|
-
Converts the chord to a numeral chord string, using the supplied kye as a reference.
|
|
1301
|
-
For example, a chord symbol A# with reference key E will return the numeral chord #4
|
|
1188
|
+
### chord.toNumeralString([key]) ⇒ <code>string</code>
|
|
1189
|
+
<p>Converts the chord to a numeral chord string, using the supplied kye as a reference.
|
|
1190
|
+
For example, a chord symbol A# with reference key E will return the numeral chord #4.</p>
|
|
1302
1191
|
|
|
1303
1192
|
**Kind**: instance method of [<code>Chord</code>](#Chord)
|
|
1304
|
-
**Returns**: <code>string</code> - the numeral chord string
|
|
1193
|
+
**Returns**: <code>string</code> - <p>the numeral chord string</p>
|
|
1305
1194
|
**See**: {toNumeral}
|
|
1306
1195
|
|
|
1307
|
-
| Param | Type | Description |
|
|
1308
|
-
| --- | --- | --- |
|
|
1309
|
-
| key | <code>Key</code> \| <code>string</code> | the reference key |
|
|
1196
|
+
| Param | Type | Default | Description |
|
|
1197
|
+
| --- | --- | --- | --- |
|
|
1198
|
+
| [key] | <code>Key</code> \| <code>string</code> | <code></code> | <p>the reference key</p> |
|
|
1310
1199
|
|
|
1311
1200
|
<a name="Chord+isNumeric"></a>
|
|
1312
1201
|
|
|
1313
1202
|
### chord.isNumeric() ⇒ <code>boolean</code>
|
|
1314
|
-
Determines whether the chord is numeric
|
|
1203
|
+
<p>Determines whether the chord is numeric</p>
|
|
1315
1204
|
|
|
1316
1205
|
**Kind**: instance method of [<code>Chord</code>](#Chord)
|
|
1317
1206
|
<a name="Chord+toNumericString"></a>
|
|
1318
1207
|
|
|
1319
|
-
### chord.toNumericString(key) ⇒ <code>string</code>
|
|
1320
|
-
Converts the chord to a numeric chord string, using the supplied kye as a reference.
|
|
1321
|
-
For example, a chord symbol A# with reference key E will return the numeric chord #4
|
|
1208
|
+
### chord.toNumericString([key]) ⇒ <code>string</code>
|
|
1209
|
+
<p>Converts the chord to a numeric chord string, using the supplied kye as a reference.
|
|
1210
|
+
For example, a chord symbol A# with reference key E will return the numeric chord #4.</p>
|
|
1322
1211
|
|
|
1323
1212
|
**Kind**: instance method of [<code>Chord</code>](#Chord)
|
|
1324
|
-
**Returns**: <code>string</code> - the numeric chord string
|
|
1213
|
+
**Returns**: <code>string</code> - <p>the numeric chord string</p>
|
|
1325
1214
|
**See**: {toNumeric}
|
|
1326
1215
|
|
|
1327
|
-
| Param | Type | Description |
|
|
1328
|
-
| --- | --- | --- |
|
|
1329
|
-
| key | <code>Key</code> \| <code>string</code> | the reference key |
|
|
1216
|
+
| Param | Type | Default | Description |
|
|
1217
|
+
| --- | --- | --- | --- |
|
|
1218
|
+
| [key] | <code>Key</code> \| <code>string</code> | <code></code> | <p>the reference key</p> |
|
|
1330
1219
|
|
|
1331
1220
|
<a name="Chord+isNumeral"></a>
|
|
1332
1221
|
|
|
1333
1222
|
### chord.isNumeral() ⇒ <code>boolean</code>
|
|
1334
|
-
Determines whether the chord is a numeral
|
|
1223
|
+
<p>Determines whether the chord is a numeral</p>
|
|
1335
1224
|
|
|
1336
1225
|
**Kind**: instance method of [<code>Chord</code>](#Chord)
|
|
1337
1226
|
<a name="Chord+toString"></a>
|
|
1338
1227
|
|
|
1339
1228
|
### chord.toString() ⇒ <code>string</code>
|
|
1340
|
-
Converts the chord to a string, eg
|
|
1229
|
+
<p>Converts the chord to a string, eg <code>Esus4/G#</code> or <code>1sus4/#3</code></p>
|
|
1341
1230
|
|
|
1342
1231
|
**Kind**: instance method of [<code>Chord</code>](#Chord)
|
|
1343
|
-
**Returns**: <code>string</code> - the chord string
|
|
1232
|
+
**Returns**: <code>string</code> - <p>the chord string</p>
|
|
1344
1233
|
<a name="Chord+normalize"></a>
|
|
1345
1234
|
|
|
1346
1235
|
### chord.normalize() ⇒ [<code>Chord</code>](#Chord)
|
|
1347
|
-
Normalizes the chord root and bass notes
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1236
|
+
<p>Normalizes the chord root and bass notes:</p>
|
|
1237
|
+
<ul>
|
|
1238
|
+
<li>Fb becomes E</li>
|
|
1239
|
+
<li>Cb becomes B</li>
|
|
1240
|
+
<li>B# becomes C</li>
|
|
1241
|
+
<li>E# becomes F</li>
|
|
1242
|
+
<li>4b becomes 3</li>
|
|
1243
|
+
<li>1b becomes 7</li>
|
|
1244
|
+
<li>7# becomes 1</li>
|
|
1245
|
+
<li>3# becomes 4</li>
|
|
1246
|
+
</ul>
|
|
1247
|
+
<p>Besides that it normalizes the suffix. For example, <code>sus2</code> becomes <code>2</code>, <code>sus4</code> becomes <code>sus</code>.
|
|
1248
|
+
All suffix normalizations can be found in <code>src/normalize_mappings/suffix-mapping.txt</code>.</p>
|
|
1359
1249
|
|
|
1360
1250
|
**Kind**: instance method of [<code>Chord</code>](#Chord)
|
|
1361
|
-
**Returns**: [<code>Chord</code>](#Chord) - the normalized chord
|
|
1251
|
+
**Returns**: [<code>Chord</code>](#Chord) - <p>the normalized chord</p>
|
|
1362
1252
|
<a name="Chord+useModifier"></a>
|
|
1363
1253
|
|
|
1364
1254
|
### chord.useModifier(newModifier) ⇒ [<code>Chord</code>](#Chord)
|
|
1365
|
-
Switches to the specified modifier
|
|
1255
|
+
<p>Switches to the specified modifier</p>
|
|
1366
1256
|
|
|
1367
1257
|
**Kind**: instance method of [<code>Chord</code>](#Chord)
|
|
1368
|
-
**Returns**: [<code>Chord</code>](#Chord) - the new, changed chord
|
|
1258
|
+
**Returns**: [<code>Chord</code>](#Chord) - <p>the new, changed chord</p>
|
|
1369
1259
|
|
|
1370
1260
|
| Param | Description |
|
|
1371
1261
|
| --- | --- |
|
|
1372
|
-
| newModifier | the modifier to use:
|
|
1262
|
+
| newModifier | <p>the modifier to use: <code>'#'</code> or <code>'b'</code></p> |
|
|
1373
1263
|
|
|
1374
1264
|
<a name="Chord+transposeUp"></a>
|
|
1375
1265
|
|
|
1376
1266
|
### chord.transposeUp() ⇒ [<code>Chord</code>](#Chord)
|
|
1377
|
-
Transposes the chord up by 1 semitone. Eg. A becomes A#, Eb becomes E
|
|
1267
|
+
<p>Transposes the chord up by 1 semitone. Eg. A becomes A#, Eb becomes E</p>
|
|
1378
1268
|
|
|
1379
1269
|
**Kind**: instance method of [<code>Chord</code>](#Chord)
|
|
1380
|
-
**Returns**: [<code>Chord</code>](#Chord) - the new, transposed chord
|
|
1270
|
+
**Returns**: [<code>Chord</code>](#Chord) - <p>the new, transposed chord</p>
|
|
1381
1271
|
<a name="Chord+transposeDown"></a>
|
|
1382
1272
|
|
|
1383
1273
|
### chord.transposeDown() ⇒ [<code>Chord</code>](#Chord)
|
|
1384
|
-
Transposes the chord down by 1 semitone. Eg. A# becomes A, E becomes Eb
|
|
1274
|
+
<p>Transposes the chord down by 1 semitone. Eg. A# becomes A, E becomes Eb</p>
|
|
1385
1275
|
|
|
1386
1276
|
**Kind**: instance method of [<code>Chord</code>](#Chord)
|
|
1387
|
-
**Returns**: [<code>Chord</code>](#Chord) - the new, transposed chord
|
|
1277
|
+
**Returns**: [<code>Chord</code>](#Chord) - <p>the new, transposed chord</p>
|
|
1388
1278
|
<a name="Chord+transpose"></a>
|
|
1389
1279
|
|
|
1390
1280
|
### chord.transpose(delta) ⇒ [<code>Chord</code>](#Chord)
|
|
1391
|
-
Transposes the chord by the specified number of semitones
|
|
1281
|
+
<p>Transposes the chord by the specified number of semitones</p>
|
|
1392
1282
|
|
|
1393
1283
|
**Kind**: instance method of [<code>Chord</code>](#Chord)
|
|
1394
|
-
**Returns**: [<code>Chord</code>](#Chord) - the new, transposed chord
|
|
1284
|
+
**Returns**: [<code>Chord</code>](#Chord) - <p>the new, transposed chord</p>
|
|
1395
1285
|
|
|
1396
1286
|
| Param | Description |
|
|
1397
1287
|
| --- | --- |
|
|
1398
|
-
| delta | de number of semitones |
|
|
1288
|
+
| delta | <p>de number of semitones</p> |
|
|
1399
1289
|
|
|
1400
1290
|
<a name="Chord.parse"></a>
|
|
1401
1291
|
|
|
1402
1292
|
### Chord.parse(chordString) ⇒ <code>null</code> \| [<code>Chord</code>](#Chord)
|
|
1403
|
-
Tries to parse a chord string into a chord
|
|
1293
|
+
<p>Tries to parse a chord string into a chord</p>
|
|
1404
1294
|
|
|
1405
1295
|
**Kind**: static method of [<code>Chord</code>](#Chord)
|
|
1406
1296
|
|
|
1407
1297
|
| Param | Description |
|
|
1408
1298
|
| --- | --- |
|
|
1409
|
-
| chordString | the chord string, eg
|
|
1299
|
+
| chordString | <p>the chord string, eg <code>Esus4/G#</code> or <code>1sus4/#3</code></p> |
|
|
1410
1300
|
|
|
1411
1301
|
<a name="ChordSheetSerializer"></a>
|
|
1412
1302
|
|
|
1413
1303
|
## ChordSheetSerializer
|
|
1414
|
-
Serializes a song into een plain object, and deserializes the serialized object back into a [Song](#Song)
|
|
1304
|
+
<p>Serializes a song into een plain object, and deserializes the serialized object back into a [Song](#Song)</p>
|
|
1415
1305
|
|
|
1416
1306
|
**Kind**: global class
|
|
1417
1307
|
|
|
@@ -1422,220 +1312,239 @@ Serializes a song into een plain object, and deserializes the serialized object
|
|
|
1422
1312
|
<a name="ChordSheetSerializer+serialize"></a>
|
|
1423
1313
|
|
|
1424
1314
|
### chordSheetSerializer.serialize() ⇒
|
|
1425
|
-
Serializes the chord sheet to a plain object, which can be converted to any format like JSON, XML etc
|
|
1426
|
-
Can be deserialized using [deserialize](deserialize)
|
|
1315
|
+
<p>Serializes the chord sheet to a plain object, which can be converted to any format like JSON, XML etc
|
|
1316
|
+
Can be deserialized using [deserialize](deserialize)</p>
|
|
1427
1317
|
|
|
1428
1318
|
**Kind**: instance method of [<code>ChordSheetSerializer</code>](#ChordSheetSerializer)
|
|
1429
|
-
**Returns**: object A plain JS object containing all chord sheet data
|
|
1319
|
+
**Returns**: <p>object A plain JS object containing all chord sheet data</p>
|
|
1430
1320
|
<a name="ChordSheetSerializer+deserialize"></a>
|
|
1431
1321
|
|
|
1432
1322
|
### chordSheetSerializer.deserialize(serializedSong) ⇒ [<code>Song</code>](#Song)
|
|
1433
|
-
Deserializes a song that has been serialized using [serialize](serialize)
|
|
1323
|
+
<p>Deserializes a song that has been serialized using [serialize](serialize)</p>
|
|
1434
1324
|
|
|
1435
1325
|
**Kind**: instance method of [<code>ChordSheetSerializer</code>](#ChordSheetSerializer)
|
|
1436
|
-
**Returns**: [<code>Song</code>](#Song) - The deserialized song
|
|
1326
|
+
**Returns**: [<code>Song</code>](#Song) - <p>The deserialized song</p>
|
|
1437
1327
|
|
|
1438
1328
|
| Param | Type | Description |
|
|
1439
1329
|
| --- | --- | --- |
|
|
1440
|
-
| serializedSong | <code>object</code> | The serialized song |
|
|
1330
|
+
| serializedSong | <code>object</code> | <p>The serialized song</p> |
|
|
1441
1331
|
|
|
1442
1332
|
<a name="ALBUM"></a>
|
|
1443
1333
|
|
|
1444
1334
|
## ALBUM : <code>string</code>
|
|
1445
|
-
|
|
1335
|
+
<p>Artist meta directive. See https://www.chordpro.org/chordpro/directives-artist/</p>
|
|
1446
1336
|
|
|
1447
|
-
**Kind**: global
|
|
1337
|
+
**Kind**: global variable
|
|
1448
1338
|
<a name="ARTIST"></a>
|
|
1449
1339
|
|
|
1450
1340
|
## ARTIST : <code>string</code>
|
|
1451
|
-
|
|
1341
|
+
<p>Capo meta directive. See https://www.chordpro.org/chordpro/directives-capo/</p>
|
|
1452
1342
|
|
|
1453
|
-
**Kind**: global
|
|
1343
|
+
**Kind**: global variable
|
|
1454
1344
|
<a name="CAPO"></a>
|
|
1455
1345
|
|
|
1456
1346
|
## CAPO : <code>string</code>
|
|
1457
|
-
|
|
1347
|
+
<p>Comment directive. See https://www.chordpro.org/chordpro/directives-comment/</p>
|
|
1458
1348
|
|
|
1459
|
-
**Kind**: global
|
|
1349
|
+
**Kind**: global variable
|
|
1460
1350
|
<a name="COMMENT"></a>
|
|
1461
1351
|
|
|
1462
1352
|
## COMMENT : <code>string</code>
|
|
1463
|
-
|
|
1353
|
+
<p>Composer meta directive. See https://www.chordpro.org/chordpro/directives-composer/</p>
|
|
1464
1354
|
|
|
1465
|
-
**Kind**: global
|
|
1355
|
+
**Kind**: global variable
|
|
1466
1356
|
<a name="COMPOSER"></a>
|
|
1467
1357
|
|
|
1468
1358
|
## COMPOSER : <code>string</code>
|
|
1469
|
-
|
|
1359
|
+
<p>Copyright meta directive. See https://www.chordpro.org/chordpro/directives-copyright/</p>
|
|
1470
1360
|
|
|
1471
|
-
**Kind**: global
|
|
1361
|
+
**Kind**: global variable
|
|
1472
1362
|
<a name="COPYRIGHT"></a>
|
|
1473
1363
|
|
|
1474
1364
|
## COPYRIGHT : <code>string</code>
|
|
1475
|
-
|
|
1365
|
+
<p>Duration meta directive. See https://www.chordpro.org/chordpro/directives-duration/</p>
|
|
1476
1366
|
|
|
1477
|
-
**Kind**: global
|
|
1367
|
+
**Kind**: global variable
|
|
1478
1368
|
<a name="DURATION"></a>
|
|
1479
1369
|
|
|
1480
1370
|
## DURATION : <code>string</code>
|
|
1481
|
-
|
|
1371
|
+
<p>End of chorus directive. See https://www.chordpro.org/chordpro/directives-env_chorus/</p>
|
|
1482
1372
|
|
|
1483
|
-
**Kind**: global
|
|
1373
|
+
**Kind**: global variable
|
|
1484
1374
|
<a name="END_OF_CHORUS"></a>
|
|
1485
1375
|
|
|
1486
1376
|
## END\_OF\_CHORUS : <code>string</code>
|
|
1487
|
-
End of
|
|
1377
|
+
<p>End of tab directive. See https://www.chordpro.org/chordpro/directives-env_tab/</p>
|
|
1488
1378
|
|
|
1489
|
-
**Kind**: global
|
|
1379
|
+
**Kind**: global variable
|
|
1490
1380
|
<a name="END_OF_TAB"></a>
|
|
1491
1381
|
|
|
1492
1382
|
## END\_OF\_TAB : <code>string</code>
|
|
1493
|
-
End of
|
|
1383
|
+
<p>End of verse directive. See https://www.chordpro.org/chordpro/directives-env_verse/</p>
|
|
1494
1384
|
|
|
1495
|
-
**Kind**: global
|
|
1385
|
+
**Kind**: global variable
|
|
1496
1386
|
<a name="END_OF_VERSE"></a>
|
|
1497
1387
|
|
|
1498
1388
|
## END\_OF\_VERSE : <code>string</code>
|
|
1499
|
-
|
|
1389
|
+
<p>Key meta directive. See https://www.chordpro.org/chordpro/directives-key/</p>
|
|
1500
1390
|
|
|
1501
|
-
**Kind**: global
|
|
1391
|
+
**Kind**: global variable
|
|
1502
1392
|
<a name="KEY"></a>
|
|
1503
1393
|
|
|
1504
1394
|
## KEY : <code>string</code>
|
|
1505
|
-
Key meta directive. See https://www.chordpro.org/chordpro/directives-key
|
|
1395
|
+
<p>Key meta directive. See https://www.chordpro.org/chordpro/directives-key/</p>
|
|
1506
1396
|
|
|
1507
|
-
**Kind**: global
|
|
1397
|
+
**Kind**: global variable
|
|
1508
1398
|
<a name="_KEY"></a>
|
|
1509
1399
|
|
|
1510
1400
|
## \_KEY : <code>string</code>
|
|
1511
|
-
|
|
1401
|
+
<p>Lyricist meta directive. See https://www.chordpro.org/chordpro/directives-lyricist/</p>
|
|
1512
1402
|
|
|
1513
|
-
**Kind**: global
|
|
1403
|
+
**Kind**: global variable
|
|
1514
1404
|
<a name="LYRICIST"></a>
|
|
1515
1405
|
|
|
1516
1406
|
## LYRICIST : <code>string</code>
|
|
1517
|
-
|
|
1407
|
+
<p>Start of chorus directive. See https://www.chordpro.org/chordpro/directives-env_chorus/</p>
|
|
1518
1408
|
|
|
1519
|
-
**Kind**: global
|
|
1409
|
+
**Kind**: global variable
|
|
1520
1410
|
<a name="START_OF_CHORUS"></a>
|
|
1521
1411
|
|
|
1522
1412
|
## START\_OF\_CHORUS : <code>string</code>
|
|
1523
|
-
Start of
|
|
1413
|
+
<p>Start of tab directive. See https://www.chordpro.org/chordpro/directives-env_tab/</p>
|
|
1524
1414
|
|
|
1525
|
-
**Kind**: global
|
|
1415
|
+
**Kind**: global variable
|
|
1526
1416
|
<a name="START_OF_TAB"></a>
|
|
1527
1417
|
|
|
1528
1418
|
## START\_OF\_TAB : <code>string</code>
|
|
1529
|
-
Start of
|
|
1419
|
+
<p>Start of verse directive. See https://www.chordpro.org/chordpro/directives-env_verse/</p>
|
|
1530
1420
|
|
|
1531
|
-
**Kind**: global
|
|
1421
|
+
**Kind**: global variable
|
|
1532
1422
|
<a name="START_OF_VERSE"></a>
|
|
1533
1423
|
|
|
1534
1424
|
## START\_OF\_VERSE : <code>string</code>
|
|
1535
|
-
|
|
1425
|
+
<p>Subtitle meta directive. See https://www.chordpro.org/chordpro/directives-subtitle/</p>
|
|
1536
1426
|
|
|
1537
|
-
**Kind**: global
|
|
1427
|
+
**Kind**: global variable
|
|
1538
1428
|
<a name="SUBTITLE"></a>
|
|
1539
1429
|
|
|
1540
1430
|
## SUBTITLE : <code>string</code>
|
|
1541
|
-
|
|
1431
|
+
<p>Tempo meta directive. See https://www.chordpro.org/chordpro/directives-tempo/</p>
|
|
1542
1432
|
|
|
1543
|
-
**Kind**: global
|
|
1433
|
+
**Kind**: global variable
|
|
1544
1434
|
<a name="TEMPO"></a>
|
|
1545
1435
|
|
|
1546
1436
|
## TEMPO : <code>string</code>
|
|
1547
|
-
|
|
1437
|
+
<p>Time meta directive. See https://www.chordpro.org/chordpro/directives-time/</p>
|
|
1548
1438
|
|
|
1549
|
-
**Kind**: global
|
|
1439
|
+
**Kind**: global variable
|
|
1550
1440
|
<a name="TIME"></a>
|
|
1551
1441
|
|
|
1552
1442
|
## TIME : <code>string</code>
|
|
1553
|
-
|
|
1443
|
+
<p>Title meta directive. See https://www.chordpro.org/chordpro/directives-title/</p>
|
|
1554
1444
|
|
|
1555
|
-
**Kind**: global
|
|
1445
|
+
**Kind**: global variable
|
|
1556
1446
|
<a name="TITLE"></a>
|
|
1557
1447
|
|
|
1558
1448
|
## TITLE : <code>string</code>
|
|
1559
|
-
|
|
1449
|
+
<p>Transpose meta directive. See: https://www.chordpro.org/chordpro/directives-transpose/</p>
|
|
1560
1450
|
|
|
1561
|
-
**Kind**: global
|
|
1451
|
+
**Kind**: global variable
|
|
1562
1452
|
<a name="TRANSPOSE"></a>
|
|
1563
1453
|
|
|
1564
1454
|
## TRANSPOSE : <code>string</code>
|
|
1565
|
-
|
|
1455
|
+
<p>New Key meta directive. See: https://github.com/PraiseCharts/ChordChartJS/issues/53</p>
|
|
1566
1456
|
|
|
1567
|
-
**Kind**: global
|
|
1457
|
+
**Kind**: global variable
|
|
1568
1458
|
<a name="NEW_KEY"></a>
|
|
1569
1459
|
|
|
1570
1460
|
## NEW\_KEY : <code>string</code>
|
|
1571
|
-
|
|
1461
|
+
<p>Year meta directive. See https://www.chordpro.org/chordpro/directives-year/</p>
|
|
1572
1462
|
|
|
1573
|
-
**Kind**: global
|
|
1574
|
-
<a name="
|
|
1463
|
+
**Kind**: global variable
|
|
1464
|
+
<a name="defaultCss"></a>
|
|
1575
1465
|
|
|
1576
|
-
##
|
|
1577
|
-
|
|
1466
|
+
## defaultCss ⇒ <code>string</code>
|
|
1467
|
+
<p>Generates basic CSS, scoped within the provided selector, to use with output generated by [HtmlTableFormatter](#HtmlTableFormatter)</p>
|
|
1468
|
+
|
|
1469
|
+
**Kind**: global variable
|
|
1470
|
+
**Returns**: <code>string</code> - <p>the CSS string</p>
|
|
1471
|
+
|
|
1472
|
+
| Param | Description |
|
|
1473
|
+
| --- | --- |
|
|
1474
|
+
| scope | <p>the CSS scope to use, for example <code>.chordSheetViewer</code></p> |
|
|
1578
1475
|
|
|
1579
|
-
**Kind**: global constant
|
|
1580
1476
|
<a name="defaultCss"></a>
|
|
1581
1477
|
|
|
1582
1478
|
## defaultCss : <code>Object.<string, Object.<string, string>></code>
|
|
1583
|
-
Basic CSS, in object style à la useStyles, to use with output generated by {@link }HtmlTableFormatter}
|
|
1584
|
-
For a CSS string see [scopedCss](
|
|
1479
|
+
<p>Basic CSS, in object style à la useStyles, to use with output generated by {@link }HtmlTableFormatter}
|
|
1480
|
+
For a CSS string see [scopedCss](scopedCss)</p>
|
|
1481
|
+
|
|
1482
|
+
**Kind**: global constant
|
|
1483
|
+
<a name="VERSE"></a>
|
|
1484
|
+
|
|
1485
|
+
## VERSE : <code>string</code>
|
|
1486
|
+
<p>Used to mark a paragraph as verse</p>
|
|
1585
1487
|
|
|
1586
1488
|
**Kind**: global constant
|
|
1587
1489
|
<a name="VERSE"></a>
|
|
1588
1490
|
|
|
1589
1491
|
## VERSE : <code>string</code>
|
|
1590
|
-
Used to mark a paragraph as
|
|
1492
|
+
<p>Used to mark a paragraph as chorus</p>
|
|
1591
1493
|
|
|
1592
1494
|
**Kind**: global constant
|
|
1593
1495
|
<a name="CHORUS"></a>
|
|
1594
1496
|
|
|
1595
1497
|
## CHORUS : <code>string</code>
|
|
1596
|
-
Used to mark a paragraph as
|
|
1498
|
+
<p>Used to mark a paragraph as not containing a line marked with a type</p>
|
|
1597
1499
|
|
|
1598
1500
|
**Kind**: global constant
|
|
1599
1501
|
<a name="NONE"></a>
|
|
1600
1502
|
|
|
1601
1503
|
## NONE : <code>string</code>
|
|
1602
|
-
Used to mark a paragraph as
|
|
1504
|
+
<p>Used to mark a paragraph as containing lines with both verse and chorus type</p>
|
|
1603
1505
|
|
|
1604
1506
|
**Kind**: global constant
|
|
1605
1507
|
<a name="INDETERMINATE"></a>
|
|
1606
1508
|
|
|
1607
1509
|
## INDETERMINATE : <code>string</code>
|
|
1608
|
-
Used to mark a paragraph as
|
|
1510
|
+
<p>Used to mark a paragraph as tab</p>
|
|
1609
1511
|
|
|
1610
1512
|
**Kind**: global constant
|
|
1611
|
-
<a name="
|
|
1612
|
-
|
|
1613
|
-
## TAB : <code>string</code>
|
|
1614
|
-
Used to mark a paragraph as tab
|
|
1513
|
+
<a name="parseChord"></a>
|
|
1615
1514
|
|
|
1616
|
-
|
|
1617
|
-
|
|
1515
|
+
## ~~parseChord(chordString) ⇒ <code>null</code> \| [<code>Chord</code>](#Chord)~~
|
|
1516
|
+
***Deprecated***
|
|
1618
1517
|
|
|
1619
|
-
|
|
1620
|
-
Generates basic CSS, scoped within the provided selector, to use with output generated by [HtmlTableFormatter](#HtmlTableFormatter)
|
|
1518
|
+
<p>Tries to parse a chord string into a chord</p>
|
|
1621
1519
|
|
|
1622
1520
|
**Kind**: global function
|
|
1623
|
-
**Returns**: <code>string</code> - the CSS string
|
|
1624
1521
|
|
|
1625
1522
|
| Param | Description |
|
|
1626
1523
|
| --- | --- |
|
|
1627
|
-
|
|
|
1524
|
+
| chordString | <p>the chord string, eg Esus4/G# or 1sus4/#3</p> |
|
|
1628
1525
|
|
|
1629
|
-
<a name="
|
|
1526
|
+
<a name="getCapos"></a>
|
|
1630
1527
|
|
|
1631
|
-
##
|
|
1632
|
-
|
|
1528
|
+
## getCapos(key) ⇒ <code>Object.<string, string></code>
|
|
1529
|
+
<p>Returns applicable capos for the provided key</p>
|
|
1530
|
+
|
|
1531
|
+
**Kind**: global function
|
|
1532
|
+
**Returns**: <code>Object.<string, string></code> - <p>The available capos, where the keys are capo numbers and the
|
|
1533
|
+
values are the effective key for that capo.</p>
|
|
1534
|
+
|
|
1535
|
+
| Param | Type | Description |
|
|
1536
|
+
| --- | --- | --- |
|
|
1537
|
+
| key | <code>Key</code> \| <code>string</code> | <p>The key to get capos for</p> |
|
|
1538
|
+
|
|
1539
|
+
<a name="getKeys"></a>
|
|
1633
1540
|
|
|
1634
|
-
|
|
1541
|
+
## getKeys(key) ⇒ <code>Array.<string></code>
|
|
1542
|
+
<p>Returns applicable keys to transpose to from the provided key</p>
|
|
1635
1543
|
|
|
1636
1544
|
**Kind**: global function
|
|
1545
|
+
**Returns**: <code>Array.<string></code> - <p>The available keys</p>
|
|
1637
1546
|
|
|
1638
|
-
| Param | Description |
|
|
1639
|
-
| --- | --- |
|
|
1640
|
-
|
|
|
1547
|
+
| Param | Type | Description |
|
|
1548
|
+
| --- | --- | --- |
|
|
1549
|
+
| key | <code>Key</code> \| <code>string</code> | <p>The key to get keys for</p> |
|
|
1641
1550
|
|