SassDoc / sassdoc

Release the docs!
http://sassdoc.com
MIT License
1.41k stars 56 forks source link

Write a real parser #20

Closed KittyGiraudel closed 10 years ago

KittyGiraudel commented 10 years ago

Regular expressions are not powerful enough.

We need to write a real parser.

KittyGiraudel commented 10 years ago

First draft: https://gist.github.com/HugoGiraudel/5614be5d1f02eb25c175.

pascalduez commented 10 years ago

Just an quick idea, not sure it will be the best fit, but building on top of existing CSS parsers like rework or PostCSS ?

KittyGiraudel commented 10 years ago

Well, I am not sure. As far as know, both are CSS parsers. What we need here is a documentation parser.

alademann commented 10 years ago

Agreed @HugoGiraudel

KittyGiraudel commented 10 years ago

Thanks for the input Aaron, I'll keep working on this to see if it can go anywhere.

KittyGiraudel commented 10 years ago

Latest version: https://gist.github.com/HugoGiraudel/5614be5d1f02eb25c175. Getting closer.

Edit: I added a isValidType function but it's not used yet.

alademann commented 10 years ago

Latest version from Hugo... https://gist.github.com/HugoGiraudel/9f44eb6b3d3391abb384

KittyGiraudel commented 10 years ago

Progress:

To do:

KittyGiraudel commented 10 years ago

Managed to get some things done:

I found an issue in the process: a function with a single line comment isn't documented, for instance a single @alias line.

// @alias other-function

@function whatever($whatever) {
  @return whatever;
}

Meanwhile, this works:

// @requires other-function
// @alias other-function

@function whatever($whatever) {
  @return whatever;
}
KittyGiraudel commented 10 years ago

Fabrice's work: https://github.com/FWeinb/CDocParser. Looks very promising.

KittyGiraudel commented 10 years ago

New branch now using CDocParser and ScssCommentParser. Will deploy 1.0.0 shortly.