Skip to content
Permalink
Browse files

Working on issue#17. Some tests fail flat now, without no good reason…

… at all
  • Loading branch information...
daitangio committed Dec 17, 2018
1 parent ab1ac40 commit 6945d9a1394f942aaf83f7caea1de3ca33f75fce
Showing with 55 additions and 24 deletions.
  1. +20 −17 lib/org-mode-parser.js
  2. +8 −0 test/colon_mistake.org
  3. +27 −7 test/parserTest.js
@@ -407,25 +407,28 @@ var parseBigString=function (data){
tag1 = null;
alltags = []; // list of all tags in headline
drawerArray={};


// WAS tagsrch = re.search('(.*?)\s*:(.*?):(.*?)$',heading)
var tagsrch=heading.match(/(.*?)\s*:(.*?):(.*?)$/);
if (tagsrch){
// debug("Tag founds:"+JSON.stringify(tagsrch));
// Correct the heading
heading = tagsrch[1];
tag1 = tagsrch[2];
alltags.push(tag1);
tag2 = tagsrch[3];
if(tag2){
// Sub tag parsing...
//debug("Tag after the first:"+tag2);
_.each(tag2.split(/:/),function (t){
if(t!=='') alltags.push(t);
});
//debug(JSON.stringify(alltags));
}


// Examples:
// Bla bla: bla :tag:tag:
// Bla bla: bla
debug("HEADING:"+heading);
var tagBulk=heading.match(/:([a-zA-Z0-9:]+):$/)
if(tagBulk){
debug("New Tags :"+JSON.stringify(tagBulk[0]));
heading = heading.replace(tagBulk[0],"").trim()

_.each(tagBulk[0].split(/:/),function (t){
if(t!=='') alltags.push(t);
});

if(alltags.length>=1) {
tag1=alltags[0];
}

debug("TAGS:"+JSON.stringify(alltags));
}

}else{
@@ -0,0 +1,8 @@
****** Feature: create and register new wordpress-powered (source) jekyll blog :toblog:
yaya, cool
markdown here
if the headline has a : in it, it will confuse the parser and it will think the headline is actually a tag.


* Simple tag :simple:
* Simple tag double :one:double:
@@ -794,6 +794,7 @@ vows.describe('OrgMode 0.0.5').addBatch({
},
'parsing works':function(nodes,u){
// Expected one master node
//console.dir(nodes);
assert.isNotNull(nodes);
//assert.equal(1,nodes.length);
}
@@ -838,18 +839,37 @@ vows.describe('OrgMode API Bugs').addBatch({
}
}).export(module);

vows.describe('OrgMode Reika').addBatch({
vows.describe('Bug Fix 2018').addBatch({
'2018':{
'INCLUDE works': {
'colon mistake works': {
topic: function (){
//orgParser.enableDebug();
orgParser.makelist("./test/includeTest.org",this.callback);
orgParser.enableDebug();
orgParser.makelist("./test/colon_mistake.org",this.callback);
//orgParser.disableDebug();
},
'IncludeWorks_basic':function(n,unused){
//console.dir(n[1]);
assert.equal(n.length,3 /*expected*/);
'Tag detection':function(n,unused){
(n[0]);
assert.equal(n[0].tags["toblog"],true);
//assert.equal(n.length,1 /*expected*/);
},

}
}
}).export(module);


// vows.describe('OrgMode Reika').addBatch({
// '2018':{
// 'INCLUDE works': {
// topic: function (){
// //orgParser.enableDebug();
// orgParser.makelist("./test/includeTest.org",this.callback);
// },
// 'IncludeWorks_basic':function(n,unused){
// //console.dir(n[1]);
// assert.equal(n.length,3 /*expected*/);
// },

// }
// }
// }).export(module);

0 comments on commit 6945d9a

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.