Skip to content

Commit

Permalink
Fix left barlines
Browse files Browse the repository at this point in the history
  • Loading branch information
infojunkie committed Oct 28, 2024
1 parent 2e05249 commit feb1835
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 39 deletions.
6 changes: 3 additions & 3 deletions build/ireal-musicxml.cjs

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions build/ireal-musicxml.cjs.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions build/ireal-musicxml.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions build/ireal-musicxml.js.map

Large diffs are not rendered by default.

29 changes: 16 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ireal-musicxml",
"version": "2.0.1",
"version": "2.0.2",
"description": "iReal Pro to MusicXML converter.",
"author": "Karim Ratib <[email protected]> (https://github.com/infojunkie)",
"license": "GPL-3.0-only",
Expand Down
4 changes: 0 additions & 4 deletions src/cli/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ import { Playlist } from '../lib/parser.js';
import { Converter } from '../lib/converter.js';

const options = {
'ireal': {
type: 'string',
short: 'i',
},
'output': {
type: 'string',
short: 'o',
Expand Down
8 changes: 4 additions & 4 deletions src/lib/converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ export class Converter {
}

// Add starting barline.
this.measure.barlines.push(this.convertBarline(cell.bars, 'left'));
this.measure.barlines.push(this.convertBarline(cell.bars, 'left', (isNewSystem(cellIndex) || this.emptyCellNewSystem) ? 'regular' : undefined));

// If we're still repeating bars, copy the previous bar now.
if (this.barRepeat) {
Expand Down Expand Up @@ -754,8 +754,8 @@ export class Converter {
};
}

convertBarline(bars, location) {
let style = 'regular';
convertBarline(bars, location, forced = undefined) {
let style = location === 'left' ? 'none' : 'regular';
let repeat = null;
if (bars.match(/\[|\]/)) {
style = 'light-light';
Expand All @@ -777,7 +777,7 @@ export class Converter {
_name: 'barline',
_attrs: { 'location': location },
_content: [{
'bar-style': style
'bar-style': forced ?? style
}, { ...(repeat && {
_name: 'repeat',
_attrs: { 'direction': repeat, ...(repeat === 'backward' && { 'times': this.repeats }) }
Expand Down
2 changes: 1 addition & 1 deletion test/bugs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Converter } from '../src/lib/converter.js';
let jazz = null;

before(() => {
jazz = new Playlist(fs.readFileSync('test/data/jazz.txt', 'utf-8'));
jazz = new Playlist(fs.readFileSync('test/data/jazz1460.txt', 'utf-8'));
})

describe('Bug Fixes', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/cli.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const exec = util.promisify(require('child_process').exec);

describe('cli', () => {
it('should run successfully', async () => {
const execResult = await exec('node src/cli/cli.js test/data/jazz.txt --songs=Blues');
const execResult = await exec('node src/cli/cli.js test/data/jazz1460.txt --songs=Blues');
const output = execResult.stderr;
console.log(output);
assert.match(output, /Generating 502 Blues/g);
Expand Down
2 changes: 1 addition & 1 deletion test/converter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let blues = null;
let pop = null;

before(() => {
jazz = new Playlist(fs.readFileSync('test/data/jazz.txt', 'utf-8'));
jazz = new Playlist(fs.readFileSync('test/data/jazz1460.txt', 'utf-8'));
playlist = new Playlist(fs.readFileSync('test/data/playlist.html', 'utf-8'));
strange = new Playlist(fs.readFileSync('test/data/strange.html', 'utf-8'));
blues = new Playlist(fs.readFileSync('test/data/blues.txt', 'utf-8'));
Expand Down
1 change: 0 additions & 1 deletion test/data/jazz.txt

This file was deleted.

1 change: 1 addition & 0 deletions test/data/jazz1460.txt

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions test/parser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ describe('Parser', function() {
});

it('should parse the iReal Pro Jazz playlist', function() {
const playlist = new Playlist(fs.readFileSync('test/data/jazz.txt', 'utf-8'));
assert.strictEqual(playlist.songs.length, 1409);
const playlist = new Playlist(fs.readFileSync('test/data/jazz1460.txt', 'utf-8'));
assert.strictEqual(playlist.songs.length, 1459);
});

it('should parse the irealbook:// format', function() {
Expand Down

0 comments on commit feb1835

Please sign in to comment.