parameters: (self, start_iter, end_iter)
docstring: Adds a slice to the HTML Text
docstring_summary: Adds a slice to the HTML Text
docstring_tokens: Adds a slice to the HTML Text
function: def html_text_serialize(self, start_iter, end_iter):
          """Adds a slice to the HTML Text"""
          inner_text = cgi.escape(start_iter.get_text(end_iter))
          if inner_text == "": return
          inner_text = inner_text.replace(cons.CHAR_NEWLINE, "<br />")
          html_attrs = ""
          superscript_active = False
          subscript_active = False
          monospace_active = False
          bold_active = False
          italic_active = False
          for tag_property in cons.TAG_PROPERTIES:
              if self.curr_attributes[tag_property] != '':
                  property_value = self.curr_attributes[tag_property]
                  #print property_value
                  if tag_property == cons.TAG_WEIGHT:
                      # font-weight:bolder
                      #tag_property = "font-weight"
                      #property_value = "bolder"
                      bold_active = True
                      continue
                  elif tag_property == cons.TAG_FOREGROUND:
                      # color:#FFFF00
                      tag_property = "color"
                      color_no_white = rgb_to_no_white(property_value[1:])
                      property_value = "#" + rgb_any_to_24(color_no_white)
                  elif tag_property == cons.TAG_BACKGROUND:
                      # background-color:#FFFF00
                      tag_property = "background-color"
                      property_value = "#" + rgb_any_to_24(property_value[1:])
                  elif tag_property == cons.TAG_STYLE:
                      # font-style:italic
                      #tag_property = "font-style"
                      #property_value = cons.TAG_PROP_ITALIC
                      italic_active = True
                      continue
                  elif tag_property == cons.TAG_UNDERLINE:
                      # text-decoration:underline
                      tag_property = "text-decoration"
                      property_value = cons.TAG_UNDERLINE
                  elif tag_property == cons.TAG_STRIKETHROUGH:
                      # text-decoration:line-through
                      tag_property = "text-decoration"
                      property_value = "line-through"
                  elif tag_property == cons.TAG_SCALE:
                      if property_value == cons.TAG_PROP_SUP:
                          superscript_active = True
                          continue
                      elif property_value == cons.TAG_PROP_SUB:
                          subscript_active = True
                          continue
                      else:
                          # font-size:xx-large/x-large/x-small
                          tag_property = "font-size"
                          if property_value == cons.TAG_PROP_SMALL: property_value = "x-small"
                          elif property_value == cons.TAG_PROP_H1: property_value = "xx-large"
                          elif property_value == cons.TAG_PROP_H2: property_value = "x-large"
                          elif property_value == cons.TAG_PROP_H3: property_value = "large"
                  elif tag_property == cons.TAG_FAMILY:
                      monospace_active = True
                      continue
                  elif tag_property == cons.TAG_JUSTIFICATION:
                      # text-align:center/left/right
                      #tag_property = "text-align"
                      continue
                  elif tag_property == cons.TAG_LINK:
                      # <a href="http://www.example.com/">link-text goes here</a>
                      href = self.get_href_from_link_prop_val(property_value)
                      if not href:
                          continue
                      self.curr_html_text += '<a href="' + href + '">' + inner_text + "</a>"
                      return
                  html_attrs += "%s:%s;" % (tag_property, property_value)
          if html_attrs == "" or inner_text == "<br />":
              tagged_text = inner_text
          else:
              if 'xx-large' in html_attrs:
                  tagged_text = '<h1>' + inner_text + "</h1>"
              elif 'x-large' in html_attrs:
                  tagged_text = '<h2>' + inner_text + "</h2>"
              elif 'large' in html_attrs:
                  tagged_text = '<h3>' + inner_text + '</h3>'
              elif 'x-small' in html_attrs:
                  tagged_text = '<small>' + inner_text + "</small>"
              else:
                  tagged_text = '<span style="' + html_attrs + '">' + inner_text + "</span>"
          if superscript_active: tagged_text = "<sup>" + tagged_text + "</sup>"
          if subscript_active: tagged_text = "<sub>" + tagged_text + "</sub>"
          if monospace_active: tagged_text = "<code>" + tagged_text + "</code>"
          if bold_active: tagged_text = "<strong>" + tagged_text + "</strong>"
          if italic_active: tagged_text = "<em>" + tagged_text + "</em>"
          self.curr_html_text += tagged_text
function_tokens: def html_text_serialize ( self , start_iter , end_iter ) : inner_text = cgi . escape ( start_iter . get_text ( end_iter ) ) if inner_text == "" : return inner_text = inner_text . replace ( cons . CHAR_NEWLINE , "<br />" ) html_attrs = "" superscript_active = False subscript_active = False monospace_active = False bold_active = False italic_active = False for tag_property in cons . TAG_PROPERTIES : if self . curr_attributes [ tag_property ] != '' : property_value = self . curr_attributes [ tag_property ] #print property_value if tag_property == cons . TAG_WEIGHT : # font-weight:bolder #tag_property = "font-weight" #property_value = "bolder" bold_active = True continue elif tag_property == cons . TAG_FOREGROUND : # color:#FFFF00 tag_property = "color" color_no_white = rgb_to_no_white ( property_value [ 1 : ] ) property_value = "#" + rgb_any_to_24 ( color_no_white ) elif tag_property == cons . TAG_BACKGROUND : # background-color:#FFFF00 tag_property = "background-color" property_value = "#" + rgb_any_to_24 ( property_value [ 1 : ] ) elif tag_property == cons . TAG_STYLE : # font-style:italic #tag_property = "font-style" #property_value = cons.TAG_PROP_ITALIC italic_active = True continue elif tag_property == cons . TAG_UNDERLINE : # text-decoration:underline tag_property = "text-decoration" property_value = cons . TAG_UNDERLINE elif tag_property == cons . TAG_STRIKETHROUGH : # text-decoration:line-through tag_property = "text-decoration" property_value = "line-through" elif tag_property == cons . TAG_SCALE : if property_value == cons . TAG_PROP_SUP : superscript_active = True continue elif property_value == cons . TAG_PROP_SUB : subscript_active = True continue else : # font-size:xx-large/x-large/x-small tag_property = "font-size" if property_value == cons . TAG_PROP_SMALL : property_value = "x-small" elif property_value == cons . TAG_PROP_H1 : property_value = "xx-large" elif property_value == cons . TAG_PROP_H2 : property_value = "x-large" elif property_value == cons . TAG_PROP_H3 : property_value = "large" elif tag_property == cons . TAG_FAMILY : monospace_active = True continue elif tag_property == cons . TAG_JUSTIFICATION : # text-align:center/left/right #tag_property = "text-align" continue elif tag_property == cons . TAG_LINK : # <a href="http://www.example.com/">link-text goes here</a> href = self . get_href_from_link_prop_val ( property_value ) if not href : continue self . curr_html_text += '<a href="' + href + '">' + inner_text + "</a>" return html_attrs += "%s:%s;" % ( tag_property , property_value ) if html_attrs == "" or inner_text == "<br />" : tagged_text = inner_text else : if 'xx-large' in html_attrs : tagged_text = '<h1>' + inner_text + "</h1>" elif 'x-large' in html_attrs : tagged_text = '<h2>' + inner_text + "</h2>" elif 'large' in html_attrs : tagged_text = '<h3>' + inner_text + '</h3>' elif 'x-small' in html_attrs : tagged_text = '<small>' + inner_text + "</small>" else : tagged_text = '<span style="' + html_attrs + '">' + inner_text + "</span>" if superscript_active : tagged_text = "<sup>" + tagged_text + "</sup>" if subscript_active : tagged_text = "<sub>" + tagged_text + "</sub>" if monospace_active : tagged_text = "<code>" + tagged_text + "</code>" if bold_active : tagged_text = "<strong>" + tagged_text + "</strong>" if italic_active : tagged_text = "<em>" + tagged_text + "</em>" self . curr_html_text += tagged_text