parameters: (self, tag, attrs)
docstring: Encountered the beginning of a tag
docstring_summary: Encountered the beginning of a tag
docstring_tokens: Encountered the beginning of a tag
function: def handle_starttag(self, tag, attrs):
          """Encountered the beginning of a tag"""
          if self.curr_state == 0:
              if tag == "body": self.curr_state = 1
          else: # self.curr_state == 1
              if tag == "b": self.curr_attributes[cons.TAG_WEIGHT] = cons.TAG_PROP_HEAVY
              elif tag == "i": self.curr_attributes[cons.TAG_STYLE] = cons.TAG_PROP_ITALIC
              elif tag == "u": self.curr_attributes[cons.TAG_UNDERLINE] = cons.TAG_PROP_SINGLE
              elif tag == "strike": self.curr_attributes[cons.TAG_STRIKETHROUGH] = cons.TAG_PROP_TRUE
              elif tag == "span" and attrs[0][0] == cons.TAG_STYLE:
                  match = re.match("(?<=^)(.+):(.+)(?=$)", attrs[0][1])
                  if match != None:
                      if match.group(1) == "color":
                          self.curr_attributes[cons.TAG_FOREGROUND] = match.group(2).strip()
                          self.latest_span.append(cons.TAG_FOREGROUND)
                      elif match.group(1) == "background-color":
                          self.curr_attributes[cons.TAG_BACKGROUND] = match.group(2).strip()
                          self.latest_span.append(cons.TAG_BACKGROUND)
              elif tag == "a" and len(attrs) > 0:
                  link_url = attrs[0][1]
                  if len(link_url) > 7:
                      self.curr_attributes[cons.TAG_LINK] = get_internal_link_from_http_url(link_url)
              elif tag in ["img", "v:imagedata"] and len(attrs) > 0:
                  img_name = attrs[0][1]
                  img_path = os.path.join(self.curr_folder, img_name)
                  if os.path.isfile(img_path):
                      pixbuf = gtk.gdk.pixbuf_new_from_file(img_path)
                      self.pixbuf_vector.append([self.chars_counter, pixbuf, cons.TAG_PROP_LEFT])
                      self.chars_counter += 1
                  else: print "%s not found" % img_path
              elif tag == "br":
                  # this is a data block composed only by an endline
                  self.rich_text_serialize(cons.CHAR_NEWLINE)
                  self.chars_counter += 1
              elif tag == "hr":
                  # this is a data block composed only by an horizontal rule
                  self.rich_text_serialize(cons.CHAR_NEWLINE+self.dad.h_rule+cons.CHAR_NEWLINE)
                  self.chars_counter += len(self.dad.h_rule)+2
              elif tag == "li":
                  self.rich_text_serialize(cons.CHAR_NEWLINE+self.dad.chars_listbul[0]+cons.CHAR_SPACE)
                  self.chars_counter += 3
function_tokens: def handle_starttag ( self , tag , attrs ) : if self . curr_state == 0 : if tag == "body" : self . curr_state = 1 else : # self.curr_state == 1 if tag == "b" : self . curr_attributes [ cons . TAG_WEIGHT ] = cons . TAG_PROP_HEAVY elif tag == "i" : self . curr_attributes [ cons . TAG_STYLE ] = cons . TAG_PROP_ITALIC elif tag == "u" : self . curr_attributes [ cons . TAG_UNDERLINE ] = cons . TAG_PROP_SINGLE elif tag == "strike" : self . curr_attributes [ cons . TAG_STRIKETHROUGH ] = cons . TAG_PROP_TRUE elif tag == "span" and attrs [ 0 ] [ 0 ] == cons . TAG_STYLE : match = re . match ( "(?<=^)(.+):(.+)(?=$)" , attrs [ 0 ] [ 1 ] ) if match != None : if match . group ( 1 ) == "color" : self . curr_attributes [ cons . TAG_FOREGROUND ] = match . group ( 2 ) . strip ( ) self . latest_span . append ( cons . TAG_FOREGROUND ) elif match . group ( 1 ) == "background-color" : self . curr_attributes [ cons . TAG_BACKGROUND ] = match . group ( 2 ) . strip ( ) self . latest_span . append ( cons . TAG_BACKGROUND ) elif tag == "a" and len ( attrs ) > 0 : link_url = attrs [ 0 ] [ 1 ] if len ( link_url ) > 7 : self . curr_attributes [ cons . TAG_LINK ] = get_internal_link_from_http_url ( link_url ) elif tag in [ "img" , "v:imagedata" ] and len ( attrs ) > 0 : img_name = attrs [ 0 ] [ 1 ] img_path = os . path . join ( self . curr_folder , img_name ) if os . path . isfile ( img_path ) : pixbuf = gtk . gdk . pixbuf_new_from_file ( img_path ) self . pixbuf_vector . append ( [ self . chars_counter , pixbuf , cons . TAG_PROP_LEFT ] ) self . chars_counter += 1 else : print "%s not found" % img_path elif tag == "br" : # this is a data block composed only by an endline self . rich_text_serialize ( cons . CHAR_NEWLINE ) self . chars_counter += 1 elif tag == "hr" : # this is a data block composed only by an horizontal rule self . rich_text_serialize ( cons . CHAR_NEWLINE + self . dad . h_rule + cons . CHAR_NEWLINE ) self . chars_counter += len ( self . dad . h_rule ) + 2 elif tag == "li" : self . rich_text_serialize ( cons . CHAR_NEWLINE + self . dad . chars_listbul [ 0 ] + cons . CHAR_SPACE ) self . chars_counter += 3