[Pas2js] generated pascal classed from html/css reference
Michael Van Canneyt
michael at freepascal.org
Sun Oct 21 09:37:42 CEST 2018
On Sun, 21 Oct 2018, Mr Bee via Pas2js wrote:
> Hi, I found lots of classes in pas2js are marked `external` which means
> the class definition is not complete.
External does not mean it is not complete. It means they are classes which
exist in a Javascript library not handled by the compiler.
> Sometimes it contains nothing but
> the class declaration only. It makes autocomplete doesn't work on any
> Pascal editors or IDEs. It forces us to find the details manually from
> HTML/JS documentations. It's so unproductive.
If you think properties are missing for a certain class, please report them.
> I propose pas2js to
> automatically generate all js classes and html tags and attributes from a
> complete html and css document reference. This technique was used by
> ExtPascal to automatically generate all ExtJS pascal classes from ExtJS
> documentation.
This pre-supposes that the documentation is
a) complete
b) structured in a way it can be parsed.
c) uniform.
This was not even the case for extpascal, which contained numerous errors
and was hopelessly outdated (this in no way diminishes the efforts of it's
creator - the material he had to work with was simply a moving target))
> Using this technique there's no need to do manual works
> converting HTML/JS classes into Pascal classes. What do you think?
Since every project uses it's own mechanism for generating documentation,
this means you need to create as many converters as there are projects.
On top of that, the project docs also evolve and you can start all over.
The only "standard" is webidl.
So, we have the webidl2pas tool.
The problem is then that you need a complete IDL of the class you are trying to create.
WebAudio and WebBluetooth have such an IDL.
You will find it difficult to find such an IDL.
Even the HTML 5.1 IDL is far from complete:
https://www.w3.org/TR/html51/idl-index.html#idl-index
The Javascript world evolves continuously, the standards are out of date
most of the time. To boot, IDL itself evolves. Official WebIDL is 1.0.
The webaudio and webbluetooth are using IDL 2.0 which is just a draft, and
not backwards compatible with 1.0.. It's a shambles.
So yes, we do the basics manually.
I repeat:
If you think things are missing, report them and I will add them.
(or you can provide a patch ;) ). Keep in mind that I do not add
experimental features. The MDN documentation clearly indicates experimental
features:
https://developer.mozilla.org/en-US/docs/Web/API
Michael.
More information about the Pas2js
mailing list