[Dillo-dev]small question about TagInfo in html.c
Hey, What exactly do the EndTag en TagLevel fields in the TagInfo struct stand for? I was going to add the "q" function but I'm not sure what I should fill in here. (and it wasn't directly clear from the otherwise excellent src docs). TIA, Wim
On Sat, Jul 02, 2005 at 02:57:49PM +0200, Wim De Smet wrote:
Hey,
What exactly do the EndTag en TagLevel fields in the TagInfo struct stand for? I was going to add the "q" function but I'm not sure what I should fill in here. (and it wasn't directly clear from the otherwise excellent src docs).
EndTag holds whether the end tag of the HTML element is "Required", "Optional" or "Forbidden" as of the HTML 4.01 SPEC. TagLevel is a number that is used to heuristically parse bad HTML (it overrides the HTML SPEC a bit). The comment over Html_tag_cleanup_at_close() explains this. In a nutshell, a higher TagLevel allows the closing element's tag to close intermediate open tags, in the parsing stack, with lower TagLevel. Just use 2 as the value! :-) -- Cheers Jorge.-
On 7/2/05, Jorge Arellano Cid <jcid@dillo.org> wrote:
On Sat, Jul 02, 2005 at 02:57:49PM +0200, Wim De Smet wrote:
Hey,
What exactly do the EndTag en TagLevel fields in the TagInfo struct stand for? I was going to add the "q" function but I'm not sure what I should fill in here. (and it wasn't directly clear from the otherwise excellent src docs).
EndTag holds whether the end tag of the HTML element is "Required", "Optional" or "Forbidden" as of the HTML 4.01 SPEC.
TagLevel is a number that is used to heuristically parse bad HTML (it overrides the HTML SPEC a bit). The comment over Html_tag_cleanup_at_close() explains this.
In a nutshell, a higher TagLevel allows the closing element's tag to close intermediate open tags, in the parsing stack, with lower TagLevel.
Just use 2 as the value! :-)
Okay then. But does this make it possible that the function for the close tag is then called twice? The way I'm trying to get the q to render now is just adding in an open tag and a close tag function and calling a_Dw_page_add_text from both. The problem being that the text seems to be added twice at the end. Related, I presumed that for add_text I have to alloc the string but not dealloc it. Is this correct? Still mucking about a bit. ;-) greets, Wim
On Sat, Jul 02, 2005 at 09:17:20PM +0200, Wim De Smet wrote:
On 7/2/05, Jorge Arellano Cid <jcid@dillo.org> wrote:
On Sat, Jul 02, 2005 at 02:57:49PM +0200, Wim De Smet wrote:
Hey,
What exactly do the EndTag en TagLevel fields in the TagInfo struct stand for? I was going to add the "q" function but I'm not sure what I should fill in here. (and it wasn't directly clear from the otherwise excellent src docs).
EndTag holds whether the end tag of the HTML element is "Required", "Optional" or "Forbidden" as of the HTML 4.01 SPEC.
TagLevel is a number that is used to heuristically parse bad HTML (it overrides the HTML SPEC a bit). The comment over Html_tag_cleanup_at_close() explains this.
In a nutshell, a higher TagLevel allows the closing element's tag to close intermediate open tags, in the parsing stack, with lower TagLevel.
Just use 2 as the value! :-)
Okay then. But does this make it possible that the function for the close tag is then called twice? The way I'm trying to get the q to render now is just adding in an open tag and a close tag function and calling a_Dw_page_add_text from both. The problem being that the text seems to be added twice at the end. Related, I presumed that for add_text I have to alloc the string but not dealloc it. Is this correct?
Call a_Dw_page_add_text from open tag only. Close tag is mainly for cleanups.
Still mucking about a bit. ;-)
Look at some other simple elements. There're plenty of examples in html.c. -- Cheers Jorge.-
participants (2)
-
Jorge Arellano Cid
-
Wim De Smet