Permalink
Browse files

fix smarks problem

  • Loading branch information...
1 parent 7927528 commit 6ab6ec5ea844b27f523b574fb6d578e599922069 @michielbdejong committed Jul 26, 2012
Showing with 11 additions and 6 deletions.
  1. +2 −0 masterParser.js
  2. +1 −1 package.json
  3. +6 −4 parser/html.js
  4. +2 −1 unitTests.js
View
@@ -21,7 +21,9 @@ function doParse(url, type, docRel, headers, content, cb) {
//err = err2;
} else {
for(var i in data2.data) {
+ console.log('considering '+i);
if(data.documents[i]) {
+ console.log('yes');
for(var j in data2.data[i]) {
for(var k in data2.data[i][j]) {
data[j][k]=data2.data[i][j][k];
View
@@ -8,7 +8,7 @@
"scripts": {
"start": "server.js"
},
- "version": "0.0.0-48",
+ "version": "0.0.0-49",
"engines": {
"node": "0.6.x"
},
View
@@ -1,11 +1,11 @@
var htmlparser = require("htmlparser");
//---
-function parseSubTree(subTree, cb) {
+function parseSubTree(subTree, state, cb) {
var nameField;
if(subTree.attribs && subTree.attribs.class) {
var classTags=subTree.attribs.class.split(' ');
for(var i=0; i<classTags.length; i++) {
- if(classTags[i]=='fn') {
+ if(classTags[i]=='fn' && !state.inANotice) {
if(subTree.name=='abbr') {
cb('textFields', 'fullName', subTree.attribs.title);
nameField='nick';
@@ -16,6 +16,8 @@ function parseSubTree(subTree, cb) {
cb('follows', subTree.attribs.href, true);
} else if(classTags[i]=='avatar') {
cb('images', 'avatar', subTree.attribs.src);
+ } else if(classTags[i]=='notice') {
+ state.inANotice=true;
}
}
}
@@ -43,7 +45,7 @@ function parseSubTree(subTree, cb) {
} else if(subTree[eltType][j].rel) {
cb('foaf', subTree[eltType][j].rel, subTree[eltType][j].href);
}
- parseSubTree(subTree[eltType][j], cb);
+ parseSubTree(subTree[eltType][j], state, cb);
}
}
}
@@ -64,7 +66,7 @@ exports.parse = function(url, docRel, headers, content, cb) {
tools: {}
};
for(var i=0; i<data2.length; i++) {
- parseSubTree(data2[i], function(category, property, content) {
+ parseSubTree(data2[i], {}, function(category, property, content) {
if(category=='foaf') {
if(property== 'foaf:name') {
obj.textFields.fullName = content;
View
@@ -64,6 +64,7 @@ doFile('michielbdejong@identi.ca', {
'http://identi.ca/api/statuses/user_timeline/425878.atom': 'S',
}
});
+/*
doFile('michiel@revolutionari.es', {
documents: {
'https://revolutionari.es/profile/michiel': true,
@@ -196,4 +197,4 @@ doFile('http://www.w3.org/People/Berners-Lee/card.rdf', {
'xmpp:tim.bernerslee.9@facebook.com': 'SM',
'https://facebook.com/tim.bernerslee.9': 'R',
'facebook:tim.bernerslee.9': 'RSCM' }
-});
+});*/

0 comments on commit 6ab6ec5

Please sign in to comment.