Exemple #1
0
def format_index_name(name):
    while True:
        m = _attr_re.match(name)
        if m:
            name, left, loc, right = m.group("name", "left", "loc", "right")
            type = "attribute"
            break
        m = _meth_re.match(name)
        if m:
            name, left, loc, right = m.group("name", "left", "loc", "right")
            type = "method"
            break
        m = _fc_re.match(name)
        if m:
            name, left, loc, right = m.group("name", "left", "loc", "right")
            if left.startswith("class"):
                type = "class"
            else:
                type = "function"
            break
        m = _mod_re.match(name)
        if m:
            name = m.group("name")
            left = "module"
            loc = right = ''
            type = "module"
            break
        return name
    if loc:
        loc = literal('<span class="location">') + escape(loc) + literal(
            "</span>")
    cat = left + loc + right
    return escape(name) + literal('<span class="category ' + type +
                                  '">') + escape(cat) + literal("</span>")
Exemple #2
0
def format_index_name(name):
    while True:
        m = _attr_re.match(name)
        if m:
            name, left, loc, right = m.group("name","left", "loc", "right")
            type = "attribute"
            break
        m = _meth_re.match(name)
        if m:
            name, left, loc, right = m.group("name","left", "loc", "right")
            type = "method"
            break
        m = _fc_re.match(name)
        if m:
            name, left, loc, right = m.group("name","left", "loc", "right")
            if left.startswith("class"):
                type = "class"
            else:
                type = "function"
            break
        m = _mod_re.match(name)
        if m:
            name = m.group("name")
            left = "module"
            loc = right = ''
            type = "module"
            break
        return name
    if loc:
        loc = literal('<span class="location">') + escape(loc) + literal("</span>")
    cat = left + loc + right
    return escape(name) + literal('<span class="category ' + type + '">') + escape(cat) + literal("</span>")
def format_index_name(name):
    """ format_index_name

   :param name:
   :return:
   """
    loc = ''
    type_ = ''
    left = ''
    right = ''
    while True:
        m = _attr_re.match(name)
        if m:
            name, left, loc, right = m.group('name', 'left', 'loc', 'right')
            type_ = 'attribute'
            break
        m = _meth_re.match(name)
        if m:
            name, left, loc, right = m.group('name', 'left', 'loc', 'right')
            type_ = 'method'
            break
        m = _fc_re.match(name)
        if m:
            name, left, loc, right = m.group('name', 'left', 'loc', 'right')
            if left.startswith('class'):
                type_ = 'class'
            else:
                type_ = 'function'
            break
        m = _mod_re.match(name)
        if m:
            name = m.group('name')
            left = 'module'
            loc = right = ''
            type_ = 'module'
            break
        return name
    if loc:
        loc = literal('<span class="location">') + escape(loc) + literal(
            '</span>')
    cat = left + loc + right
    return escape(name) + literal('<span class="category ' + type_ +
                                  '">') + escape(cat) + literal('</span>')
def format_index_name(name):
   """ format_index_name

   :param name:
   :return:
   """
   loc = ''
   type_ = ''
   left = ''
   right = ''
   while True:
      m = _attr_re.match(name)
      if m:
         name, left, loc, right = m.group('name', 'left', 'loc', 'right')
         type_ = 'attribute'
         break
      m = _meth_re.match(name)
      if m:
         name, left, loc, right = m.group('name', 'left', 'loc', 'right')
         type_ = 'method'
         break
      m = _fc_re.match(name)
      if m:
         name, left, loc, right = m.group('name', 'left', 'loc', 'right')
         if left.startswith('class'):
            type_ = 'class'
         else:
            type_ = 'function'
         break
      m = _mod_re.match(name)
      if m:
         name = m.group('name')
         left = 'module'
         loc = right = ''
         type_ = 'module'
         break
      return name
   if loc:
      loc = literal('<span class="location">') + escape(loc) + literal('</span>')
   cat = left + loc + right
   return escape(name) + literal('<span class="category ' + type_ + '">') + escape(cat) + literal('</span>')