weizhenye / ass-compiler

Parses and compiles ASS subtitle format to easy-to-use data structure
https://ass.js.org/ass-compiler/
MIT License
107 stars 18 forks source link

Incorrect types? #5

Closed AxelTerizaki closed 4 years ago

AxelTerizaki commented 4 years ago

Hello :)

I'm trying to update to version 0.1.0.

However, it looks like the online viewer and the types are not the same.

If I want to parse dialogues in an ASS files I should be able to from the dialogues object from the main object I get from parse. However, the types seem to still wait a events and dialogue objects inside...

Am I doing something wrong or are types not up-to-date ?

Thanks in advance

AxelTerizaki commented 4 years ago

Okay, my bad, I tried the module by itself and it seems to keep the events object.

What's misleading, I think, is that the online viewer isn't outputing the same thing when you paste an ASS file inside...

weizhenye commented 4 years ago

Sorry, I don't get your point. Do you mean online viewer don't parse single line of dialogue? When paste the same completed ASS file, it should output the same result.

By the way, I'm not very familiar with TypeScript, you're welcome if you'd like to contribute.

AxelTerizaki commented 4 years ago

Yes, my original issue was about the types but I took the online viewer as an example, and it outputs different JSON than the module.

Online viewer :

{
  "info": ...
  "styles": ...
  "dialogues": ...
}

Module :

{
  "info": ...
  "styles": ...
  "events": {
    "format": ...
    "comments": ...
    "dialogue": ...
  }
}

Your types are perfectly fine in the code, but since I used the online viewer at first to check what I neede to look for, it misled me into thinking the types were incorrect.

weizhenye commented 4 years ago

There are two modes, parse and compile. Online viewer is using compiled result as default.

AxelTerizaki commented 4 years ago

Okay, this explains that! orry for the issue then. Maybe making it more explicit in the readme would be nice though :)