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

Use haddock-library for parsing package descriptions #46

Closed
sol opened this issue Dec 5, 2014 · 7 comments
Closed

Use haddock-library for parsing package descriptions #46

sol opened this issue Dec 5, 2014 · 7 comments

Comments

@sol
Copy link

sol commented Dec 5, 2014

Hackage supports markup in package descriptions. The syntax tries to resemble Haddock syntax. Stackage does not interpret markup in package descriptions yet (e.g. looking at hspec, the list is not marked up and URLs in <..> are not turned into links).

The Haddock parser is now available as a separate library, so it can be used to parse package descriptions and create proper HTML from that. I think with this it may be quite easy to add support for markup in package descriptions to Stackage.

(CCing @Fuuzetsu)

@snoyberg
Copy link
Contributor

snoyberg commented Dec 5, 2014

That looks useful, I'd like to add this support. I'm having trouble figuring out the right way to convert a DocH into HTML, can you provide any guidance?

@snoyberg
Copy link
Contributor

snoyberg commented Dec 5, 2014

Oh, looks like it's just a manual pattern-matching process, isn't it?

@Fuuzetsu
Copy link

Fuuzetsu commented Dec 5, 2014

If you want to do the HTML rendering yourself then you can just match on the AST the parser spits out pretty trivially.

If you want to use Haddock to do this job then we still need to make this functionality more accessible: it's currently in Haddock core and is behind the scary restriction of single GHC version; We have an issue open at haskell/haddock#243 which I hoped to get into next major GHC release (7.10.x) but unfortunately didn't have a good chance to do and may have to push it back considering the RC is Soon™…

I think just extracting the part that does comment → HTML should be pretty easy however so maybe just that can still be done and moved to Haddock library. The only ‘problem’ is that it won't be able to hyperlink identifiers if done this way as we need GHC for that.

@snoyberg
Copy link
Contributor

snoyberg commented Dec 5, 2014

Fair enough, thanks for the response. I'm testing out an implementation now, I've just run into a separate issue that I need to diagnose first.

@snoyberg
Copy link
Contributor

snoyberg commented Dec 5, 2014

Alright, here's my HTML rendering function:

e755ea6#diff-2de6d9a0f9a1be4f5b9c746b1040398eR294

I haven't gotten it to update the entire server database yet, that's what's holding things up right now. Seems that inserting 47,000 times into a HashMap is slow for some reason...

@snoyberg
Copy link
Contributor

snoyberg commented Dec 5, 2014

OK, fixed, it wasn't using the updated code for some reason.

@Fuuzetsu Thanks for the Haddock-parsing library, made this rather straightforward!

@sol Thanks for pointing this out, can you have a look at the package page and let me know how it works for you?

@sol
Copy link
Author

sol commented Dec 7, 2014

Looks good :)

@sol sol closed this as completed Dec 7, 2014
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

3 participants