walling / gulp-raml2html

A simple RAML to HTML documentation generator, wrapped for Gulp.
MIT License
21 stars 23 forks source link

Fixes import using relative paths - Fixes #1 #4

Closed repocho closed 10 years ago

repocho commented 10 years ago

Fixes the issue when raml2html tries to resolve relative path includes in raml files.

According with the grunt file https://github.com/zestia/grunt-contrib-raml2html/blob/master/tasks/raml2html.js I tried to apply this approach to this plugin.

I didn't perform too much tests but with my current gulp and raml files it's working fine.

If you see whatever issue after testing tell me and we will try to solve them.

walling commented 10 years ago

Sorry for the delay! Overall your PR looks good. I'll merge it in, if you could just take a moment to comment on these minor issues first:

Do you need to add path module in dependencies? It's a built-in module in NodeJS, so I don't think it's necessary.

The other issue on top of my head is that gulp plugins might run asynchronously, meaning that changing directory can affect other plugins running at the same time. However, it's a fine short term bugfix. I would look into fixing the issue in the raml-parser module, ie. by allowing you to set a path when parsing RAML from a string.

repocho commented 10 years ago

Hi walling !

Thanks for your reply. You are right, I removed the dependency path and it's working also, so it's fine.

About the asynchronous issue I think is difficult to get an error about it, but could be... At the moment I think is the best option... If you modify the raml-parser could be better to add the path there instead of changing the working dir.

Additionaly I would like to change the raml-parser because there is another issue with the includes inside a json-shema, and the problem is that raml-parser only returns a string and should return an object with some methods, the minimum should be .getJson and .getPath to be able to know the path for resolving the includes inside the json-schema. But this... is another separate issue :)

Thnks again walling !

walling commented 10 years ago

Looks great!