fix: allow colons in events

This commit is contained in:
Jesse Wright
2025-03-02 22:04:12 +00:00
parent bc2bd3d769
commit 0ce0c3cd75
2 changed files with 25 additions and 1 deletions

View File

@@ -29,7 +29,7 @@ accDescr\s*"{"\s* { this.begin("acc_descr_multili
"section"\s[^:\n]+ return 'section';
// event starting with "==>" keyword
":"\s[^:\n]+ return 'event';
":"\s(?:[^#:\n;]|":"(?!\s))+ return 'event';
[^#:\n]+ return 'period';

View File

@@ -75,6 +75,30 @@ describe('when parsing a timeline ', function () {
});
});
it('should handle a section, and task and its events including markdown link', function () {
let str = `timeline
section abc-123
task1: [event1](http://example.com)
task2: event2: event3
`;
timeline.parse(str);
expect(timelineDB.getSections()[0]).to.deep.equal('abc-123');
timelineDB.getTasks().forEach((t) => {
switch (t.task.trim()) {
case 'task1':
expect(t.events).to.deep.equal(['[event1](http://example.com)']);
break;
case 'task2':
expect(t.events).to.deep.equal(['event2', 'event3']);
break;
default:
break;
}
});
});
it('should handle a section, and task and its multi line events', function () {
let str = `timeline
section abc-123