Adding href and img to HTMLFMT

Sim & Golda Zacks simngolda at voyager.net
Mon Aug 9 22:56:40 EDT 1999


It must have been brainfreeze last night. It obviously is a multiple
inheritance using HTMLSingleElement and HTMLElement. Code posted below for
both.

class IMG(HTMLSingleEntry, HTMLElement):
   """ an Image tag"""

Tag_Format="<img%(SRC)s%(ALT)s%(ALIGN)s%(HEIGHT)s%(WIDTH)s%(BORDER)s%(HSPACE)s%(VSPACE)s%(USEMAP)s%(ISMAP)s>"

   end_tag=""

HTML_Attributes=("SRC","ALT","ALIGN","HEIGHT","WIDTH","BORDER","HSPACE","VSPACE","USEMAP","ISMAP")

   def __init__(self,
   SRC=None,
   ALT=None,
   ALIGN=None,
   HEIGHT=None,
   WIDTH=None,
   BORDER=None,
   HSPACE=None,
   VSPACE=None,
   USEMAP=None,
   ISMAP=None
   ):

HTMLElement.__init__(self,SRC=SRC,ALT=ALT,ALIGN=ALIGN,HEIGHT=HEIGHT,WIDTH=WIDTH,BORDER=BORDER,HSPACE=HSPACE,VSPACE=VSPACE,USEMAP=USEMAP,ISMAP=ISMAP)


class A(HTMLSingleEntry, HTMLElement):
   """an HTML hyperlink"""

Tag_Format="<a%(HREF)s%(name)s%(charset)s%(target)s%(rel)s%(rev)s%(accesskey)s%(shape)s%(coords)s%(tabindex)s>"

   end_tag="</a>"

HTML_Attributes=("HREF","charset","name","target","rel","rev","accesskey","shape","coords","tabindex")

   def __init__(self,
      HREF,
      Text,
      name=None,
      charset=None,
      target=None,
           rel=None,
      rev=None,
      accesskey=None,
      shape=None,
      coords=None,
      tabindex=None
      ):
 HTMLElement.__init__(self, Text=Text, HREF=HREF, name=name,
charset=charset, target=target, rel=rel, rev=rev, accesskey=accesskey,
shape=shape, coords=coords,tabindex=tabindex)


Sim & Golda Zacks wrote:

> I am using the HTMLFMT module that came with the INTERNET programming
> with Python and I wanted to add support for links and images but I am
> having a problem. I can't figure out whether to add it as a descendent
> of HTMLElement or of a Seq. The problem is it should be a Sequence
> because There are no properties to it, but the URL is part of the tag
> and I seem to be having a mental block when I try thinking about it. If
> someone could help me with this, I would greatly appreciate it.
>
> Sim





More information about the Python-list mailing list