Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infobox parsing module #2

Open
dijs opened this issue May 22, 2016 · 8 comments
Open

Infobox parsing module #2

dijs opened this issue May 22, 2016 · 8 comments

Comments

@dijs
Copy link

dijs commented May 22, 2016

I am the developer of wikijs.

I have a favor to ask, I love the problem this module is solving... Is there any way you could export the parser of this module so I could use JUST the parsing functionality?

I already have the infobox request part, but I would like to use your library for the parsing.

Thanks,

@0x333333
Copy link
Owner

0x333333 commented May 23, 2016

Hi @dijs ,

Thanks for your suggestion, if you only want the parser, I can change the interface of current lib like this:

var wikiParser = require('wiki-infobox-parser');

/* Previous interface */
wikiParser('france', function(err, result) {
  if (err) {
    console.error(err.message);
  } else {
    console.log(result);
  }
});

/* New interface */
let config = {
  'keyword': 'france',
  'wikitext': '=== A sample of original wiki text. ==='
};
/* If wikitext is not null, I will use the text directly without calling Wiki API. */
wikiParser(config, function(err, result) {
  if (err) {
    console.error(err.message);
  } else {
    console.log(result);
  }
});

Does this work for you?

@dijs
Copy link
Author

dijs commented May 23, 2016

I was hoping to not have the request dependency. Since this will be
bundled. Is there any way the parsing code can be a completely different
module?
On Mon, May 23, 2016 at 4:56 AM Zhipeng JIANG notifications@github.com
wrote:

Hi @dijs https://github.com/dijs ,

Thanks for your suggestion, if you only want the parser, I can change the
interface of current lib like this:

var wikiParser = require('wiki-infobox-parser');

/* Previous interface /wikiParser('france', function(err, result) {
if (err) {
console.error(err.message);
} else {
console.log(result);
}
});
/
New interface /let config = {
'keyword': 'france',
'wikitext': '=== A sample of original wiki text. ==='
};/
If wikitext is not null, I will use the text directly without calling Wiki API. */wikiParser(config, function(err, result) {
if (err) {
console.error(err.message);
} else {
console.log(result);
}
});

Does this work for you?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#2 (comment)

@dijs
Copy link
Author

dijs commented May 25, 2016

So, a follow up to this. My wikijs is not able to be bundled as a browser app b/c your library uses request. That is why I was hoping the parser itself could be it's own module. If you can't, no problem. I can externalize it. And if I do that, do you mind if I use your code?

@0x333333
Copy link
Owner

Hi @dijs, sorry for the late reply, I'm OOO this week. I can extract the parser out of this lib, hopefully I can publish it tomorrow. By the way, if you want to use the code directly, feel free to play with it :D

@0x333333
Copy link
Owner

Hi @dijs , I've publish the first version of the parser, you can check it out here: + wiki-infobox-parser-core@0.0.1. More tests will be added.

@dijs
Copy link
Author

dijs commented May 29, 2016

Thank you so much!
On Sun, May 29, 2016 at 9:36 AM Zhipeng JIANG notifications@github.com
wrote:

Hi @dijs https://github.com/dijs , I've publish the first version of
the parser, you can check it out here: + wiki-infobox-parser-core@0.0.1
https://www.npmjs.com/package/wiki-infobox-parser-core. More tests will
be added.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#2 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ABsTXhc9WAMCZj37g-euiAz9ltUij5C5ks5qGaRQgaJpZM4IkDWO
.

@dijs
Copy link
Author

dijs commented May 30, 2016

Awesome. I threw it in here: dijs/wiki#23

Could we not always console log when parsing? Or maybe use the debug module if necessary.

@0x333333
Copy link
Owner

Thanks @dijs , I will fix them as soon as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants