How would one go about subclassing the SimpleHTML Datatype? As it doesn't come with any public include file, I'm wondering how to obtain a data buffer from it. For example, with the Text Datatype you can use GetDTAttrs() to query about TDTA_Buffer and then process the buffer data in your subclass. I need something similar - a buffer with unprocessed data - but looking at the source code in A-EON's repository I'm not sure SimpleHTML is designed for subclassing at all.
Thu, 2018-03-08 10:13
#1
Subclassing SimpleHTML Datatype
What would you want to acheive with a subclass?
I doubt subclassing is really feasible TBH.
It's a very annoying datatype that's stops you from view HTML src in MultiView(er) :-)
It's html rendering is rather horrid. Best use a webbrowser...
Note text.datatype is root class (well at least its the root of the GID_TEXT group anyway) so is designed for subclassing.
BTW I'm not sure you could easily subclass amigaguide.datatype either.
@broadblues
To cut a long story short: I've ported a MarkDown parser, which I have turned into an Amiga datatype. I wrote it as a Text Datatype subclass but then I realized that the Text Datatype has some shortcomings: for example, the public include file indicates that the datatype supports in-text links but in reality, links have never been implemented.
Because the parser automatically converts into HTML as it goes through the MarkDown data, I thought I might be better off if I turned it into a SimpleHTML subclass instead. The idea was that SimpleHTML would provide a buffer containing the original data (i.e. MarkDown text) which the subclass would then parse, convert, and pass the HTML output back to the superclass to take care of the display.
But it appears I may have overestimated SimpleHTML, and looking at its rather convoluted source code I can't see an easy way to achieve what I need.
I think both Text Datatype and SimpleHTML Datatype are direct subclasses of datatypesclass (which is a subclass of gadgetclass) and as such they should have been designed for further subclassing, or otherwise what's the purpose of Amiga Datatypes being object-oriented?
AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2
Your going about that the wrong way. Subclass a class that complex is not going to work. But you can *embed* an html datatype object in your mark down object in the same way as you might embed a button gadget in more complex file request gadget.
So parse in the markdown data as a top level GID_DOCUMENT then pass the html created to the embded html object.