parameters: (self, tag)
docstring: Encountered the end of a tag
docstring_summary: Encountered the end of a tag
docstring_tokens: Encountered the end of a tag
function: def handle_endtag(self, tag):
          """Encountered the end of a tag"""
          if self.curr_state == 1:
              if tag == "dt":
                  # title reception complete
                  self.nodes_list.append(self.dom.createElement("node"))
                  self.nodes_list[-1].setAttribute("name", self.curr_title)
                  self.nodes_list[-1].setAttribute("prog_lang", cons.RICH_TEXT_ID)
                  self.nodes_list[-2].appendChild(self.nodes_list[-1])
                  self.curr_title = ""
                  # waiting for data
                  if self.chars_counter > 0:
                      # this means the new node is child of the previous, so we did not pop
                      for pixbuf_element in self.pixbuf_vector:
                          self.xml_handler.pixbuf_element_to_xml(pixbuf_element, self.nodes_list[-2], self.dom)
                      self.pixbuf_vector = []
                      self.chars_counter = 0
                  # got dd, we go state 1->2
                  self.curr_state = 2
          elif self.curr_state == 2:
              if tag == "dd":
                  # the current node has no more job to do
                  for pixbuf_element in self.pixbuf_vector:
                      self.xml_handler.pixbuf_element_to_xml(pixbuf_element, self.nodes_list[-1], self.dom)
                  self.pixbuf_vector = []
                  self.chars_counter = 0
                  self.nodes_list.pop()
                  # got /dd, we go state 2->0 and wait for a brother
                  self.curr_state = 0
              elif tag == "dl":
                  # the current node has no more job to do
                  for pixbuf_element in self.pixbuf_vector:
                      self.xml_handler.pixbuf_element_to_xml(pixbuf_element, self.nodes_list[-1], self.dom)
                  self.pixbuf_vector = []
                  self.chars_counter = 0
                  self.nodes_list.pop()
                  self.nodes_list.pop()
                  # got /dl, we go state 2->0 and wait for a parent's sibling
                  self.curr_state = 0
              elif tag == "b": self.curr_attributes[cons.TAG_WEIGHT] = ""
              elif tag == "i": self.curr_attributes[cons.TAG_STYLE] = ""
              elif tag == "u": self.curr_attributes[cons.TAG_UNDERLINE] = ""
              elif tag == "s": self.curr_attributes[cons.TAG_STRIKETHROUGH] = ""
              elif tag == "span":
                  if self.latest_span:
                      if self.latest_span[-1] == cons.TAG_FOREGROUND: self.curr_attributes[cons.TAG_FOREGROUND] = ""
                      elif self.latest_span[-1] == cons.TAG_BACKGROUND: self.curr_attributes[cons.TAG_BACKGROUND] = ""
                      del self.latest_span[-1]
              elif tag == "a": self.curr_attributes[cons.TAG_LINK] = ""
          elif tag == "dl":
              # backward one level in nodes list
              for pixbuf_element in self.pixbuf_vector:
                  self.xml_handler.pixbuf_element_to_xml(pixbuf_element, self.nodes_list[-1], self.dom)
              self.pixbuf_vector = []
              self.chars_counter = 0
              self.nodes_list.pop()
function_tokens: def handle_endtag ( self , tag ) : if self . curr_state == 1 : if tag == "dt" : # title reception complete self . nodes_list . append ( self . dom . createElement ( "node" ) ) self . nodes_list [ - 1 ] . setAttribute ( "name" , self . curr_title ) self . nodes_list [ - 1 ] . setAttribute ( "prog_lang" , cons . RICH_TEXT_ID ) self . nodes_list [ - 2 ] . appendChild ( self . nodes_list [ - 1 ] ) self . curr_title = "" # waiting for data if self . chars_counter > 0 : # this means the new node is child of the previous, so we did not pop for pixbuf_element in self . pixbuf_vector : self . xml_handler . pixbuf_element_to_xml ( pixbuf_element , self . nodes_list [ - 2 ] , self . dom ) self . pixbuf_vector = [ ] self . chars_counter = 0 # got dd, we go state 1->2 self . curr_state = 2 elif self . curr_state == 2 : if tag == "dd" : # the current node has no more job to do for pixbuf_element in self . pixbuf_vector : self . xml_handler . pixbuf_element_to_xml ( pixbuf_element , self . nodes_list [ - 1 ] , self . dom ) self . pixbuf_vector = [ ] self . chars_counter = 0 self . nodes_list . pop ( ) # got /dd, we go state 2->0 and wait for a brother self . curr_state = 0 elif tag == "dl" : # the current node has no more job to do for pixbuf_element in self . pixbuf_vector : self . xml_handler . pixbuf_element_to_xml ( pixbuf_element , self . nodes_list [ - 1 ] , self . dom ) self . pixbuf_vector = [ ] self . chars_counter = 0 self . nodes_list . pop ( ) self . nodes_list . pop ( ) # got /dl, we go state 2->0 and wait for a parent's sibling self . curr_state = 0 elif tag == "b" : self . curr_attributes [ cons . TAG_WEIGHT ] = "" elif tag == "i" : self . curr_attributes [ cons . TAG_STYLE ] = "" elif tag == "u" : self . curr_attributes [ cons . TAG_UNDERLINE ] = "" elif tag == "s" : self . curr_attributes [ cons . TAG_STRIKETHROUGH ] = "" elif tag == "span" : if self . latest_span : if self . latest_span [ - 1 ] == cons . TAG_FOREGROUND : self . curr_attributes [ cons . TAG_FOREGROUND ] = "" elif self . latest_span [ - 1 ] == cons . TAG_BACKGROUND : self . curr_attributes [ cons . TAG_BACKGROUND ] = "" del self . latest_span [ - 1 ] elif tag == "a" : self . curr_attributes [ cons . TAG_LINK ] = "" elif tag == "dl" : # backward one level in nodes list for pixbuf_element in self . pixbuf_vector : self . xml_handler . pixbuf_element_to_xml ( pixbuf_element , self . nodes_list [ - 1 ] , self . dom ) self . pixbuf_vector = [ ] self . chars_counter = 0 self . nodes_list . pop ( )