chordsheetjs 14.0.0 → 14.1.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/lib/bundle.js +444 -85
- package/lib/bundle.min.js +163 -163
- package/lib/index.js +381 -59
- package/lib/index.js.map +1 -1
- package/lib/main.d.ts +22 -5
- package/lib/main.d.ts.map +1 -1
- package/lib/module.js +381 -60
- package/lib/module.js.map +1 -1
- package/package.json +8 -7
package/lib/index.js
CHANGED
|
@@ -77,6 +77,7 @@ $parcel$export(module.exports, "NUMERIC", () => $dce48cb70c4120bb$export$4d31898
|
|
|
77
77
|
$parcel$export(module.exports, "SOLFEGE", () => $dce48cb70c4120bb$export$539a6499f4711c57);
|
|
78
78
|
$parcel$export(module.exports, "SYMBOL", () => $dce48cb70c4120bb$export$27c95a7104c1f7aa);
|
|
79
79
|
$parcel$export(module.exports, "TAB", () => $dce48cb70c4120bb$export$f1c9dd0f5207dd5e);
|
|
80
|
+
$parcel$export(module.exports, "TEXTBLOCK", () => $dce48cb70c4120bb$export$5a2cf64ea612936a);
|
|
80
81
|
$parcel$export(module.exports, "VERSE", () => $dce48cb70c4120bb$export$4b194284baed1659);
|
|
81
82
|
$parcel$export(module.exports, "PART", () => $dce48cb70c4120bb$export$609cc0ea1637d6a0);
|
|
82
83
|
$parcel$export(module.exports, "NUMERAL", () => $dce48cb70c4120bb$export$1321df9b16c30c6a);
|
|
@@ -380,6 +381,7 @@ const $dce48cb70c4120bb$export$4b194284baed1659 = 'verse';
|
|
|
380
381
|
const $dce48cb70c4120bb$export$609cc0ea1637d6a0 = 'part';
|
|
381
382
|
const $dce48cb70c4120bb$export$6a5a2eab72b6e3d = 'ly';
|
|
382
383
|
const $dce48cb70c4120bb$export$92249c36c213e508 = 'abc';
|
|
384
|
+
const $dce48cb70c4120bb$export$5a2cf64ea612936a = 'textblock';
|
|
383
385
|
const $dce48cb70c4120bb$export$27c95a7104c1f7aa = 'symbol';
|
|
384
386
|
const $dce48cb70c4120bb$export$4d318981b5a83836 = 'numeric';
|
|
385
387
|
const $dce48cb70c4120bb$export$1321df9b16c30c6a = 'numeral';
|
|
@@ -2552,7 +2554,7 @@ const $c2d6ab25ad00308f$var$PREFERS_FLAT_NUMBERS = [
|
|
|
2552
2554
|
var $c2d6ab25ad00308f$export$2e2bcd8739ae039 = $c2d6ab25ad00308f$var$Key;
|
|
2553
2555
|
|
|
2554
2556
|
|
|
2555
|
-
// Generated by peggy v. 5.0
|
|
2557
|
+
// Generated by peggy v. 5.1.0 (ts-pegjs plugin v. 3.1.0 )
|
|
2556
2558
|
//
|
|
2557
2559
|
// https://peggyjs.org/ https://github.com/metadevpro/ts-pegjs
|
|
2558
2560
|
"use strict";
|
|
@@ -4211,7 +4213,7 @@ const $b0c0093f9a3a0967$export$98e6a39c04603d36 = $b0c0093f9a3a0967$var$peg$pars
|
|
|
4211
4213
|
var $177a605b8569b31c$export$2e2bcd8739ae039 = $177a605b8569b31c$var$Chord;
|
|
4212
4214
|
|
|
4213
4215
|
|
|
4214
|
-
// Generated by peggy v. 5.0
|
|
4216
|
+
// Generated by peggy v. 5.1.0 (ts-pegjs plugin v. 3.1.0 )
|
|
4215
4217
|
//
|
|
4216
4218
|
// https://peggyjs.org/ https://github.com/metadevpro/ts-pegjs
|
|
4217
4219
|
"use strict";
|
|
@@ -5187,6 +5189,8 @@ const $d21c5c7a462f3c34$export$4f5168acae064e01 = 'start_of_chorus';
|
|
|
5187
5189
|
const $d21c5c7a462f3c34$export$b7e6dcd848b88f43 = 'start_of_grid';
|
|
5188
5190
|
const $d21c5c7a462f3c34$export$634ff7795b596e62 = 'start_of_ly';
|
|
5189
5191
|
const $d21c5c7a462f3c34$export$8dd1111100e0e88d = 'start_of_tab';
|
|
5192
|
+
const $d21c5c7a462f3c34$export$4252eb8e075f7d7a = 'start_of_textblock';
|
|
5193
|
+
const $d21c5c7a462f3c34$export$f1e557abc415d751 = 'end_of_textblock';
|
|
5190
5194
|
const $d21c5c7a462f3c34$export$deca399f8cd9b7dc = 'start_of_verse';
|
|
5191
5195
|
const $d21c5c7a462f3c34$export$2b9510a208875fc9 = 'start_of_part';
|
|
5192
5196
|
const $d21c5c7a462f3c34$export$5895c693c74b9cf4 = 'subtitle';
|
|
@@ -5216,6 +5220,7 @@ const $35ced0783ee29c4f$var$START_TAG_TO_SECTION_TYPE = {
|
|
|
5216
5220
|
[(0, $d21c5c7a462f3c34$export$b7e6dcd848b88f43)]: (0, $dce48cb70c4120bb$export$e2b0b9a5e613f348),
|
|
5217
5221
|
[(0, $d21c5c7a462f3c34$export$634ff7795b596e62)]: (0, $dce48cb70c4120bb$export$6a5a2eab72b6e3d),
|
|
5218
5222
|
[(0, $d21c5c7a462f3c34$export$8dd1111100e0e88d)]: (0, $dce48cb70c4120bb$export$f1c9dd0f5207dd5e),
|
|
5223
|
+
[(0, $d21c5c7a462f3c34$export$4252eb8e075f7d7a)]: (0, $dce48cb70c4120bb$export$5a2cf64ea612936a),
|
|
5219
5224
|
[(0, $d21c5c7a462f3c34$export$deca399f8cd9b7dc)]: (0, $dce48cb70c4120bb$export$4b194284baed1659)
|
|
5220
5225
|
};
|
|
5221
5226
|
const $35ced0783ee29c4f$var$END_TAG_TO_SECTION_TYPE = {
|
|
@@ -5225,6 +5230,7 @@ const $35ced0783ee29c4f$var$END_TAG_TO_SECTION_TYPE = {
|
|
|
5225
5230
|
[(0, $d21c5c7a462f3c34$export$4b28ac1ae75aff60)]: (0, $dce48cb70c4120bb$export$e2b0b9a5e613f348),
|
|
5226
5231
|
[(0, $d21c5c7a462f3c34$export$e3f6cdbd95b1f8f)]: (0, $dce48cb70c4120bb$export$6a5a2eab72b6e3d),
|
|
5227
5232
|
[(0, $d21c5c7a462f3c34$export$66a0ef3ffeab32b7)]: (0, $dce48cb70c4120bb$export$f1c9dd0f5207dd5e),
|
|
5233
|
+
[(0, $d21c5c7a462f3c34$export$f1e557abc415d751)]: (0, $dce48cb70c4120bb$export$5a2cf64ea612936a),
|
|
5228
5234
|
[(0, $d21c5c7a462f3c34$export$640d294ab83f9040)]: (0, $dce48cb70c4120bb$export$4b194284baed1659)
|
|
5229
5235
|
};
|
|
5230
5236
|
const $35ced0783ee29c4f$var$SECTION_START_REGEX = /^start_of_(.+)$/;
|
|
@@ -5355,6 +5361,7 @@ const $7251dad5f4a4c35f$var$DIRECTIVES_WITH_RENDERABLE_LABEL = [
|
|
|
5355
5361
|
(0, $d21c5c7a462f3c34$export$b7e6dcd848b88f43),
|
|
5356
5362
|
(0, $d21c5c7a462f3c34$export$634ff7795b596e62),
|
|
5357
5363
|
(0, $d21c5c7a462f3c34$export$8dd1111100e0e88d),
|
|
5364
|
+
(0, $d21c5c7a462f3c34$export$4252eb8e075f7d7a),
|
|
5358
5365
|
(0, $d21c5c7a462f3c34$export$deca399f8cd9b7dc),
|
|
5359
5366
|
(0, $d21c5c7a462f3c34$export$2b9510a208875fc9)
|
|
5360
5367
|
];
|
|
@@ -6317,7 +6324,8 @@ var $15f1d40e3d1ed3a0$export$2e2bcd8739ae039 = $15f1d40e3d1ed3a0$var$Ternary;
|
|
|
6317
6324
|
* @param {Song} song The song to be formatted
|
|
6318
6325
|
* @returns {string} The ChordPro string
|
|
6319
6326
|
*/ format(song) {
|
|
6320
|
-
const { lines: lines
|
|
6327
|
+
const { lines: lines } = song;
|
|
6328
|
+
const metadata = song.getMetadata(this.configuration);
|
|
6321
6329
|
const { metadataLines: metadataLines, contentLines: contentLines } = this.separateMetadataFromContent(lines);
|
|
6322
6330
|
const formattedMetadataLines = this.formatMetadataSection(metadataLines);
|
|
6323
6331
|
const formattedContentLines = this.formatContentSection(contentLines, metadata);
|
|
@@ -6594,6 +6602,7 @@ var $3b7d86e1e1307736$export$2e2bcd8739ae039 = $3b7d86e1e1307736$var$Font;
|
|
|
6594
6602
|
this.transposeKey = null;
|
|
6595
6603
|
this.lineNumber = null;
|
|
6596
6604
|
this.selector = null;
|
|
6605
|
+
this.selectorIsNegated = false;
|
|
6597
6606
|
/**
|
|
6598
6607
|
* The text font that applies to this line. Is derived from the directives:
|
|
6599
6608
|
* `textfont`, `textsize` and `textcolour`
|
|
@@ -6842,7 +6851,7 @@ function $5c7afec93ec943b9$var$appendValue(array, value) {
|
|
|
6842
6851
|
* See {@link Metadata#get}
|
|
6843
6852
|
*/ class $5c7afec93ec943b9$var$Metadata extends (0, $9047ab737bb447ce$export$2e2bcd8739ae039) {
|
|
6844
6853
|
constructor(metadata = {}){
|
|
6845
|
-
super(), this.metadata = {};
|
|
6854
|
+
super(), this.metadata = {}, this.providers = new Map();
|
|
6846
6855
|
if (metadata instanceof $5c7afec93ec943b9$var$Metadata) this.assign(metadata.metadata);
|
|
6847
6856
|
else this.assign(metadata);
|
|
6848
6857
|
}
|
|
@@ -6875,6 +6884,9 @@ function $5c7afec93ec943b9$var$appendValue(array, value) {
|
|
|
6875
6884
|
value
|
|
6876
6885
|
];
|
|
6877
6886
|
}
|
|
6887
|
+
setProvider(key, provider) {
|
|
6888
|
+
this.providers.set(key, provider);
|
|
6889
|
+
}
|
|
6878
6890
|
set(key, value) {
|
|
6879
6891
|
if (value) this.metadata[key] = value;
|
|
6880
6892
|
else delete this.metadata[key];
|
|
@@ -6909,12 +6921,25 @@ function $5c7afec93ec943b9$var$appendValue(array, value) {
|
|
|
6909
6921
|
*/ get(prop) {
|
|
6910
6922
|
if (prop === (0, $d21c5c7a462f3c34$export$430b1920f5feeae)) return this.calculateKeyFromCapo();
|
|
6911
6923
|
if (prop in this.metadata) return this.metadata[prop];
|
|
6924
|
+
const provider = this.providers.get(prop);
|
|
6925
|
+
if (provider) return provider();
|
|
6912
6926
|
return this.getArrayItem(prop);
|
|
6913
6927
|
}
|
|
6914
6928
|
/**
|
|
6915
|
-
* Returns all metadata values, including generated values like `_key`.
|
|
6929
|
+
* Returns all metadata values, including provider values and generated values like `_key`.
|
|
6916
6930
|
* @returns {Object.<string, string|string[]>} the metadata values
|
|
6917
6931
|
*/ all() {
|
|
6932
|
+
const all = {};
|
|
6933
|
+
this.providers.forEach((provider, providerKey)=>{
|
|
6934
|
+
const value = provider();
|
|
6935
|
+
if (value !== null) all[providerKey] = value;
|
|
6936
|
+
});
|
|
6937
|
+
Object.assign(all, this.metadata);
|
|
6938
|
+
const key = this.calculateKeyFromCapo();
|
|
6939
|
+
if (key) all[0, $d21c5c7a462f3c34$export$430b1920f5feeae] = key;
|
|
6940
|
+
return all;
|
|
6941
|
+
}
|
|
6942
|
+
ownMetadata() {
|
|
6918
6943
|
const all = {
|
|
6919
6944
|
...this.metadata
|
|
6920
6945
|
};
|
|
@@ -6923,7 +6948,7 @@ function $5c7afec93ec943b9$var$appendValue(array, value) {
|
|
|
6923
6948
|
return all;
|
|
6924
6949
|
}
|
|
6925
6950
|
[Symbol.iterator]() {
|
|
6926
|
-
return Object.entries(this.
|
|
6951
|
+
return Object.entries(this.ownMetadata())[Symbol.iterator]();
|
|
6927
6952
|
}
|
|
6928
6953
|
/**
|
|
6929
6954
|
* Returns a single metadata value. If the actual value is an array, it returns the first value. Else, it returns
|
|
@@ -6960,7 +6985,9 @@ function $5c7afec93ec943b9$var$appendValue(array, value) {
|
|
|
6960
6985
|
* Returns a deep clone of this Metadata object
|
|
6961
6986
|
* @returns {Metadata} the cloned Metadata object
|
|
6962
6987
|
*/ clone() {
|
|
6963
|
-
|
|
6988
|
+
const cloned = new $5c7afec93ec943b9$var$Metadata(this.metadata);
|
|
6989
|
+
this.providers.forEach((provider, key)=>cloned.setProvider(key, provider));
|
|
6990
|
+
return cloned;
|
|
6964
6991
|
}
|
|
6965
6992
|
calculateKeyFromCapo() {
|
|
6966
6993
|
const capoString = this.getSingle((0, $d21c5c7a462f3c34$export$866f445d49bad88e));
|
|
@@ -7048,6 +7075,9 @@ function $8906e348466806fd$var$getCommonValue(values, fallback) {
|
|
|
7048
7075
|
const selectors = this.lines.map((line)=>line.selector).filter((selector)=>selector !== null);
|
|
7049
7076
|
return $8906e348466806fd$var$getCommonValue(selectors, null);
|
|
7050
7077
|
}
|
|
7078
|
+
get selectorIsNegated() {
|
|
7079
|
+
return this.lines.some((line)=>line.selectorIsNegated);
|
|
7080
|
+
}
|
|
7051
7081
|
/**
|
|
7052
7082
|
* Indicates whether the paragraph contains lines with renderable items.
|
|
7053
7083
|
* @see {@link Line.hasRenderableItems}
|
|
@@ -7223,6 +7253,7 @@ class $69c885ea9d252cfd$var$SongBuilder {
|
|
|
7223
7253
|
this.metadata = new (0, $5c7afec93ec943b9$export$2e2bcd8739ae039)();
|
|
7224
7254
|
this.sectionType = (0, $dce48cb70c4120bb$export$c53d0f541b41b88e);
|
|
7225
7255
|
this.selector = null;
|
|
7256
|
+
this.selectorIsNegated = false;
|
|
7226
7257
|
this.transposeKey = null;
|
|
7227
7258
|
this.warnings = [];
|
|
7228
7259
|
this.song = song;
|
|
@@ -7240,16 +7271,17 @@ class $69c885ea9d252cfd$var$SongBuilder {
|
|
|
7240
7271
|
this.currentLine = new (0, $76b2b227aa06e8bf$export$2e2bcd8739ae039)();
|
|
7241
7272
|
this.lines.push(this.currentLine);
|
|
7242
7273
|
}
|
|
7243
|
-
this.setCurrentProperties(this.sectionType, this.selector);
|
|
7274
|
+
this.setCurrentProperties(this.sectionType, this.selector, this.selectorIsNegated);
|
|
7244
7275
|
this.currentLine.transposeKey = this.transposeKey ?? this.currentKey;
|
|
7245
7276
|
this.currentLine.key = this.currentKey || this.song.getMetadata().getSingle((0, $d21c5c7a462f3c34$export$7167c830cefcb6b5));
|
|
7246
7277
|
this.currentLine.lineNumber = this.lines.length - 1;
|
|
7247
7278
|
return this.currentLine;
|
|
7248
7279
|
}
|
|
7249
|
-
setCurrentProperties(sectionType, selector = null) {
|
|
7280
|
+
setCurrentProperties(sectionType, selector = null, isNegated = false) {
|
|
7250
7281
|
if (!this.currentLine) throw new Error('Expected this.currentLine to be present');
|
|
7251
7282
|
this.currentLine.type = sectionType;
|
|
7252
7283
|
this.currentLine.selector = selector;
|
|
7284
|
+
this.currentLine.selectorIsNegated = isNegated;
|
|
7253
7285
|
this.currentLine.textFont = this.fontStack.textFont.clone();
|
|
7254
7286
|
this.currentLine.chordFont = this.fontStack.chordFont.clone();
|
|
7255
7287
|
}
|
|
@@ -7299,14 +7331,16 @@ class $69c885ea9d252cfd$var$SongBuilder {
|
|
|
7299
7331
|
startSection(sectionType, tag) {
|
|
7300
7332
|
this.checkCurrentSectionType((0, $dce48cb70c4120bb$export$c53d0f541b41b88e), tag);
|
|
7301
7333
|
this.selector = tag.selector;
|
|
7334
|
+
this.selectorIsNegated = tag.isNegated;
|
|
7302
7335
|
if (sectionType === (0, $dce48cb70c4120bb$export$609cc0ea1637d6a0) && tag.value) this.sectionType = tag.value.split(' ')[0].toLowerCase();
|
|
7303
7336
|
else this.sectionType = sectionType;
|
|
7304
|
-
this.setCurrentProperties(sectionType, tag.selector);
|
|
7337
|
+
this.setCurrentProperties(sectionType, tag.selector, tag.isNegated);
|
|
7305
7338
|
}
|
|
7306
7339
|
endSection(sectionType, tag) {
|
|
7307
7340
|
this.checkCurrentSectionType(sectionType, tag);
|
|
7308
7341
|
this.sectionType = (0, $dce48cb70c4120bb$export$c53d0f541b41b88e);
|
|
7309
7342
|
this.selector = null;
|
|
7343
|
+
this.selectorIsNegated = false;
|
|
7310
7344
|
}
|
|
7311
7345
|
checkCurrentSectionType(sectionType, tag) {
|
|
7312
7346
|
if (this.sectionType !== sectionType && !(sectionType === 'part' && tag.name === 'end_of_part')) this.addWarning(`Unexpected tag {${tag.originalName}}, current section is: ${this.sectionType}`, tag);
|
|
@@ -7830,6 +7864,33 @@ function $2ce1086ce25c9ac0$export$efb38dd75b8e2957({ selector: selector, isNegat
|
|
|
7830
7864
|
|
|
7831
7865
|
|
|
7832
7866
|
|
|
7867
|
+
function $4903bcb4483a26e6$var$formatDate(date) {
|
|
7868
|
+
const year = date.getFullYear();
|
|
7869
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
7870
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
7871
|
+
return `${year}-${month}-${day}`;
|
|
7872
|
+
}
|
|
7873
|
+
function $4903bcb4483a26e6$export$12c349605689fe7a() {
|
|
7874
|
+
const providers = new Map();
|
|
7875
|
+
providers.set('chordpro', ()=>'ChordPro');
|
|
7876
|
+
providers.set('chordpro.version', ()=>'14.0.0');
|
|
7877
|
+
providers.set('today', ()=>$4903bcb4483a26e6$var$formatDate(new Date()));
|
|
7878
|
+
return providers;
|
|
7879
|
+
}
|
|
7880
|
+
function $4903bcb4483a26e6$export$9b09a67f52000acf(configuration) {
|
|
7881
|
+
const providers = $4903bcb4483a26e6$export$12c349605689fe7a();
|
|
7882
|
+
const { instrument: instrument, user: user } = configuration;
|
|
7883
|
+
providers.set('instrument', ()=>instrument?.type ?? null);
|
|
7884
|
+
providers.set('instrument.type', ()=>instrument?.type ?? null);
|
|
7885
|
+
providers.set('instrument.description', ()=>instrument?.description ?? null);
|
|
7886
|
+
providers.set('tuning', ()=>instrument?.tuning ?? null);
|
|
7887
|
+
providers.set('user', ()=>user?.name ?? null);
|
|
7888
|
+
providers.set('user.name', ()=>user?.name ?? null);
|
|
7889
|
+
providers.set('user.fullname', ()=>user?.fullname ?? null);
|
|
7890
|
+
return providers;
|
|
7891
|
+
}
|
|
7892
|
+
|
|
7893
|
+
|
|
7833
7894
|
|
|
7834
7895
|
/**
|
|
7835
7896
|
* Represents a song in a chord sheet. Currently a chord sheet can only have one song.
|
|
@@ -7872,6 +7933,20 @@ function $2ce1086ce25c9ac0$export$efb38dd75b8e2957({ selector: selector, isNegat
|
|
|
7872
7933
|
const expandedLines = this.lines.flatMap((line)=>(0, $cbaaf2a368d4190f$export$2e2bcd8739ae039).expand(line, this));
|
|
7873
7934
|
return this.selectRenderableItems(this.linesToParagraphs(expandedLines));
|
|
7874
7935
|
}
|
|
7936
|
+
filterParagraphs(paragraphs, configuration) {
|
|
7937
|
+
const context = {
|
|
7938
|
+
configuration: configuration,
|
|
7939
|
+
metadata: this.metadata
|
|
7940
|
+
};
|
|
7941
|
+
return paragraphs.filter((paragraph)=>{
|
|
7942
|
+
const { selector: selector, selectorIsNegated: selectorIsNegated } = paragraph;
|
|
7943
|
+
if (!selector) return true;
|
|
7944
|
+
return (0, $2ce1086ce25c9ac0$export$efb38dd75b8e2957)({
|
|
7945
|
+
selector: selector,
|
|
7946
|
+
isNegated: selectorIsNegated
|
|
7947
|
+
}, context);
|
|
7948
|
+
});
|
|
7949
|
+
}
|
|
7875
7950
|
linesToParagraphs(lines) {
|
|
7876
7951
|
let currentParagraph = new (0, $8906e348466806fd$export$2e2bcd8739ae039)();
|
|
7877
7952
|
const paragraphs = [
|
|
@@ -8232,6 +8307,16 @@ Or set the song key before changing key:
|
|
|
8232
8307
|
}
|
|
8233
8308
|
getMetadata(configuration) {
|
|
8234
8309
|
const metadata = new (0, $5c7afec93ec943b9$export$2e2bcd8739ae039)();
|
|
8310
|
+
const providers = configuration ? (0, $4903bcb4483a26e6$export$9b09a67f52000acf)(configuration) : (0, $4903bcb4483a26e6$export$12c349605689fe7a)();
|
|
8311
|
+
providers.forEach((provider, key)=>metadata.setProvider(key, provider));
|
|
8312
|
+
const chords = ()=>this.getChords();
|
|
8313
|
+
metadata.setProvider('chords', ()=>{
|
|
8314
|
+
const c = chords();
|
|
8315
|
+
return c.length ? c.join(', ') : null;
|
|
8316
|
+
});
|
|
8317
|
+
metadata.setProvider('numchords', ()=>chords().length.toString());
|
|
8318
|
+
metadata.setProvider('key_actual', ()=>metadata.getSingle('_key') ?? metadata.getSingle('key'));
|
|
8319
|
+
metadata.setProvider('key_from', ()=>metadata.getSingle('key'));
|
|
8235
8320
|
this.foreachItem((item)=>{
|
|
8236
8321
|
if (!(item instanceof (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039))) return;
|
|
8237
8322
|
const tag = item;
|
|
@@ -8615,7 +8700,7 @@ function $51ced2cf8b50f946$export$ce8f3be11402ed10(items, chopFirstWord) {
|
|
|
8615
8700
|
}
|
|
8616
8701
|
|
|
8617
8702
|
|
|
8618
|
-
// Generated by peggy v. 5.0
|
|
8703
|
+
// Generated by peggy v. 5.1.0 (ts-pegjs plugin v. 3.1.0 )
|
|
8619
8704
|
//
|
|
8620
8705
|
// https://peggyjs.org/ https://github.com/metadevpro/ts-pegjs
|
|
8621
8706
|
"use strict";
|
|
@@ -9197,31 +9282,35 @@ function $223a4923d98e43eb$var$peg$parse(input, options) {
|
|
|
9197
9282
|
const peg$c151 = peg$literalExpectation("end_of_tab", false);
|
|
9198
9283
|
const peg$c152 = "eot";
|
|
9199
9284
|
const peg$c153 = peg$literalExpectation("eot", false);
|
|
9200
|
-
const peg$c154 =
|
|
9201
|
-
const peg$c155 = peg$
|
|
9202
|
-
const peg$c156 =
|
|
9203
|
-
const peg$c157 =
|
|
9204
|
-
const peg$c158 = peg$
|
|
9285
|
+
const peg$c154 = "start_of_textblock";
|
|
9286
|
+
const peg$c155 = peg$literalExpectation("start_of_textblock", false);
|
|
9287
|
+
const peg$c156 = "end_of_textblock";
|
|
9288
|
+
const peg$c157 = peg$literalExpectation("end_of_textblock", false);
|
|
9289
|
+
const peg$c158 = peg$anyExpectation();
|
|
9290
|
+
const peg$c159 = peg$otherExpectation("whitespace");
|
|
9291
|
+
const peg$c160 = peg$otherExpectation("optional whitespace");
|
|
9292
|
+
const peg$c161 = /^[ \t\n\r]/;
|
|
9293
|
+
const peg$c162 = peg$classExpectation([
|
|
9205
9294
|
" ",
|
|
9206
9295
|
"\t",
|
|
9207
9296
|
"\n",
|
|
9208
9297
|
"\r"
|
|
9209
9298
|
], false, false);
|
|
9210
|
-
const peg$
|
|
9211
|
-
const peg$
|
|
9212
|
-
const peg$
|
|
9299
|
+
const peg$c163 = peg$otherExpectation("space");
|
|
9300
|
+
const peg$c164 = /^[ \t]/;
|
|
9301
|
+
const peg$c165 = peg$classExpectation([
|
|
9213
9302
|
" ",
|
|
9214
9303
|
"\t"
|
|
9215
9304
|
], false, false);
|
|
9216
|
-
const peg$
|
|
9217
|
-
const peg$
|
|
9305
|
+
const peg$c166 = /^[\n\r]/;
|
|
9306
|
+
const peg$c167 = peg$classExpectation([
|
|
9218
9307
|
"\n",
|
|
9219
9308
|
"\r"
|
|
9220
9309
|
], false, false);
|
|
9221
|
-
const peg$
|
|
9222
|
-
const peg$
|
|
9223
|
-
const peg$
|
|
9224
|
-
const peg$
|
|
9310
|
+
const peg$c168 = "\n";
|
|
9311
|
+
const peg$c169 = peg$literalExpectation("\n", false);
|
|
9312
|
+
const peg$c170 = "\r";
|
|
9313
|
+
const peg$c171 = peg$literalExpectation("\r", false);
|
|
9225
9314
|
let peg$currPos = 0;
|
|
9226
9315
|
let peg$savedPos = 0;
|
|
9227
9316
|
const peg$posDetailsCache = [
|
|
@@ -11409,7 +11498,10 @@ function $223a4923d98e43eb$var$peg$parse(input, options) {
|
|
|
11409
11498
|
s0 = peg$parseGridSection();
|
|
11410
11499
|
if (s0 === peg$FAILED) {
|
|
11411
11500
|
s0 = peg$parseLySection();
|
|
11412
|
-
if (s0 === peg$FAILED)
|
|
11501
|
+
if (s0 === peg$FAILED) {
|
|
11502
|
+
s0 = peg$parseTabSection();
|
|
11503
|
+
if (s0 === peg$FAILED) s0 = peg$parseTextblockSection();
|
|
11504
|
+
}
|
|
11413
11505
|
}
|
|
11414
11506
|
}
|
|
11415
11507
|
return s0;
|
|
@@ -12338,6 +12430,228 @@ function $223a4923d98e43eb$var$peg$parse(input, options) {
|
|
|
12338
12430
|
}
|
|
12339
12431
|
return s0;
|
|
12340
12432
|
}
|
|
12433
|
+
function peg$parseTextblockSection() {
|
|
12434
|
+
let s0, s1, s2, s3, s4, s5, s6, s7;
|
|
12435
|
+
s0 = peg$currPos;
|
|
12436
|
+
s1 = peg$parseTextblockStartTag();
|
|
12437
|
+
if (s1 !== peg$FAILED) {
|
|
12438
|
+
s2 = peg$parseNewLine();
|
|
12439
|
+
if (s2 !== peg$FAILED) {
|
|
12440
|
+
s3 = peg$currPos;
|
|
12441
|
+
s4 = [];
|
|
12442
|
+
s5 = peg$currPos;
|
|
12443
|
+
s6 = peg$currPos;
|
|
12444
|
+
peg$silentFails++;
|
|
12445
|
+
s7 = peg$parseTextblockEndTag();
|
|
12446
|
+
peg$silentFails--;
|
|
12447
|
+
if (s7 === peg$FAILED) s6 = undefined;
|
|
12448
|
+
else {
|
|
12449
|
+
peg$currPos = s6;
|
|
12450
|
+
s6 = peg$FAILED;
|
|
12451
|
+
}
|
|
12452
|
+
if (s6 !== peg$FAILED) {
|
|
12453
|
+
s7 = peg$parseSectionCharacter();
|
|
12454
|
+
if (s7 !== peg$FAILED) {
|
|
12455
|
+
s6 = [
|
|
12456
|
+
s6,
|
|
12457
|
+
s7
|
|
12458
|
+
];
|
|
12459
|
+
s5 = s6;
|
|
12460
|
+
} else {
|
|
12461
|
+
peg$currPos = s5;
|
|
12462
|
+
s5 = peg$FAILED;
|
|
12463
|
+
}
|
|
12464
|
+
} else {
|
|
12465
|
+
peg$currPos = s5;
|
|
12466
|
+
s5 = peg$FAILED;
|
|
12467
|
+
}
|
|
12468
|
+
while(s5 !== peg$FAILED){
|
|
12469
|
+
s4.push(s5);
|
|
12470
|
+
s5 = peg$currPos;
|
|
12471
|
+
s6 = peg$currPos;
|
|
12472
|
+
peg$silentFails++;
|
|
12473
|
+
s7 = peg$parseTextblockEndTag();
|
|
12474
|
+
peg$silentFails--;
|
|
12475
|
+
if (s7 === peg$FAILED) s6 = undefined;
|
|
12476
|
+
else {
|
|
12477
|
+
peg$currPos = s6;
|
|
12478
|
+
s6 = peg$FAILED;
|
|
12479
|
+
}
|
|
12480
|
+
if (s6 !== peg$FAILED) {
|
|
12481
|
+
s7 = peg$parseSectionCharacter();
|
|
12482
|
+
if (s7 !== peg$FAILED) {
|
|
12483
|
+
s6 = [
|
|
12484
|
+
s6,
|
|
12485
|
+
s7
|
|
12486
|
+
];
|
|
12487
|
+
s5 = s6;
|
|
12488
|
+
} else {
|
|
12489
|
+
peg$currPos = s5;
|
|
12490
|
+
s5 = peg$FAILED;
|
|
12491
|
+
}
|
|
12492
|
+
} else {
|
|
12493
|
+
peg$currPos = s5;
|
|
12494
|
+
s5 = peg$FAILED;
|
|
12495
|
+
}
|
|
12496
|
+
}
|
|
12497
|
+
if (s4 !== peg$FAILED) s3 = input.substring(s3, peg$currPos);
|
|
12498
|
+
else s3 = s4;
|
|
12499
|
+
if (s3 !== peg$FAILED) {
|
|
12500
|
+
s4 = peg$parseTextblockEndTag();
|
|
12501
|
+
if (s4 !== peg$FAILED) {
|
|
12502
|
+
peg$savedPos = s0;
|
|
12503
|
+
s1 = peg$c128(s1, s3, s4);
|
|
12504
|
+
s0 = s1;
|
|
12505
|
+
} else {
|
|
12506
|
+
peg$currPos = s0;
|
|
12507
|
+
s0 = peg$FAILED;
|
|
12508
|
+
}
|
|
12509
|
+
} else {
|
|
12510
|
+
peg$currPos = s0;
|
|
12511
|
+
s0 = peg$FAILED;
|
|
12512
|
+
}
|
|
12513
|
+
} else {
|
|
12514
|
+
peg$currPos = s0;
|
|
12515
|
+
s0 = peg$FAILED;
|
|
12516
|
+
}
|
|
12517
|
+
} else {
|
|
12518
|
+
peg$currPos = s0;
|
|
12519
|
+
s0 = peg$FAILED;
|
|
12520
|
+
}
|
|
12521
|
+
return s0;
|
|
12522
|
+
}
|
|
12523
|
+
function peg$parseTextblockStartTag() {
|
|
12524
|
+
let s0, s1, s2, s3, s4, s5, s6, s7, s8;
|
|
12525
|
+
s0 = peg$currPos;
|
|
12526
|
+
if (input.charCodeAt(peg$currPos) === 123) {
|
|
12527
|
+
s1 = peg$c43;
|
|
12528
|
+
peg$currPos++;
|
|
12529
|
+
} else {
|
|
12530
|
+
s1 = peg$FAILED;
|
|
12531
|
+
if (peg$silentFails === 0) peg$fail(peg$c44);
|
|
12532
|
+
}
|
|
12533
|
+
if (s1 !== peg$FAILED) {
|
|
12534
|
+
s2 = peg$parse_();
|
|
12535
|
+
if (s2 !== peg$FAILED) {
|
|
12536
|
+
if (input.substr(peg$currPos, 18) === peg$c154) {
|
|
12537
|
+
s3 = peg$c154;
|
|
12538
|
+
peg$currPos += 18;
|
|
12539
|
+
} else {
|
|
12540
|
+
s3 = peg$FAILED;
|
|
12541
|
+
if (peg$silentFails === 0) peg$fail(peg$c155);
|
|
12542
|
+
}
|
|
12543
|
+
if (s3 !== peg$FAILED) {
|
|
12544
|
+
s4 = peg$parseTagSelector();
|
|
12545
|
+
if (s4 === peg$FAILED) s4 = null;
|
|
12546
|
+
if (s4 !== peg$FAILED) {
|
|
12547
|
+
s5 = peg$parse_();
|
|
12548
|
+
if (s5 !== peg$FAILED) {
|
|
12549
|
+
s6 = peg$parseTagColonWithValue();
|
|
12550
|
+
if (s6 === peg$FAILED) s6 = null;
|
|
12551
|
+
if (s6 !== peg$FAILED) {
|
|
12552
|
+
s7 = peg$parse_();
|
|
12553
|
+
if (s7 !== peg$FAILED) {
|
|
12554
|
+
if (input.charCodeAt(peg$currPos) === 125) {
|
|
12555
|
+
s8 = peg$c29;
|
|
12556
|
+
peg$currPos++;
|
|
12557
|
+
} else {
|
|
12558
|
+
s8 = peg$FAILED;
|
|
12559
|
+
if (peg$silentFails === 0) peg$fail(peg$c30);
|
|
12560
|
+
}
|
|
12561
|
+
if (s8 !== peg$FAILED) {
|
|
12562
|
+
peg$savedPos = s0;
|
|
12563
|
+
s1 = peg$c65(s3, s4, s6);
|
|
12564
|
+
s0 = s1;
|
|
12565
|
+
} else {
|
|
12566
|
+
peg$currPos = s0;
|
|
12567
|
+
s0 = peg$FAILED;
|
|
12568
|
+
}
|
|
12569
|
+
} else {
|
|
12570
|
+
peg$currPos = s0;
|
|
12571
|
+
s0 = peg$FAILED;
|
|
12572
|
+
}
|
|
12573
|
+
} else {
|
|
12574
|
+
peg$currPos = s0;
|
|
12575
|
+
s0 = peg$FAILED;
|
|
12576
|
+
}
|
|
12577
|
+
} else {
|
|
12578
|
+
peg$currPos = s0;
|
|
12579
|
+
s0 = peg$FAILED;
|
|
12580
|
+
}
|
|
12581
|
+
} else {
|
|
12582
|
+
peg$currPos = s0;
|
|
12583
|
+
s0 = peg$FAILED;
|
|
12584
|
+
}
|
|
12585
|
+
} else {
|
|
12586
|
+
peg$currPos = s0;
|
|
12587
|
+
s0 = peg$FAILED;
|
|
12588
|
+
}
|
|
12589
|
+
} else {
|
|
12590
|
+
peg$currPos = s0;
|
|
12591
|
+
s0 = peg$FAILED;
|
|
12592
|
+
}
|
|
12593
|
+
} else {
|
|
12594
|
+
peg$currPos = s0;
|
|
12595
|
+
s0 = peg$FAILED;
|
|
12596
|
+
}
|
|
12597
|
+
return s0;
|
|
12598
|
+
}
|
|
12599
|
+
function peg$parseTextblockEndTag() {
|
|
12600
|
+
let s0, s1, s2, s3, s4, s5;
|
|
12601
|
+
s0 = peg$currPos;
|
|
12602
|
+
if (input.charCodeAt(peg$currPos) === 123) {
|
|
12603
|
+
s1 = peg$c43;
|
|
12604
|
+
peg$currPos++;
|
|
12605
|
+
} else {
|
|
12606
|
+
s1 = peg$FAILED;
|
|
12607
|
+
if (peg$silentFails === 0) peg$fail(peg$c44);
|
|
12608
|
+
}
|
|
12609
|
+
if (s1 !== peg$FAILED) {
|
|
12610
|
+
s2 = peg$parse_();
|
|
12611
|
+
if (s2 !== peg$FAILED) {
|
|
12612
|
+
if (input.substr(peg$currPos, 16) === peg$c156) {
|
|
12613
|
+
s3 = peg$c156;
|
|
12614
|
+
peg$currPos += 16;
|
|
12615
|
+
} else {
|
|
12616
|
+
s3 = peg$FAILED;
|
|
12617
|
+
if (peg$silentFails === 0) peg$fail(peg$c157);
|
|
12618
|
+
}
|
|
12619
|
+
if (s3 !== peg$FAILED) {
|
|
12620
|
+
s4 = peg$parse_();
|
|
12621
|
+
if (s4 !== peg$FAILED) {
|
|
12622
|
+
if (input.charCodeAt(peg$currPos) === 125) {
|
|
12623
|
+
s5 = peg$c29;
|
|
12624
|
+
peg$currPos++;
|
|
12625
|
+
} else {
|
|
12626
|
+
s5 = peg$FAILED;
|
|
12627
|
+
if (peg$silentFails === 0) peg$fail(peg$c30);
|
|
12628
|
+
}
|
|
12629
|
+
if (s5 !== peg$FAILED) {
|
|
12630
|
+
peg$savedPos = s0;
|
|
12631
|
+
s1 = peg$c133(s3);
|
|
12632
|
+
s0 = s1;
|
|
12633
|
+
} else {
|
|
12634
|
+
peg$currPos = s0;
|
|
12635
|
+
s0 = peg$FAILED;
|
|
12636
|
+
}
|
|
12637
|
+
} else {
|
|
12638
|
+
peg$currPos = s0;
|
|
12639
|
+
s0 = peg$FAILED;
|
|
12640
|
+
}
|
|
12641
|
+
} else {
|
|
12642
|
+
peg$currPos = s0;
|
|
12643
|
+
s0 = peg$FAILED;
|
|
12644
|
+
}
|
|
12645
|
+
} else {
|
|
12646
|
+
peg$currPos = s0;
|
|
12647
|
+
s0 = peg$FAILED;
|
|
12648
|
+
}
|
|
12649
|
+
} else {
|
|
12650
|
+
peg$currPos = s0;
|
|
12651
|
+
s0 = peg$FAILED;
|
|
12652
|
+
}
|
|
12653
|
+
return s0;
|
|
12654
|
+
}
|
|
12341
12655
|
function peg$parseSectionCharacter() {
|
|
12342
12656
|
let s0;
|
|
12343
12657
|
if (input.length > peg$currPos) {
|
|
@@ -12345,7 +12659,7 @@ function $223a4923d98e43eb$var$peg$parse(input, options) {
|
|
|
12345
12659
|
peg$currPos++;
|
|
12346
12660
|
} else {
|
|
12347
12661
|
s0 = peg$FAILED;
|
|
12348
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
12662
|
+
if (peg$silentFails === 0) peg$fail(peg$c158);
|
|
12349
12663
|
}
|
|
12350
12664
|
return s0;
|
|
12351
12665
|
}
|
|
@@ -12362,7 +12676,7 @@ function $223a4923d98e43eb$var$peg$parse(input, options) {
|
|
|
12362
12676
|
peg$silentFails--;
|
|
12363
12677
|
if (s0 === peg$FAILED) {
|
|
12364
12678
|
s1 = peg$FAILED;
|
|
12365
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
12679
|
+
if (peg$silentFails === 0) peg$fail(peg$c159);
|
|
12366
12680
|
}
|
|
12367
12681
|
return s0;
|
|
12368
12682
|
}
|
|
@@ -12378,18 +12692,18 @@ function $223a4923d98e43eb$var$peg$parse(input, options) {
|
|
|
12378
12692
|
peg$silentFails--;
|
|
12379
12693
|
if (s0 === peg$FAILED) {
|
|
12380
12694
|
s1 = peg$FAILED;
|
|
12381
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
12695
|
+
if (peg$silentFails === 0) peg$fail(peg$c160);
|
|
12382
12696
|
}
|
|
12383
12697
|
return s0;
|
|
12384
12698
|
}
|
|
12385
12699
|
function peg$parseWhitespaceCharacter() {
|
|
12386
12700
|
let s0;
|
|
12387
|
-
if (peg$
|
|
12701
|
+
if (peg$c161.test(input.charAt(peg$currPos))) {
|
|
12388
12702
|
s0 = input.charAt(peg$currPos);
|
|
12389
12703
|
peg$currPos++;
|
|
12390
12704
|
} else {
|
|
12391
12705
|
s0 = peg$FAILED;
|
|
12392
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
12706
|
+
if (peg$silentFails === 0) peg$fail(peg$c162);
|
|
12393
12707
|
}
|
|
12394
12708
|
return s0;
|
|
12395
12709
|
}
|
|
@@ -12398,21 +12712,21 @@ function $223a4923d98e43eb$var$peg$parse(input, options) {
|
|
|
12398
12712
|
peg$silentFails++;
|
|
12399
12713
|
s0 = peg$currPos;
|
|
12400
12714
|
s1 = [];
|
|
12401
|
-
if (peg$
|
|
12715
|
+
if (peg$c164.test(input.charAt(peg$currPos))) {
|
|
12402
12716
|
s2 = input.charAt(peg$currPos);
|
|
12403
12717
|
peg$currPos++;
|
|
12404
12718
|
} else {
|
|
12405
12719
|
s2 = peg$FAILED;
|
|
12406
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
12720
|
+
if (peg$silentFails === 0) peg$fail(peg$c165);
|
|
12407
12721
|
}
|
|
12408
12722
|
if (s2 !== peg$FAILED) while(s2 !== peg$FAILED){
|
|
12409
12723
|
s1.push(s2);
|
|
12410
|
-
if (peg$
|
|
12724
|
+
if (peg$c164.test(input.charAt(peg$currPos))) {
|
|
12411
12725
|
s2 = input.charAt(peg$currPos);
|
|
12412
12726
|
peg$currPos++;
|
|
12413
12727
|
} else {
|
|
12414
12728
|
s2 = peg$FAILED;
|
|
12415
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
12729
|
+
if (peg$silentFails === 0) peg$fail(peg$c165);
|
|
12416
12730
|
}
|
|
12417
12731
|
}
|
|
12418
12732
|
else s1 = peg$FAILED;
|
|
@@ -12421,18 +12735,18 @@ function $223a4923d98e43eb$var$peg$parse(input, options) {
|
|
|
12421
12735
|
peg$silentFails--;
|
|
12422
12736
|
if (s0 === peg$FAILED) {
|
|
12423
12737
|
s1 = peg$FAILED;
|
|
12424
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
12738
|
+
if (peg$silentFails === 0) peg$fail(peg$c163);
|
|
12425
12739
|
}
|
|
12426
12740
|
return s0;
|
|
12427
12741
|
}
|
|
12428
12742
|
function peg$parseNewLine() {
|
|
12429
12743
|
let s0;
|
|
12430
|
-
if (peg$
|
|
12744
|
+
if (peg$c166.test(input.charAt(peg$currPos))) {
|
|
12431
12745
|
s0 = input.charAt(peg$currPos);
|
|
12432
12746
|
peg$currPos++;
|
|
12433
12747
|
} else {
|
|
12434
12748
|
s0 = peg$FAILED;
|
|
12435
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
12749
|
+
if (peg$silentFails === 0) peg$fail(peg$c167);
|
|
12436
12750
|
}
|
|
12437
12751
|
if (s0 === peg$FAILED) s0 = peg$parseCarriageReturnLineFeed();
|
|
12438
12752
|
return s0;
|
|
@@ -12462,22 +12776,22 @@ function $223a4923d98e43eb$var$peg$parse(input, options) {
|
|
|
12462
12776
|
function peg$parseLineFeed() {
|
|
12463
12777
|
let s0;
|
|
12464
12778
|
if (input.charCodeAt(peg$currPos) === 10) {
|
|
12465
|
-
s0 = peg$
|
|
12779
|
+
s0 = peg$c168;
|
|
12466
12780
|
peg$currPos++;
|
|
12467
12781
|
} else {
|
|
12468
12782
|
s0 = peg$FAILED;
|
|
12469
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
12783
|
+
if (peg$silentFails === 0) peg$fail(peg$c169);
|
|
12470
12784
|
}
|
|
12471
12785
|
return s0;
|
|
12472
12786
|
}
|
|
12473
12787
|
function peg$parseCarriageReturn() {
|
|
12474
12788
|
let s0;
|
|
12475
12789
|
if (input.charCodeAt(peg$currPos) === 13) {
|
|
12476
|
-
s0 = peg$
|
|
12790
|
+
s0 = peg$c170;
|
|
12477
12791
|
peg$currPos++;
|
|
12478
12792
|
} else {
|
|
12479
12793
|
s0 = peg$FAILED;
|
|
12480
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
12794
|
+
if (peg$silentFails === 0) peg$fail(peg$c171);
|
|
12481
12795
|
}
|
|
12482
12796
|
return s0;
|
|
12483
12797
|
}
|
|
@@ -12932,7 +13246,8 @@ var $f9c5006b26957916$export$2e2bcd8739ae039 = {
|
|
|
12932
13246
|
}
|
|
12933
13247
|
formatHeader() {
|
|
12934
13248
|
// Process metadata according to configuration
|
|
12935
|
-
const
|
|
13249
|
+
const songMetadata = this.song.getMetadata(this.configuration);
|
|
13250
|
+
const orderedMetadata = (0, $f9c5006b26957916$export$5c964b66c4a8abfb)(songMetadata.ownMetadata(), this.configuration.metadata);
|
|
12936
13251
|
const metadata = orderedMetadata.map(([key, value])=>{
|
|
12937
13252
|
if (Array.isArray(value)) return `${key}: ${value.join(',')}`;
|
|
12938
13253
|
if (typeof value === 'undefined' || value === null || value === '') return `${key}:`;
|
|
@@ -12941,8 +13256,10 @@ var $f9c5006b26957916$export$2e2bcd8739ae039 = {
|
|
|
12941
13256
|
return metadata ? `${metadata}\n\n` : '';
|
|
12942
13257
|
}
|
|
12943
13258
|
formatParagraphs() {
|
|
12944
|
-
const
|
|
12945
|
-
const
|
|
13259
|
+
const metadata = this.song.getMetadata(this.configuration);
|
|
13260
|
+
const paragraphs = this.song.filterParagraphs(this.song.bodyParagraphs, this.configuration);
|
|
13261
|
+
const count = paragraphs.length;
|
|
13262
|
+
const formattedParagraphs = paragraphs.map((paragraph)=>this.formatParagraph(paragraph, metadata));
|
|
12946
13263
|
const combined = formattedParagraphs.join('\n\n');
|
|
12947
13264
|
if (formattedParagraphs[count - 1].length === 0) return combined.substring(0, combined.length - 1);
|
|
12948
13265
|
return combined;
|
|
@@ -13221,7 +13538,7 @@ function $7270482b3072811c$export$f0dcc8f253e2c535(newLine, lines, trailingLine,
|
|
|
13221
13538
|
}
|
|
13222
13539
|
|
|
13223
13540
|
|
|
13224
|
-
// Generated by peggy v. 5.0
|
|
13541
|
+
// Generated by peggy v. 5.1.0 (ts-pegjs plugin v. 3.1.0 )
|
|
13225
13542
|
//
|
|
13226
13543
|
// https://peggyjs.org/ https://github.com/metadevpro/ts-pegjs
|
|
13227
13544
|
"use strict";
|
|
@@ -25358,7 +25675,7 @@ var $df9247d334a0483e$export$2e2bcd8739ae039 = $df9247d334a0483e$var$ChordsOverW
|
|
|
25358
25675
|
|
|
25359
25676
|
|
|
25360
25677
|
|
|
25361
|
-
var $1408adfd7317f0b6$export$2e2bcd8739ae039 = ({ configuration: configuration, configuration: { key: key, cssClasses: c }, song: song, renderBlankLines: renderBlankLines = false, song: { title: title, subtitle: subtitle
|
|
25678
|
+
var $1408adfd7317f0b6$export$2e2bcd8739ae039 = ({ configuration: configuration, configuration: { key: key, cssClasses: c }, song: song, metadata: metadata, renderBlankLines: renderBlankLines = false, song: { title: title, subtitle: subtitle }, bodyParagraphs: bodyParagraphs })=>(0, $f9c5006b26957916$export$6ea1b0eb82ead3f)(`
|
|
25362
25679
|
${(0, $f9c5006b26957916$export$a55877ca9db47377)(title, ()=>`<h1 class="${c.title}">${title}</h1>`)}
|
|
25363
25680
|
${(0, $f9c5006b26957916$export$a55877ca9db47377)(subtitle, ()=>`<h2 class="${c.subtitle}">${subtitle}</h2>`)}
|
|
25364
25681
|
|
|
@@ -25459,10 +25776,12 @@ const $fb7c3e115538fcf2$export$2969e7e19d88b575 = {
|
|
|
25459
25776
|
* @returns {string} The HTML string
|
|
25460
25777
|
*/ format(song) {
|
|
25461
25778
|
const { bodyParagraphs: bodyParagraphs, expandedBodyParagraphs: expandedBodyParagraphs } = song;
|
|
25779
|
+
const paragraphs = this.configuration.expandChorusDirective ? expandedBodyParagraphs : bodyParagraphs;
|
|
25462
25780
|
return this.template({
|
|
25463
25781
|
song: song,
|
|
25782
|
+
metadata: song.getMetadata(this.configuration),
|
|
25464
25783
|
configuration: this.configuration,
|
|
25465
|
-
bodyParagraphs: this.configuration
|
|
25784
|
+
bodyParagraphs: song.filterParagraphs(paragraphs, this.configuration)
|
|
25466
25785
|
});
|
|
25467
25786
|
}
|
|
25468
25787
|
/**
|
|
@@ -25533,7 +25852,7 @@ var $d9bea8c73e9a5034$export$2e2bcd8739ae039 = $d9bea8c73e9a5034$var$HtmlDivForm
|
|
|
25533
25852
|
|
|
25534
25853
|
|
|
25535
25854
|
|
|
25536
|
-
var $396f7048979e89c9$export$2e2bcd8739ae039 = ({ configuration: configuration, configuration: { key: key, cssClasses: c }, song: song, renderBlankLines: renderBlankLines = false, song: { title: title, subtitle: subtitle, bodyLines: bodyLines
|
|
25855
|
+
var $396f7048979e89c9$export$2e2bcd8739ae039 = ({ configuration: configuration, configuration: { key: key, cssClasses: c }, song: song, metadata: metadata, renderBlankLines: renderBlankLines = false, song: { title: title, subtitle: subtitle, bodyLines: bodyLines }, bodyParagraphs: bodyParagraphs })=>(0, $f9c5006b26957916$export$6ea1b0eb82ead3f)(`
|
|
25537
25856
|
${(0, $f9c5006b26957916$export$a55877ca9db47377)(title, ()=>`<h1 class="${c.title}">${title}</h1>`)}
|
|
25538
25857
|
${(0, $f9c5006b26957916$export$a55877ca9db47377)(subtitle, ()=>`<h2 class="${c.subtitle}">${subtitle}</h2>`)}
|
|
25539
25858
|
|
|
@@ -26422,7 +26741,7 @@ var $bdd8c6196670168a$export$2e2bcd8739ae039 = $bdd8c6196670168a$var$Condition;
|
|
|
26422
26741
|
* @returns {string} the chord sheet
|
|
26423
26742
|
*/ format(song, metadata) {
|
|
26424
26743
|
this.song = song;
|
|
26425
|
-
this.metadata = metadata || song.
|
|
26744
|
+
this.metadata = metadata || song.getMetadata(this.configuration);
|
|
26426
26745
|
return [
|
|
26427
26746
|
this.formatHeader(),
|
|
26428
26747
|
this.formatParagraphs()
|
|
@@ -26440,7 +26759,8 @@ var $bdd8c6196670168a$export$2e2bcd8739ae039 = $bdd8c6196670168a$var$Condition;
|
|
|
26440
26759
|
formatParagraphs() {
|
|
26441
26760
|
const { bodyParagraphs: bodyParagraphs, expandedBodyParagraphs: expandedBodyParagraphs } = this.song;
|
|
26442
26761
|
const { expandChorusDirective: expandChorusDirective } = this.configuration;
|
|
26443
|
-
|
|
26762
|
+
const paragraphs = expandChorusDirective ? expandedBodyParagraphs : bodyParagraphs;
|
|
26763
|
+
return this.song.filterParagraphs(paragraphs, this.configuration).map((paragraph)=>this.formatParagraph(paragraph, this.metadata)).join('\n\n');
|
|
26444
26764
|
}
|
|
26445
26765
|
formatParagraph(paragraph, metadata) {
|
|
26446
26766
|
if (paragraph.isLiteral()) return [
|
|
@@ -26537,10 +26857,10 @@ class $2e404bc796b05dec$export$f1e5feaa438be04f {
|
|
|
26537
26857
|
* Determines if a content item should be rendered based on conditions
|
|
26538
26858
|
*/ shouldRenderContent(contentItem) {
|
|
26539
26859
|
if (!contentItem.condition) return true;
|
|
26540
|
-
const metadata =
|
|
26541
|
-
|
|
26542
|
-
|
|
26543
|
-
};
|
|
26860
|
+
const { metadata: songMetadata, extraMetadata: extraMetadata } = this.context;
|
|
26861
|
+
const metadata = new Proxy({}, {
|
|
26862
|
+
get: (_, prop)=>extraMetadata?.[prop] ?? songMetadata.get(prop)
|
|
26863
|
+
});
|
|
26544
26864
|
return new (0, $bdd8c6196670168a$export$2e2bcd8739ae039)(contentItem.condition, metadata).evaluate();
|
|
26545
26865
|
}
|
|
26546
26866
|
/**
|
|
@@ -26617,7 +26937,9 @@ class $2e404bc796b05dec$export$f1e5feaa438be04f {
|
|
|
26617
26937
|
const parsed = new (0, $957f29f677b8d58d$export$2e2bcd8739ae039)().parse(template);
|
|
26618
26938
|
return new (0, $992b73e4d56a0aef$export$2e2bcd8739ae039)().format(parsed, metadata);
|
|
26619
26939
|
} catch (e) {
|
|
26620
|
-
throw new Error(`Error evaluating template\n\n${template}\n\n: ${e.message}
|
|
26940
|
+
throw new Error(`Error evaluating template\n\n${template}\n\n: ${e.message}`, {
|
|
26941
|
+
cause: e
|
|
26942
|
+
});
|
|
26621
26943
|
}
|
|
26622
26944
|
}
|
|
26623
26945
|
/**
|
|
@@ -27669,8 +27991,7 @@ class $9c53a1d7fff20a4a$export$e6ce86b8bc39728b {
|
|
|
27669
27991
|
/**
|
|
27670
27992
|
* Removes hyphens from lyrics for lyrics-only mode
|
|
27671
27993
|
*/ removeHyphens(lyrics) {
|
|
27672
|
-
let cleanedLyrics = lyrics;
|
|
27673
|
-
cleanedLyrics = lyrics.replace(/\b(\w+)\s*-\s*(\w+)\b/g, '$1$2');
|
|
27994
|
+
let cleanedLyrics = lyrics.replace(/\b(\w+)\s*-\s*(\w+)\b/g, '$1$2');
|
|
27674
27995
|
cleanedLyrics = cleanedLyrics.replace(/(?:\b(\w+)\s*-\s*$)|(?:-\s*$)|(?:\s+-\s+$)/g, '$1');
|
|
27675
27996
|
if (/^\s*-\s*$/.test(cleanedLyrics)) return '';
|
|
27676
27997
|
return cleanedLyrics;
|
|
@@ -36671,7 +36992,7 @@ const $a5a21ced491ea51f$var$endSectionTags = {
|
|
|
36671
36992
|
var $a5a21ced491ea51f$export$2e2bcd8739ae039 = $a5a21ced491ea51f$var$UltimateGuitarParser;
|
|
36672
36993
|
|
|
36673
36994
|
|
|
36674
|
-
var $ae92e002ce14f11a$export$2e2bcd8739ae039 = '14.
|
|
36995
|
+
var $ae92e002ce14f11a$export$2e2bcd8739ae039 = '14.1.0';
|
|
36675
36996
|
|
|
36676
36997
|
|
|
36677
36998
|
|
|
@@ -36713,6 +37034,7 @@ var $892913528e7f60f9$export$2e2bcd8739ae039 = {
|
|
|
36713
37034
|
SoftLineBreak: $4b6dd3e4b817bd81$export$2e2bcd8739ae039,
|
|
36714
37035
|
Song: $c53141c05fae8382$export$2e2bcd8739ae039,
|
|
36715
37036
|
TAB: $dce48cb70c4120bb$export$f1c9dd0f5207dd5e,
|
|
37037
|
+
TEXTBLOCK: $dce48cb70c4120bb$export$5a2cf64ea612936a,
|
|
36716
37038
|
Tag: $7251dad5f4a4c35f$export$2e2bcd8739ae039,
|
|
36717
37039
|
Ternary: $15f1d40e3d1ed3a0$export$2e2bcd8739ae039,
|
|
36718
37040
|
TextFormatter: $992b73e4d56a0aef$export$2e2bcd8739ae039,
|