chordsheetjs 7.5.0 → 7.6.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 CHANGED
@@ -42,10 +42,6 @@ $parcel$export(module.exports, "NONE", () => $af8d31735c159a26$export$c53d0f541b
42
42
  $parcel$export(module.exports, "TAB", () => $af8d31735c159a26$export$f1c9dd0f5207dd5e);
43
43
  $parcel$export(module.exports, "SYMBOL", () => $af8d31735c159a26$export$27c95a7104c1f7aa);
44
44
  $parcel$export(module.exports, "NUMERIC", () => $af8d31735c159a26$export$4d318981b5a83836);
45
- // Generated by peggy v. 1.2.0 (ts-pegjs plugin v. 1.2.2 )
46
- //
47
- // https://peggyjs.org/ https://github.com/metadevpro/ts-pegjs
48
- "use strict";
49
45
  function $1a506a341538d943$var$peg$padEnd(str, targetLength, padString) {
50
46
  padString = padString || " ";
51
47
  if (str.length > targetLength) return str;
@@ -144,9 +140,7 @@ function $1a506a341538d943$var$peg$parse(input, options) {
144
140
  options = options !== undefined ? options : {};
145
141
  const peg$FAILED = {};
146
142
  const peg$source = options.grammarSource;
147
- const peg$startRuleFunctions = {
148
- ChordSheet: peg$parseChordSheet
149
- };
143
+ const peg$startRuleFunctions = {};
150
144
  let peg$startRuleFunction = peg$parseChordSheet;
151
145
  const peg$c0 = function(lines, line) {
152
146
  return {
@@ -3502,7 +3496,6 @@ const $5e9ede69210ec54a$var$ALIASES = {
3502
3496
  [$5e9ede69210ec54a$var$END_OF_TAB_SHORT]: $5e9ede69210ec54a$export$66a0ef3ffeab32b7,
3503
3497
  [$5e9ede69210ec54a$var$NEW_KEY_SHORT]: $5e9ede69210ec54a$export$b7627374a6424f68
3504
3498
  };
3505
- const $5e9ede69210ec54a$var$META_TAG_REGEX = /^meta:\s*([^:\s]+)(\s*(.+))?$/;
3506
3499
  const $5e9ede69210ec54a$var$TAG_REGEX = /^([^:\s]+)(:?\s*(.+))?$/;
3507
3500
  const $5e9ede69210ec54a$var$CUSTOM_META_TAG_NAME_REGEX = /^x_(.+)$/;
3508
3501
  function $5e9ede69210ec54a$export$3ef04055cb4a269a(tagName) {
@@ -3517,14 +3510,25 @@ const $5e9ede69210ec54a$var$translateTagNameAlias = (name)=>{
3517
3510
  /**
3518
3511
  * Represents a tag/directive. See https://www.chordpro.org/chordpro/chordpro-directives/
3519
3512
  */ class $5e9ede69210ec54a$var$Tag extends (0, $cf00b4d3af89fa07$export$2e2bcd8739ae039) {
3513
+ _isMetaTag = false;
3520
3514
  constructor(name, value = "", traceInfo = null){
3521
3515
  super(traceInfo);
3522
- this.name = name;
3523
- this.value = value || "";
3516
+ this.parseNameValue(name, value);
3517
+ }
3518
+ parseNameValue(name, value) {
3519
+ if (name === "meta") {
3520
+ const [metaName, metaValue] = value.split(/\s(.+)/);
3521
+ this.name = metaName;
3522
+ this.value = metaValue || "";
3523
+ this._isMetaTag = true;
3524
+ } else {
3525
+ this.name = name;
3526
+ this.value = value || "";
3527
+ }
3524
3528
  }
3525
3529
  static parse(tag) {
3526
3530
  if (tag instanceof $5e9ede69210ec54a$var$Tag) return tag;
3527
- return this.parseWithRegex(tag, $5e9ede69210ec54a$var$META_TAG_REGEX) || this.parseWithRegex(tag, $5e9ede69210ec54a$var$TAG_REGEX);
3531
+ return this.parseWithRegex(tag, $5e9ede69210ec54a$var$TAG_REGEX);
3528
3532
  }
3529
3533
  static parseWithRegex(tag, regex) {
3530
3534
  const matches = tag.match(regex);
@@ -3576,7 +3580,7 @@ const $5e9ede69210ec54a$var$translateTagNameAlias = (name)=>{
3576
3580
  * Checks whether the tag is either a standard meta tag or a custom meta directive (`{x_some_name}`)
3577
3581
  * @returns {boolean}
3578
3582
  */ isMetaTag() {
3579
- return $5e9ede69210ec54a$var$CUSTOM_META_TAG_NAME_REGEX.test(this.name) || $5e9ede69210ec54a$export$57ecf0dc09effb3.indexOf(this.name) !== -1;
3583
+ return this._isMetaTag || $5e9ede69210ec54a$var$CUSTOM_META_TAG_NAME_REGEX.test(this.name) || $5e9ede69210ec54a$export$57ecf0dc09effb3.indexOf(this.name) !== -1;
3580
3584
  }
3581
3585
  /**
3582
3586
  * Returns a clone of the tag.
package/lib/index.js CHANGED
@@ -41,10 +41,6 @@ $parcel$export(module.exports, "NONE", () => $af8d31735c159a26$export$c53d0f541b
41
41
  $parcel$export(module.exports, "TAB", () => $af8d31735c159a26$export$f1c9dd0f5207dd5e);
42
42
  $parcel$export(module.exports, "SYMBOL", () => $af8d31735c159a26$export$27c95a7104c1f7aa);
43
43
  $parcel$export(module.exports, "NUMERIC", () => $af8d31735c159a26$export$4d318981b5a83836);
44
- // Generated by peggy v. 1.2.0 (ts-pegjs plugin v. 1.2.2 )
45
- //
46
- // https://peggyjs.org/ https://github.com/metadevpro/ts-pegjs
47
- "use strict";
48
44
  function $1a506a341538d943$var$peg$padEnd(str, targetLength, padString) {
49
45
  padString = padString || " ";
50
46
  if (str.length > targetLength) return str;
@@ -143,9 +139,7 @@ function $1a506a341538d943$var$peg$parse(input, options) {
143
139
  options = options !== undefined ? options : {};
144
140
  const peg$FAILED = {};
145
141
  const peg$source = options.grammarSource;
146
- const peg$startRuleFunctions = {
147
- ChordSheet: peg$parseChordSheet
148
- };
142
+ const peg$startRuleFunctions = {};
149
143
  let peg$startRuleFunction = peg$parseChordSheet;
150
144
  const peg$c0 = function(lines, line) {
151
145
  return {
@@ -3501,7 +3495,6 @@ const $5e9ede69210ec54a$var$ALIASES = {
3501
3495
  [$5e9ede69210ec54a$var$END_OF_TAB_SHORT]: $5e9ede69210ec54a$export$66a0ef3ffeab32b7,
3502
3496
  [$5e9ede69210ec54a$var$NEW_KEY_SHORT]: $5e9ede69210ec54a$export$b7627374a6424f68
3503
3497
  };
3504
- const $5e9ede69210ec54a$var$META_TAG_REGEX = /^meta:\s*([^:\s]+)(\s*(.+))?$/;
3505
3498
  const $5e9ede69210ec54a$var$TAG_REGEX = /^([^:\s]+)(:?\s*(.+))?$/;
3506
3499
  const $5e9ede69210ec54a$var$CUSTOM_META_TAG_NAME_REGEX = /^x_(.+)$/;
3507
3500
  function $5e9ede69210ec54a$export$3ef04055cb4a269a(tagName) {
@@ -3516,14 +3509,25 @@ const $5e9ede69210ec54a$var$translateTagNameAlias = (name)=>{
3516
3509
  /**
3517
3510
  * Represents a tag/directive. See https://www.chordpro.org/chordpro/chordpro-directives/
3518
3511
  */ class $5e9ede69210ec54a$var$Tag extends (0, $cf00b4d3af89fa07$export$2e2bcd8739ae039) {
3512
+ _isMetaTag = false;
3519
3513
  constructor(name, value = "", traceInfo = null){
3520
3514
  super(traceInfo);
3521
- this.name = name;
3522
- this.value = value || "";
3515
+ this.parseNameValue(name, value);
3516
+ }
3517
+ parseNameValue(name, value) {
3518
+ if (name === "meta") {
3519
+ const [metaName, metaValue] = value.split(/\s(.+)/);
3520
+ this.name = metaName;
3521
+ this.value = metaValue || "";
3522
+ this._isMetaTag = true;
3523
+ } else {
3524
+ this.name = name;
3525
+ this.value = value || "";
3526
+ }
3523
3527
  }
3524
3528
  static parse(tag) {
3525
3529
  if (tag instanceof $5e9ede69210ec54a$var$Tag) return tag;
3526
- return this.parseWithRegex(tag, $5e9ede69210ec54a$var$META_TAG_REGEX) || this.parseWithRegex(tag, $5e9ede69210ec54a$var$TAG_REGEX);
3530
+ return this.parseWithRegex(tag, $5e9ede69210ec54a$var$TAG_REGEX);
3527
3531
  }
3528
3532
  static parseWithRegex(tag, regex) {
3529
3533
  const matches = tag.match(regex);
@@ -3575,7 +3579,7 @@ const $5e9ede69210ec54a$var$translateTagNameAlias = (name)=>{
3575
3579
  * Checks whether the tag is either a standard meta tag or a custom meta directive (`{x_some_name}`)
3576
3580
  * @returns {boolean}
3577
3581
  */ isMetaTag() {
3578
- return $5e9ede69210ec54a$var$CUSTOM_META_TAG_NAME_REGEX.test(this.name) || $5e9ede69210ec54a$export$57ecf0dc09effb3.indexOf(this.name) !== -1;
3582
+ return this._isMetaTag || $5e9ede69210ec54a$var$CUSTOM_META_TAG_NAME_REGEX.test(this.name) || $5e9ede69210ec54a$export$57ecf0dc09effb3.indexOf(this.name) !== -1;
3579
3583
  }
3580
3584
  /**
3581
3585
  * Returns a clone of the tag.