hackers-painters / katana-parser

A CSS parsing library in pure C99
http://hackers-painters.github.io/katana-parser
MIT License
180 stars 40 forks source link

extraneous return in the middle of parser.c katana_print routine #2

Open kevinhendricks opened 8 years ago

kevinhendricks commented 8 years ago

Did fresh checkout and build on Mac OS X and it all builds and seems to work.

Found an extraneous printf("\n") of a newline inside kantan_print routine in parser.c

void katana_print(const char * format, ...)
{
    va_list args;
    va_start(args, format);
    vprintf(format, args);
    printf("\n");
    va_end(args);
    fflush(stdout);
}

Perhaps you want to remove that? It seems to mess up indentation and output format for no good reason (inserting a newline before every ";" at the end of each property value).

Also I wanted to know about the status of this project. I develop for Sigil (github.com/Sigil-Ebook/Sigil) which is a epub2/epub3 editor and we need a good css parser. We are already a heavy user of a modified version of gumbo (to support xhtml parsing) and your project description caught my attention because of your project goals and their similarity to gumbo-parser.

  1. Is this project still alive?
  2. How complete and usable is it?
  3. Is there any read only interface for specific pieces or a set of callbacks or anything that would allow the parser to be utilized more easily (the dump_output approach seems to be to heavy to make easy use)? Or do we walk the output by duplicating your dump routine approach and process things ourselves step by step?
  4. Are there any sample programs that demonstrate the interface in more details?
  5. Is there any documentation outside of the code itself?

Thanks!

qfish commented 8 years ago

Thanks for your attention to this project.

You are right, the \n is a mistake 😬.

  1. I have to say it's not alive temporarily for some reason.
  2. It's a part of the samurai-native, not complete but stable in a way. It has been tested on these popular css frameworks.
  3. katana is just a parser parsing css into structs declared in katana.h as gumbo does. If you want build your own query selector or resolver, you have to write the wrapper by yourself.
  4. The public sample program is the css module (with the 'css-' prefix) of samurai-native. Or would you send me an email directly and I could give you the sample program with the bison and flex source.
  5. I'm so sorry for that there is no documents but the 'katana.h' and the code itself. This project is influenced deeply by the css module of blink and webkit.
  6. Here is an alternative, libcss.

I hope this could help you!