chordsheetjs 7.7.0 → 7.9.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 +203 -126
- package/lib/bundle.js +7121 -4206
- package/lib/index.js +7121 -4206
- package/lib/index.js.map +1 -1
- package/lib/main.d.ts +626 -528
- package/lib/main.d.ts.map +1 -1
- package/lib/module.js +7121 -4207
- package/lib/module.js.map +1 -1
- package/package.json +10 -5
package/README.md
CHANGED
|
@@ -379,7 +379,7 @@ metadata.get('author') // => 'John'</p>
|
|
|
379
379
|
<dt><a href="#HtmlDivFormatter">HtmlDivFormatter</a></dt>
|
|
380
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>
|
|
381
381
|
<dt><a href="#HtmlFormatter">HtmlFormatter</a></dt>
|
|
382
|
-
<dd><p>Acts as a base class for HTML formatters
|
|
382
|
+
<dd><p>Acts as a base class for HTML formatters</p></dd>
|
|
383
383
|
<dt><a href="#HtmlTableFormatter">HtmlTableFormatter</a></dt>
|
|
384
384
|
<dd><p>Formats a song into HTML. It uses TABLEs to align lyrics with chords, which makes the HTML for things like
|
|
385
385
|
PDF conversion.</p></dd>
|
|
@@ -387,10 +387,48 @@ PDF conversion.</p></dd>
|
|
|
387
387
|
<dd><p>Formats a song into a plain text chord sheet</p></dd>
|
|
388
388
|
<dt><a href="#ChordProParser">ChordProParser</a></dt>
|
|
389
389
|
<dd><p>Parses a ChordPro chord sheet</p></dd>
|
|
390
|
-
<dt><a href="#ChordSheetParser">ChordSheetParser</a></dt>
|
|
391
|
-
<dd><p>Parses a normal chord sheet</p
|
|
390
|
+
<dt><del><a href="#ChordSheetParser">ChordSheetParser</a></del></dt>
|
|
391
|
+
<dd><p>Parses a normal chord sheet</p>
|
|
392
|
+
<p>ChordSheetParser is deprecated, please use ChordsOverWordsParser.</p>
|
|
393
|
+
<p>ChordsOverWordsParser aims to support any kind of chord, whereas ChordSheetParser lacks
|
|
394
|
+
support for many variations. Besides that, some chordpro feature have been ported back
|
|
395
|
+
to ChordsOverWordsParser, which adds some interesting functionality.</p></dd>
|
|
396
|
+
<dt><a href="#ChordsOverWordsParser">ChordsOverWordsParser</a></dt>
|
|
397
|
+
<dd><p>Parses a chords over words sheet into a song</p>
|
|
398
|
+
<p>It support "regular" chord sheets:</p>
|
|
399
|
+
<pre><code> Am C/G F C
|
|
400
|
+
Let it be, let it be, let it be, let it be
|
|
401
|
+
C G F C/E Dm C
|
|
402
|
+
Whisper words of wisdom, let it be
|
|
403
|
+
</code></pre>
|
|
404
|
+
<p>Additionally, some chordpro features have been "ported back". For example, you can use chordpro directives:</p>
|
|
405
|
+
<pre><code>{title: Let it be}
|
|
406
|
+
{key: C}
|
|
407
|
+
Chorus 1:
|
|
408
|
+
Am
|
|
409
|
+
Let it be
|
|
410
|
+
</code></pre>
|
|
411
|
+
<p>For convenience, you can leave out the brackets:</p>
|
|
412
|
+
<pre><code>title: Let it be
|
|
413
|
+
Chorus 1:
|
|
414
|
+
Am
|
|
415
|
+
Let it be
|
|
416
|
+
</code></pre>
|
|
417
|
+
<p>You can even use a markdown style frontmatter separator to separate the header from the song:</p>
|
|
418
|
+
<pre><code>title: Let it be
|
|
419
|
+
key: C
|
|
420
|
+
---
|
|
421
|
+
Chorus 1:
|
|
422
|
+
Am C/G F C
|
|
423
|
+
Let it be, let it be, let it be, let it be
|
|
424
|
+
C G F C/E Dm C
|
|
425
|
+
Whisper words of wisdom, let it be
|
|
426
|
+
</code></pre>
|
|
427
|
+
<p><code>ChordsOverWordsParser</code> is the better version of <code>ChordSheetParser</code>, which is deprecated.</p></dd>
|
|
392
428
|
<dt><a href="#ParserWarning">ParserWarning</a></dt>
|
|
393
429
|
<dd><p>Represents a parser warning, currently only used by ChordProParser.</p></dd>
|
|
430
|
+
<dt><a href="#PegBasedParser">PegBasedParser</a></dt>
|
|
431
|
+
<dd><p>Parses a chords over words sheet</p></dd>
|
|
394
432
|
<dt><a href="#UltimateGuitarParser">UltimateGuitarParser</a></dt>
|
|
395
433
|
<dd><p>Parses an Ultimate Guitar chord sheet with metadata
|
|
396
434
|
Inherits from [ChordSheetParser](#ChordSheetParser)</p></dd>
|
|
@@ -453,6 +491,8 @@ See https://www.chordpro.org/chordpro/directives-key/</p></dd>
|
|
|
453
491
|
<dd><p>Year meta directive. See https://www.chordpro.org/chordpro/directives-year/</p></dd>
|
|
454
492
|
<dt><a href="#defaultCss">defaultCss</a> ⇒ <code>string</code></dt>
|
|
455
493
|
<dd><p>Generates basic CSS, scoped within the provided selector, to use with output generated by [HtmlTableFormatter](#HtmlTableFormatter)</p></dd>
|
|
494
|
+
<dt><a href="#defaultCss">defaultCss</a> ⇒ <code>string</code></dt>
|
|
495
|
+
<dd><p>Generates basic CSS, scoped within the provided selector, to use with output generated by [HtmlTableFormatter](#HtmlTableFormatter)</p></dd>
|
|
456
496
|
</dl>
|
|
457
497
|
|
|
458
498
|
## Constants
|
|
@@ -476,7 +516,7 @@ For a CSS string see [scopedCss](scopedCss)</p></dd>
|
|
|
476
516
|
## Functions
|
|
477
517
|
|
|
478
518
|
<dl>
|
|
479
|
-
<dt><del><a href="#parseChord">parseChord(chordString)</a> ⇒ <code
|
|
519
|
+
<dt><del><a href="#parseChord">parseChord(chordString)</a> ⇒ <code><a href="#Chord">Chord</a></code> | <code>null</code></del></dt>
|
|
480
520
|
<dd><p>Tries to parse a chord string into a chord</p></dd>
|
|
481
521
|
<dt><a href="#getCapos">getCapos(key)</a> ⇒ <code>Object.<string, string></code></dt>
|
|
482
522
|
<dd><p>Returns applicable capos for the provided key</p></dd>
|
|
@@ -504,10 +544,10 @@ For a CSS string see [scopedCss](scopedCss)</p></dd>
|
|
|
504
544
|
<p>Initialises a ChordLyricsPair</p>
|
|
505
545
|
|
|
506
546
|
|
|
507
|
-
| Param | Type | Description |
|
|
508
|
-
| --- | --- | --- |
|
|
509
|
-
| chords | <code>string</code> | <p>The chords</p> |
|
|
510
|
-
| lyrics | <code>string</code> | <p>The lyrics</p> |
|
|
547
|
+
| Param | Type | Default | Description |
|
|
548
|
+
| --- | --- | --- | --- |
|
|
549
|
+
| chords | <code>string</code> | | <p>The chords</p> |
|
|
550
|
+
| lyrics | <code>string</code> | <code>null</code> | <p>The lyrics</p> |
|
|
511
551
|
|
|
512
552
|
<a name="ChordLyricsPair+chords"></a>
|
|
513
553
|
|
|
@@ -573,7 +613,7 @@ metadata.get('author') // => 'John'</p>
|
|
|
573
613
|
<a name="Metadata+get"></a>
|
|
574
614
|
|
|
575
615
|
### metadata.get(prop) ⇒ <code>Array.<String></code> \| <code>String</code>
|
|
576
|
-
<p>Reads a metadata value by key. This method supports simple value lookup, as fetching single array values.</p>
|
|
616
|
+
<p>Reads a metadata value by key. This method supports simple value lookup, as well as fetching single array values.</p>
|
|
577
617
|
<p>This method deprecates direct property access, eg: metadata['author']</p>
|
|
578
618
|
<p>Examples:</p>
|
|
579
619
|
<p>const metadata = new Metadata({ lyricist: 'Pete', author: ['John', 'Mary'] });
|
|
@@ -875,7 +915,7 @@ song.mapLines((line) => {
|
|
|
875
915
|
* [Tag](#Tag)
|
|
876
916
|
* [.name](#Tag+name) : <code>string</code>
|
|
877
917
|
* [.originalName](#Tag+originalName) : <code>string</code>
|
|
878
|
-
* [.value](#Tag+value) : <code>string</code>
|
|
918
|
+
* [.value](#Tag+value) : <code>string</code>
|
|
879
919
|
* [.hasValue()](#Tag+hasValue) ⇒ <code>boolean</code>
|
|
880
920
|
* [.isRenderable()](#Tag+isRenderable) ⇒ <code>boolean</code>
|
|
881
921
|
* [.isMetaTag()](#Tag+isMetaTag) ⇒ <code>boolean</code>
|
|
@@ -895,7 +935,7 @@ song.mapLines((line) => {
|
|
|
895
935
|
**Kind**: instance property of [<code>Tag</code>](#Tag)
|
|
896
936
|
<a name="Tag+value"></a>
|
|
897
937
|
|
|
898
|
-
### tag.value : <code>string</code>
|
|
938
|
+
### tag.value : <code>string</code>
|
|
899
939
|
<p>The tag value</p>
|
|
900
940
|
|
|
901
941
|
**Kind**: instance property of [<code>Tag</code>](#Tag)
|
|
@@ -966,64 +1006,81 @@ song.mapLines((line) => {
|
|
|
966
1006
|
## HtmlDivFormatter
|
|
967
1007
|
<p>Formats a song into HTML. It uses DIVs to align lyrics with chords, which makes it useful for responsive web pages.</p>
|
|
968
1008
|
|
|
1009
|
+
**Kind**: global class
|
|
1010
|
+
<a name="HtmlFormatter"></a>
|
|
1011
|
+
|
|
1012
|
+
## HtmlFormatter
|
|
1013
|
+
<p>Acts as a base class for HTML formatters</p>
|
|
1014
|
+
|
|
969
1015
|
**Kind**: global class
|
|
970
1016
|
|
|
971
|
-
* [
|
|
1017
|
+
* [HtmlFormatter](#HtmlFormatter)
|
|
972
1018
|
* _instance_
|
|
973
|
-
* [.
|
|
1019
|
+
* [.cssObject](#HtmlFormatter+cssObject) ⇒ <code>Object.<string, Object.<string, string>></code>
|
|
1020
|
+
* [.format(song)](#HtmlFormatter+format) ⇒ <code>string</code>
|
|
1021
|
+
* [.cssString(scope)](#HtmlFormatter+cssString) ⇒ <code>string</code>
|
|
974
1022
|
* _static_
|
|
975
|
-
* [.cssString(
|
|
976
|
-
* [.cssObject()](#
|
|
1023
|
+
* ~~[.cssString()](#HtmlFormatter.cssString)~~
|
|
1024
|
+
* ~~[.cssObject()](#HtmlFormatter.cssObject)~~
|
|
977
1025
|
|
|
978
|
-
<a name="
|
|
1026
|
+
<a name="HtmlFormatter+cssObject"></a>
|
|
979
1027
|
|
|
980
|
-
###
|
|
1028
|
+
### htmlFormatter.cssObject ⇒ <code>Object.<string, Object.<string, string>></code>
|
|
1029
|
+
<p>Basic CSS, in object style à la useStyles, to use with the HTML output
|
|
1030
|
+
For a CSS string see [cssString](cssString)</p>
|
|
1031
|
+
<p>Example:</p>
|
|
1032
|
+
<pre><code>'.paragraph': {
|
|
1033
|
+
marginBottom: '1em'
|
|
1034
|
+
}
|
|
1035
|
+
</code></pre>
|
|
1036
|
+
|
|
1037
|
+
**Kind**: instance property of [<code>HtmlFormatter</code>](#HtmlFormatter)
|
|
1038
|
+
**Returns**: <code>Object.<string, Object.<string, string>></code> - <p>the CSS object</p>
|
|
1039
|
+
<a name="HtmlFormatter+format"></a>
|
|
1040
|
+
|
|
1041
|
+
### htmlFormatter.format(song) ⇒ <code>string</code>
|
|
981
1042
|
<p>Formats a song into HTML.</p>
|
|
982
1043
|
|
|
983
|
-
**Kind**: instance method of [<code>
|
|
1044
|
+
**Kind**: instance method of [<code>HtmlFormatter</code>](#HtmlFormatter)
|
|
984
1045
|
**Returns**: <code>string</code> - <p>The HTML string</p>
|
|
985
1046
|
|
|
986
1047
|
| Param | Type | Description |
|
|
987
1048
|
| --- | --- | --- |
|
|
988
1049
|
| song | [<code>Song</code>](#Song) | <p>The song to be formatted</p> |
|
|
989
1050
|
|
|
990
|
-
<a name="
|
|
1051
|
+
<a name="HtmlFormatter+cssString"></a>
|
|
991
1052
|
|
|
992
|
-
###
|
|
993
|
-
<p>Generates basic CSS, optionally scoped within the provided selector, to use with
|
|
994
|
-
[HtmlDivFormatter](#HtmlDivFormatter)</p>
|
|
1053
|
+
### htmlFormatter.cssString(scope) ⇒ <code>string</code>
|
|
1054
|
+
<p>Generates basic CSS, optionally scoped within the provided selector, to use with the HTML output</p>
|
|
995
1055
|
<p>For example, execute cssString('.chordSheetViewer') will result in CSS like:</p>
|
|
996
1056
|
<pre><code>.chordSheetViewer .paragraph {
|
|
997
1057
|
margin-bottom: 1em;
|
|
998
1058
|
}
|
|
999
1059
|
</code></pre>
|
|
1000
1060
|
|
|
1001
|
-
**Kind**:
|
|
1061
|
+
**Kind**: instance method of [<code>HtmlFormatter</code>](#HtmlFormatter)
|
|
1002
1062
|
**Returns**: <code>string</code> - <p>the CSS string</p>
|
|
1003
1063
|
|
|
1004
1064
|
| Param | Description |
|
|
1005
1065
|
| --- | --- |
|
|
1006
1066
|
| scope | <p>the CSS scope to use, for example <code>.chordSheetViewer</code></p> |
|
|
1007
1067
|
|
|
1008
|
-
<a name="
|
|
1068
|
+
<a name="HtmlFormatter.cssString"></a>
|
|
1009
1069
|
|
|
1010
|
-
###
|
|
1011
|
-
|
|
1012
|
-
<p>Example:</p>
|
|
1013
|
-
<pre><code>'.paragraph': {
|
|
1014
|
-
marginBottom: '1em'
|
|
1015
|
-
}
|
|
1016
|
-
</code></pre>
|
|
1017
|
-
<p>For a CSS string see [cssString](cssString)</p>
|
|
1070
|
+
### ~~HtmlFormatter.cssString()~~
|
|
1071
|
+
***Deprecated***
|
|
1018
1072
|
|
|
1019
|
-
|
|
1020
|
-
**Returns**: <code>Object.<string, Object.<string, string>></code> - <p>the CSS object</p>
|
|
1021
|
-
<a name="HtmlFormatter"></a>
|
|
1073
|
+
<p>Generates basic CSS, optionally scoped within the provided selector, to use with the HTML output</p>
|
|
1022
1074
|
|
|
1023
|
-
|
|
1024
|
-
<
|
|
1075
|
+
**Kind**: static method of [<code>HtmlFormatter</code>](#HtmlFormatter)
|
|
1076
|
+
<a name="HtmlFormatter.cssObject"></a>
|
|
1025
1077
|
|
|
1026
|
-
|
|
1078
|
+
### ~~HtmlFormatter.cssObject()~~
|
|
1079
|
+
***Deprecated***
|
|
1080
|
+
|
|
1081
|
+
<p>Basic CSS, in object style à la useStyles, to use with the HTML output</p>
|
|
1082
|
+
|
|
1083
|
+
**Kind**: static method of [<code>HtmlFormatter</code>](#HtmlFormatter)
|
|
1027
1084
|
<a name="HtmlTableFormatter"></a>
|
|
1028
1085
|
|
|
1029
1086
|
## HtmlTableFormatter
|
|
@@ -1031,57 +1088,6 @@ song.mapLines((line) => {
|
|
|
1031
1088
|
PDF conversion.</p>
|
|
1032
1089
|
|
|
1033
1090
|
**Kind**: global class
|
|
1034
|
-
|
|
1035
|
-
* [HtmlTableFormatter](#HtmlTableFormatter)
|
|
1036
|
-
* _instance_
|
|
1037
|
-
* [.format(song)](#HtmlTableFormatter+format) ⇒ <code>string</code>
|
|
1038
|
-
* _static_
|
|
1039
|
-
* [.cssString(scope)](#HtmlTableFormatter.cssString) ⇒ <code>string</code>
|
|
1040
|
-
* [.cssObject()](#HtmlTableFormatter.cssObject) ⇒ <code>Object.<string, Object.<string, string>></code>
|
|
1041
|
-
|
|
1042
|
-
<a name="HtmlTableFormatter+format"></a>
|
|
1043
|
-
|
|
1044
|
-
### htmlTableFormatter.format(song) ⇒ <code>string</code>
|
|
1045
|
-
<p>Formats a song into HTML.</p>
|
|
1046
|
-
|
|
1047
|
-
**Kind**: instance method of [<code>HtmlTableFormatter</code>](#HtmlTableFormatter)
|
|
1048
|
-
**Returns**: <code>string</code> - <p>The HTML string</p>
|
|
1049
|
-
|
|
1050
|
-
| Param | Type | Description |
|
|
1051
|
-
| --- | --- | --- |
|
|
1052
|
-
| song | [<code>Song</code>](#Song) | <p>The song to be formatted</p> |
|
|
1053
|
-
|
|
1054
|
-
<a name="HtmlTableFormatter.cssString"></a>
|
|
1055
|
-
|
|
1056
|
-
### HtmlTableFormatter.cssString(scope) ⇒ <code>string</code>
|
|
1057
|
-
<p>Generates basic CSS, optionally scoped within the provided selector, to use with output generated by
|
|
1058
|
-
[HtmlTableFormatter](#HtmlTableFormatter)</p>
|
|
1059
|
-
<p>For example, execute cssString('.chordSheetViewer') will result in CSS like:</p>
|
|
1060
|
-
<pre><code>.chordSheetViewer .paragraph {
|
|
1061
|
-
margin-bottom: 1em;
|
|
1062
|
-
}
|
|
1063
|
-
</code></pre>
|
|
1064
|
-
|
|
1065
|
-
**Kind**: static method of [<code>HtmlTableFormatter</code>](#HtmlTableFormatter)
|
|
1066
|
-
**Returns**: <code>string</code> - <p>the CSS string</p>
|
|
1067
|
-
|
|
1068
|
-
| Param | Description |
|
|
1069
|
-
| --- | --- |
|
|
1070
|
-
| scope | <p>the CSS scope to use, for example <code>.chordSheetViewer</code></p> |
|
|
1071
|
-
|
|
1072
|
-
<a name="HtmlTableFormatter.cssObject"></a>
|
|
1073
|
-
|
|
1074
|
-
### HtmlTableFormatter.cssObject() ⇒ <code>Object.<string, Object.<string, string>></code>
|
|
1075
|
-
<p>Basic CSS, in object style à la useStyles, to use with output generated by [HtmlTableFormatter](#HtmlTableFormatter)
|
|
1076
|
-
For a CSS string see [cssString](cssString)</p>
|
|
1077
|
-
<p>Example:</p>
|
|
1078
|
-
<pre><code>'.paragraph': {
|
|
1079
|
-
marginBottom: '1em'
|
|
1080
|
-
}
|
|
1081
|
-
</code></pre>
|
|
1082
|
-
|
|
1083
|
-
**Kind**: static method of [<code>HtmlTableFormatter</code>](#HtmlTableFormatter)
|
|
1084
|
-
**Returns**: <code>Object.<string, Object.<string, string>></code> - <p>the CSS object</p>
|
|
1085
1091
|
<a name="TextFormatter"></a>
|
|
1086
1092
|
|
|
1087
1093
|
## TextFormatter
|
|
@@ -1106,17 +1112,6 @@ For a CSS string see [cssString](cssString)</p>
|
|
|
1106
1112
|
<p>Parses a ChordPro chord sheet</p>
|
|
1107
1113
|
|
|
1108
1114
|
**Kind**: global class
|
|
1109
|
-
|
|
1110
|
-
* [ChordProParser](#ChordProParser)
|
|
1111
|
-
* [.warnings](#ChordProParser+warnings) : [<code>Array.<ParserWarning></code>](#ParserWarning)
|
|
1112
|
-
* [.parse(chordProChordSheet)](#ChordProParser+parse) ⇒ [<code>Song</code>](#Song)
|
|
1113
|
-
|
|
1114
|
-
<a name="ChordProParser+warnings"></a>
|
|
1115
|
-
|
|
1116
|
-
### chordProParser.warnings : [<code>Array.<ParserWarning></code>](#ParserWarning)
|
|
1117
|
-
<p>All warnings raised during parsing the ChordPro chord sheet</p>
|
|
1118
|
-
|
|
1119
|
-
**Kind**: instance property of [<code>ChordProParser</code>](#ChordProParser)
|
|
1120
1115
|
<a name="ChordProParser+parse"></a>
|
|
1121
1116
|
|
|
1122
1117
|
### chordProParser.parse(chordProChordSheet) ⇒ [<code>Song</code>](#Song)
|
|
@@ -1131,19 +1126,26 @@ For a CSS string see [cssString](cssString)</p>
|
|
|
1131
1126
|
|
|
1132
1127
|
<a name="ChordSheetParser"></a>
|
|
1133
1128
|
|
|
1134
|
-
## ChordSheetParser
|
|
1129
|
+
## ~~ChordSheetParser~~
|
|
1130
|
+
***Deprecated***
|
|
1131
|
+
|
|
1135
1132
|
<p>Parses a normal chord sheet</p>
|
|
1133
|
+
<p>ChordSheetParser is deprecated, please use ChordsOverWordsParser.</p>
|
|
1134
|
+
<p>ChordsOverWordsParser aims to support any kind of chord, whereas ChordSheetParser lacks
|
|
1135
|
+
support for many variations. Besides that, some chordpro feature have been ported back
|
|
1136
|
+
to ChordsOverWordsParser, which adds some interesting functionality.</p>
|
|
1136
1137
|
|
|
1137
1138
|
**Kind**: global class
|
|
1138
1139
|
|
|
1139
|
-
* [ChordSheetParser](#ChordSheetParser)
|
|
1140
|
+
* ~~[ChordSheetParser](#ChordSheetParser)~~
|
|
1140
1141
|
* [new ChordSheetParser([options])](#new_ChordSheetParser_new)
|
|
1141
1142
|
* [.parse(chordSheet, [options])](#ChordSheetParser+parse) ⇒ [<code>Song</code>](#Song)
|
|
1142
1143
|
|
|
1143
1144
|
<a name="new_ChordSheetParser_new"></a>
|
|
1144
1145
|
|
|
1145
1146
|
### new ChordSheetParser([options])
|
|
1146
|
-
<p>Instantiate a chord sheet parser
|
|
1147
|
+
<p>Instantiate a chord sheet parser
|
|
1148
|
+
ChordSheetParser is deprecated, please use ChordsOverWordsParser.</p>
|
|
1147
1149
|
|
|
1148
1150
|
|
|
1149
1151
|
| Param | Type | Default | Description |
|
|
@@ -1165,6 +1167,54 @@ For a CSS string see [cssString](cssString)</p>
|
|
|
1165
1167
|
| [options] | <code>Object</code> | <code>{}</code> | <p>Optional parser options</p> |
|
|
1166
1168
|
| [options.song] | [<code>Song</code>](#Song) | <code></code> | <p>The [Song](#Song) to store the song data in</p> |
|
|
1167
1169
|
|
|
1170
|
+
<a name="ChordsOverWordsParser"></a>
|
|
1171
|
+
|
|
1172
|
+
## ChordsOverWordsParser
|
|
1173
|
+
<p>Parses a chords over words sheet into a song</p>
|
|
1174
|
+
<p>It support "regular" chord sheets:</p>
|
|
1175
|
+
<pre><code> Am C/G F C
|
|
1176
|
+
Let it be, let it be, let it be, let it be
|
|
1177
|
+
C G F C/E Dm C
|
|
1178
|
+
Whisper words of wisdom, let it be
|
|
1179
|
+
</code></pre>
|
|
1180
|
+
<p>Additionally, some chordpro features have been "ported back". For example, you can use chordpro directives:</p>
|
|
1181
|
+
<pre><code>{title: Let it be}
|
|
1182
|
+
{key: C}
|
|
1183
|
+
Chorus 1:
|
|
1184
|
+
Am
|
|
1185
|
+
Let it be
|
|
1186
|
+
</code></pre>
|
|
1187
|
+
<p>For convenience, you can leave out the brackets:</p>
|
|
1188
|
+
<pre><code>title: Let it be
|
|
1189
|
+
Chorus 1:
|
|
1190
|
+
Am
|
|
1191
|
+
Let it be
|
|
1192
|
+
</code></pre>
|
|
1193
|
+
<p>You can even use a markdown style frontmatter separator to separate the header from the song:</p>
|
|
1194
|
+
<pre><code>title: Let it be
|
|
1195
|
+
key: C
|
|
1196
|
+
---
|
|
1197
|
+
Chorus 1:
|
|
1198
|
+
Am C/G F C
|
|
1199
|
+
Let it be, let it be, let it be, let it be
|
|
1200
|
+
C G F C/E Dm C
|
|
1201
|
+
Whisper words of wisdom, let it be
|
|
1202
|
+
</code></pre>
|
|
1203
|
+
<p><code>ChordsOverWordsParser</code> is the better version of <code>ChordSheetParser</code>, which is deprecated.</p>
|
|
1204
|
+
|
|
1205
|
+
**Kind**: global class
|
|
1206
|
+
<a name="ChordsOverWordsParser+parse"></a>
|
|
1207
|
+
|
|
1208
|
+
### chordsOverWordsParser.parse(chordsOverWordsSheet) ⇒ [<code>Song</code>](#Song)
|
|
1209
|
+
<p>Parses a chords over words sheet into a song</p>
|
|
1210
|
+
|
|
1211
|
+
**Kind**: instance method of [<code>ChordsOverWordsParser</code>](#ChordsOverWordsParser)
|
|
1212
|
+
**Returns**: [<code>Song</code>](#Song) - <p>The parsed song</p>
|
|
1213
|
+
|
|
1214
|
+
| Param | Type | Description |
|
|
1215
|
+
| --- | --- | --- |
|
|
1216
|
+
| chordsOverWordsSheet | <code>string</code> | <p>the chords over words sheet</p> |
|
|
1217
|
+
|
|
1168
1218
|
<a name="ParserWarning"></a>
|
|
1169
1219
|
|
|
1170
1220
|
## ParserWarning
|
|
@@ -1178,6 +1228,18 @@ For a CSS string see [cssString](cssString)</p>
|
|
|
1178
1228
|
|
|
1179
1229
|
**Kind**: instance method of [<code>ParserWarning</code>](#ParserWarning)
|
|
1180
1230
|
**Returns**: <code>string</code> - <p>The string warning</p>
|
|
1231
|
+
<a name="PegBasedParser"></a>
|
|
1232
|
+
|
|
1233
|
+
## PegBasedParser
|
|
1234
|
+
<p>Parses a chords over words sheet</p>
|
|
1235
|
+
|
|
1236
|
+
**Kind**: global class
|
|
1237
|
+
<a name="PegBasedParser+warnings"></a>
|
|
1238
|
+
|
|
1239
|
+
### pegBasedParser.warnings : [<code>Array.<ParserWarning></code>](#ParserWarning)
|
|
1240
|
+
<p>All warnings raised during parsing the chord sheet</p>
|
|
1241
|
+
|
|
1242
|
+
**Kind**: instance property of [<code>PegBasedParser</code>](#PegBasedParser)
|
|
1181
1243
|
<a name="UltimateGuitarParser"></a>
|
|
1182
1244
|
|
|
1183
1245
|
## UltimateGuitarParser
|
|
@@ -1195,14 +1257,14 @@ Inherits from [ChordSheetParser](#ChordSheetParser)</p>
|
|
|
1195
1257
|
* [Chord](#Chord)
|
|
1196
1258
|
* _instance_
|
|
1197
1259
|
* [.clone()](#Chord+clone) ⇒ [<code>Chord</code>](#Chord)
|
|
1198
|
-
* [.toChordSymbol([
|
|
1199
|
-
* [.toChordSymbolString([
|
|
1260
|
+
* [.toChordSymbol([referenceKey])](#Chord+toChordSymbol) ⇒ [<code>Chord</code>](#Chord)
|
|
1261
|
+
* [.toChordSymbolString([referenceKey])](#Chord+toChordSymbolString) ⇒ <code>string</code>
|
|
1200
1262
|
* [.isChordSymbol()](#Chord+isChordSymbol) ⇒ <code>boolean</code>
|
|
1201
|
-
* [.toNumeric([
|
|
1202
|
-
* [.toNumeral(
|
|
1203
|
-
* [.toNumeralString([
|
|
1263
|
+
* [.toNumeric([referenceKey])](#Chord+toNumeric) ⇒ [<code>Chord</code>](#Chord)
|
|
1264
|
+
* [.toNumeral([referenceKey])](#Chord+toNumeral) ⇒ [<code>Chord</code>](#Chord)
|
|
1265
|
+
* [.toNumeralString([referenceKey])](#Chord+toNumeralString) ⇒ <code>string</code>
|
|
1204
1266
|
* [.isNumeric()](#Chord+isNumeric) ⇒ <code>boolean</code>
|
|
1205
|
-
* [.toNumericString([
|
|
1267
|
+
* [.toNumericString([referenceKey])](#Chord+toNumericString) ⇒ <code>string</code>
|
|
1206
1268
|
* [.isNumeral()](#Chord+isNumeral) ⇒ <code>boolean</code>
|
|
1207
1269
|
* [.toString()](#Chord+toString) ⇒ <code>string</code>
|
|
1208
1270
|
* [.normalize([key], [options])](#Chord+normalize) ⇒ [<code>Chord</code>](#Chord)
|
|
@@ -1211,7 +1273,7 @@ Inherits from [ChordSheetParser](#ChordSheetParser)</p>
|
|
|
1211
1273
|
* [.transposeDown()](#Chord+transposeDown) ⇒ [<code>Chord</code>](#Chord)
|
|
1212
1274
|
* [.transpose(delta)](#Chord+transpose) ⇒ [<code>Chord</code>](#Chord)
|
|
1213
1275
|
* _static_
|
|
1214
|
-
* [.parse(chordString)](#Chord.parse) ⇒ <code>
|
|
1276
|
+
* [.parse(chordString)](#Chord.parse) ⇒ [<code>Chord</code>](#Chord) \| <code>null</code>
|
|
1215
1277
|
|
|
1216
1278
|
<a name="Chord+clone"></a>
|
|
1217
1279
|
|
|
@@ -1221,7 +1283,7 @@ Inherits from [ChordSheetParser](#ChordSheetParser)</p>
|
|
|
1221
1283
|
**Kind**: instance method of [<code>Chord</code>](#Chord)
|
|
1222
1284
|
<a name="Chord+toChordSymbol"></a>
|
|
1223
1285
|
|
|
1224
|
-
### chord.toChordSymbol([
|
|
1286
|
+
### chord.toChordSymbol([referenceKey]) ⇒ [<code>Chord</code>](#Chord)
|
|
1225
1287
|
<p>Converts the chord to a chord symbol, using the supplied key as a reference.
|
|
1226
1288
|
For example, a numeric chord <code>#4</code> with reference key <code>E</code> will return the chord symbol <code>A#</code>.
|
|
1227
1289
|
When the chord is already a chord symbol, it will return a clone of the object.</p>
|
|
@@ -1231,11 +1293,11 @@ When the chord is already a chord symbol, it will return a clone of the object.<
|
|
|
1231
1293
|
|
|
1232
1294
|
| Param | Type | Default | Description |
|
|
1233
1295
|
| --- | --- | --- | --- |
|
|
1234
|
-
| [
|
|
1296
|
+
| [referenceKey] | [<code>Key</code>](#Key) \| <code>string</code> \| <code>null</code> | <code></code> | <p>the reference key. The key is required when converting a numeric or numeral.</p> |
|
|
1235
1297
|
|
|
1236
1298
|
<a name="Chord+toChordSymbolString"></a>
|
|
1237
1299
|
|
|
1238
|
-
### chord.toChordSymbolString([
|
|
1300
|
+
### chord.toChordSymbolString([referenceKey]) ⇒ <code>string</code>
|
|
1239
1301
|
<p>Converts the chord to a chord symbol string, using the supplied key as a reference.
|
|
1240
1302
|
For example, a numeric chord <code>#4</code> with reference key <code>E</code> will return the chord symbol <code>A#</code>.
|
|
1241
1303
|
When the chord is already a chord symbol, it will return a string version of the chord.</p>
|
|
@@ -1246,7 +1308,7 @@ When the chord is already a chord symbol, it will return a string version of the
|
|
|
1246
1308
|
|
|
1247
1309
|
| Param | Type | Default | Description |
|
|
1248
1310
|
| --- | --- | --- | --- |
|
|
1249
|
-
| [
|
|
1311
|
+
| [referenceKey] | [<code>Key</code>](#Key) \| <code>string</code> \| <code>null</code> | <code></code> | <p>the reference key. The key is required when converting a numeric or numeral.</p> |
|
|
1250
1312
|
|
|
1251
1313
|
<a name="Chord+isChordSymbol"></a>
|
|
1252
1314
|
|
|
@@ -1256,7 +1318,7 @@ When the chord is already a chord symbol, it will return a string version of the
|
|
|
1256
1318
|
**Kind**: instance method of [<code>Chord</code>](#Chord)
|
|
1257
1319
|
<a name="Chord+toNumeric"></a>
|
|
1258
1320
|
|
|
1259
|
-
### chord.toNumeric([
|
|
1321
|
+
### chord.toNumeric([referenceKey]) ⇒ [<code>Chord</code>](#Chord)
|
|
1260
1322
|
<p>Converts the chord to a numeric chord, using the supplied key as a reference.
|
|
1261
1323
|
For example, a chord symbol A# with reference key E will return the numeric chord #4.</p>
|
|
1262
1324
|
|
|
@@ -1265,11 +1327,11 @@ For example, a chord symbol A# with reference key E will return the numeric chor
|
|
|
1265
1327
|
|
|
1266
1328
|
| Param | Type | Default | Description |
|
|
1267
1329
|
| --- | --- | --- | --- |
|
|
1268
|
-
| [
|
|
1330
|
+
| [referenceKey] | [<code>Key</code>](#Key) \| <code>string</code> \| <code>null</code> | <code></code> | <p>the reference key. The key is required when converting a chord symbol</p> |
|
|
1269
1331
|
|
|
1270
1332
|
<a name="Chord+toNumeral"></a>
|
|
1271
1333
|
|
|
1272
|
-
### chord.toNumeral(
|
|
1334
|
+
### chord.toNumeral([referenceKey]) ⇒ [<code>Chord</code>](#Chord)
|
|
1273
1335
|
<p>Converts the chord to a numeral chord, using the supplied key as a reference.
|
|
1274
1336
|
For example, a chord symbol A# with reference key E will return the numeral chord #IV.</p>
|
|
1275
1337
|
|
|
@@ -1278,11 +1340,11 @@ For example, a chord symbol A# with reference key E will return the numeral chor
|
|
|
1278
1340
|
|
|
1279
1341
|
| Param | Type | Default | Description |
|
|
1280
1342
|
| --- | --- | --- | --- |
|
|
1281
|
-
|
|
|
1343
|
+
| [referenceKey] | [<code>Key</code>](#Key) \| <code>string</code> \| <code>null</code> | <code></code> | <p>the reference key. The key is required when converting a chord symbol</p> |
|
|
1282
1344
|
|
|
1283
1345
|
<a name="Chord+toNumeralString"></a>
|
|
1284
1346
|
|
|
1285
|
-
### chord.toNumeralString([
|
|
1347
|
+
### chord.toNumeralString([referenceKey]) ⇒ <code>string</code>
|
|
1286
1348
|
<p>Converts the chord to a numeral chord string, using the supplied kye as a reference.
|
|
1287
1349
|
For example, a chord symbol A# with reference key E will return the numeral chord #4.</p>
|
|
1288
1350
|
|
|
@@ -1292,7 +1354,7 @@ For example, a chord symbol A# with reference key E will return the numeral chor
|
|
|
1292
1354
|
|
|
1293
1355
|
| Param | Type | Default | Description |
|
|
1294
1356
|
| --- | --- | --- | --- |
|
|
1295
|
-
| [
|
|
1357
|
+
| [referenceKey] | [<code>Key</code>](#Key) \| <code>string</code> \| <code>null</code> | <code></code> | <p>the reference key. The key is required when converting a chord symbol</p> |
|
|
1296
1358
|
|
|
1297
1359
|
<a name="Chord+isNumeric"></a>
|
|
1298
1360
|
|
|
@@ -1302,7 +1364,7 @@ For example, a chord symbol A# with reference key E will return the numeral chor
|
|
|
1302
1364
|
**Kind**: instance method of [<code>Chord</code>](#Chord)
|
|
1303
1365
|
<a name="Chord+toNumericString"></a>
|
|
1304
1366
|
|
|
1305
|
-
### chord.toNumericString([
|
|
1367
|
+
### chord.toNumericString([referenceKey]) ⇒ <code>string</code>
|
|
1306
1368
|
<p>Converts the chord to a numeric chord string, using the supplied kye as a reference.
|
|
1307
1369
|
For example, a chord symbol A# with reference key E will return the numeric chord #4.</p>
|
|
1308
1370
|
|
|
@@ -1312,7 +1374,7 @@ For example, a chord symbol A# with reference key E will return the numeric chor
|
|
|
1312
1374
|
|
|
1313
1375
|
| Param | Type | Default | Description |
|
|
1314
1376
|
| --- | --- | --- | --- |
|
|
1315
|
-
| [
|
|
1377
|
+
| [referenceKey] | [<code>Key</code>](#Key) \| <code>string</code> \| <code>null</code> | <code></code> | <p>the reference key. The key is required when converting a chord symbol</p> |
|
|
1316
1378
|
|
|
1317
1379
|
<a name="Chord+isNumeral"></a>
|
|
1318
1380
|
|
|
@@ -1344,6 +1406,8 @@ For example, a chord symbol A# with reference key E will return the numeric chor
|
|
|
1344
1406
|
<p>Besides that it normalizes the suffix if <code>normalizeSuffix</code> is <code>true</code>.
|
|
1345
1407
|
For example, <code>sus2</code> becomes <code>2</code>, <code>sus4</code> becomes <code>sus</code>.
|
|
1346
1408
|
All suffix normalizations can be found in <code>src/normalize_mappings/suffix-mapping.txt</code>.</p>
|
|
1409
|
+
<p>When the chord is minor, bass notes are normalized off of the relative major
|
|
1410
|
+
of the root note. For example, <code>Em/A#</code> becomes <code>Em/Bb</code>.</p>
|
|
1347
1411
|
|
|
1348
1412
|
**Kind**: instance method of [<code>Chord</code>](#Chord)
|
|
1349
1413
|
**Returns**: [<code>Chord</code>](#Chord) - <p>the normalized chord</p>
|
|
@@ -1394,14 +1458,15 @@ All suffix normalizations can be found in <code>src/normalize_mappings/suffix-ma
|
|
|
1394
1458
|
|
|
1395
1459
|
<a name="Chord.parse"></a>
|
|
1396
1460
|
|
|
1397
|
-
### Chord.parse(chordString) ⇒ <code>
|
|
1398
|
-
<p>Tries to parse a chord string into a chord
|
|
1461
|
+
### Chord.parse(chordString) ⇒ [<code>Chord</code>](#Chord) \| <code>null</code>
|
|
1462
|
+
<p>Tries to parse a chord string into a chord
|
|
1463
|
+
Any leading or trailing whitespace is removed first, so a chord like <code> \n E/G# \r</code> is valid.</p>
|
|
1399
1464
|
|
|
1400
1465
|
**Kind**: static method of [<code>Chord</code>](#Chord)
|
|
1401
1466
|
|
|
1402
1467
|
| Param | Description |
|
|
1403
1468
|
| --- | --- |
|
|
1404
|
-
| chordString | <p>the chord string, eg <code>Esus4/G#</code> or <code>1sus4/#3</code
|
|
1469
|
+
| chordString | <p>the chord string, eg <code>Esus4/G#</code> or <code>1sus4/#3</code>.</p> |
|
|
1405
1470
|
|
|
1406
1471
|
<a name="ChordSheetSerializer"></a>
|
|
1407
1472
|
|
|
@@ -1601,6 +1666,18 @@ See https://www.chordpro.org/chordpro/directives-key/</p>
|
|
|
1601
1666
|
|
|
1602
1667
|
<a name="defaultCss"></a>
|
|
1603
1668
|
|
|
1669
|
+
## defaultCss ⇒ <code>string</code>
|
|
1670
|
+
<p>Generates basic CSS, scoped within the provided selector, to use with output generated by [HtmlTableFormatter](#HtmlTableFormatter)</p>
|
|
1671
|
+
|
|
1672
|
+
**Kind**: global variable
|
|
1673
|
+
**Returns**: <code>string</code> - <p>the CSS string</p>
|
|
1674
|
+
|
|
1675
|
+
| Param | Description |
|
|
1676
|
+
| --- | --- |
|
|
1677
|
+
| scope | <p>the CSS scope to use, for example <code>.chordSheetViewer</code></p> |
|
|
1678
|
+
|
|
1679
|
+
<a name="defaultCss"></a>
|
|
1680
|
+
|
|
1604
1681
|
## defaultCss : <code>Object.<string, Object.<string, string>></code>
|
|
1605
1682
|
<p>Basic CSS, in object style à la useStyles, to use with output generated by {@link }HtmlTableFormatter}
|
|
1606
1683
|
For a CSS string see [scopedCss](scopedCss)</p>
|
|
@@ -1638,7 +1715,7 @@ For a CSS string see [scopedCss](scopedCss)</p>
|
|
|
1638
1715
|
**Kind**: global constant
|
|
1639
1716
|
<a name="parseChord"></a>
|
|
1640
1717
|
|
|
1641
|
-
## ~~parseChord(chordString) ⇒ <code>
|
|
1718
|
+
## ~~parseChord(chordString) ⇒ [<code>Chord</code>](#Chord) \| <code>null</code>~~
|
|
1642
1719
|
***Deprecated***
|
|
1643
1720
|
|
|
1644
1721
|
<p>Tries to parse a chord string into a chord</p>
|