toc : HEADERSEC opttexts TOC opttexts
325846
def p_toc(self, toc):
        ''''''
        toc[0] = TableOfContent(toc[1], toc[2], [])
        self.toc = toc[0]
563543
def create_modules_toc_file(master_package, modules, opts, name='modules'):
    
    text = format_heading(1, '%s Modules' % opts.header)
    text += '.. toctree::\n'
    text += '   :maxdepth: %s\n\n' % opts.maxdepth

    modules.sort()
    prev_module = ''
    for module in modules:
        # look if the module is a subpackage and, if yes, ignore it
        if module.startswith(prev_module + '.'):
            continue
        prev_module = module
        text += '   %s\n' % module

    write_file(name, text, opts)
670479
def parse_content_type(header):
    """"""
    typ = subtyp = None; options = {}
    typ, pos = expect_re(re_token, header, 0)
    _, pos = expect_lit('/', header, pos)
    subtyp, pos = expect_re(re_token, header, pos)
    ctype = header[:pos] if subtyp else ''
    while pos < len(header):
        _, pos = accept_ws(header, pos)
        _, pos = expect_lit(';', header, pos)
        _, pos = accept_ws(header, pos)
        name, pos = expect_re(re_token, header, pos)
        _, pos = expect_lit('=', header, pos)
        char = lookahead(header, pos)
        if char == '"':
            value, pos = expect_re(re_qstring, header, pos)
            value = re_qpair.sub('\\1', value)
        elif char:
            value, pos = expect_re(re_token, header, pos)
        if name and value is not None:
            options[name] = value
    return ctype, options
458801
async function tableOfContentsTransform(
  content: string,
  options: *,
  comment: string
): Promise<string> {
  return toc.insert(content.replace(comment, '<!-- toc -->'));
}
257428
function(oCoords, i) {
      return {
        topline: {
          o: oCoords.tl,
          d: oCoords.tr
        },
        rightline: {
          o: oCoords.tr,
          d: oCoords.br
        },
        bottomline: {
          o: oCoords.br,
          d: oCoords.bl
        },
        leftline: {
          o: oCoords.bl,
          d: oCoords.tl
        }
      }
    }
424112
def complete_opt_format(self, text, *_):
        
        return [t + " " for t in FORMATTERS if t.startswith(text)]
313951
def write_toc(self, args):
        """"""
        # FIXME: Can this logic be moved into the create_parser function?
        ordered = False
        if args.ordered_list_marker is not None:
            list_marker = args.ordered_list_marker
            ordered = True
        elif args.unordered_list_marker is not None:
            list_marker = args.unordered_list_marker
        else:
            list_marker = md_parser[
                args.parser]['list']['unordered']['default_marker']

        toc_struct = build_multiple_tocs(
            filenames=args.filename,
            ordered=ordered,
            no_links=args.no_links,
            no_indentation=args.no_indentation,
            no_list_coherence=args.no_list_coherence,
            keep_header_levels=int(args.header_levels),
            parser=args.parser,
            list_marker=list_marker)
        if args.in_place:
            write_strings_on_files_between_markers(
                filenames=args.filename,
                strings=toc_struct,
                marker=args.toc_marker)
        else:
            for toc in toc_struct:
                print(toc, end='')
402894
def parse_headers(cls, msg):
        
        return list(email.parser.Parser().parsestr(msg).items())
978930
function parseHeaders(headers) {
  var parsed = createMap(), i;

  function fillInParsed(key, val) {
    if (key) {
      parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
    }
  }

  if (isString(headers)) {
    forEach(headers.split('\n'), function(line) {
      i = line.indexOf(':');
      fillInParsed(lowercase(trim(line.substr(0, i))), trim(line.substr(i + 1)));
    });
  } else if (isObject(headers)) {
    forEach(headers, function(headerVal, headerKey) {
      fillInParsed(lowercase(headerKey), trim(headerVal));
    });
  }

  return parsed;
}
571031
function (obj, opts) {
  var toc = [];

  // Finesse comment markdown data.
  // Also, statefully create TOC.
  var sections = _.chain(obj)
    .map(function (data) { return new Section(data, opts); })
    .filter(function (s) { return s.isPublic(); })
    .map(function (s) {
      toc.push(s.renderToc());  // Add to TOC.
      return s.renderSection(); // Render section.
    })
    .value()
    .join("\n");

  // No Output if not sections.
  if (!sections) {
    return "";
  }

  return "\n" + toc.join("") + "\n" + sections;
}
1308174
def toc_html(self):
        
        if self._toc is None:
            return None

        def indent():
            return '  ' * (len(h_stack) - 1)
        lines = []
        h_stack = [0]   # stack of header-level numbers
        for level, id, name in self._toc:
            if level > h_stack[-1]:
                lines.append("%s<ul>" % indent())
                h_stack.append(level)
            elif level == h_stack[-1]:
                lines[-1] += "</li>"
            else:
                while level < h_stack[-1]:
                    h_stack.pop()
                    if not lines[-1].endswith("</li>"):
                        lines[-1] += "</li>"
                    lines.append("%s</ul></li>" % indent())
            lines.append('%s<li><a href="#%s">%s</a>' % (
                indent(), id, name))
        while len(h_stack) > 1:
            h_stack.pop()
            if not lines[-1].endswith("</li>"):
                lines[-1] += "</li>"
            lines.append("%s</ul>" % indent())
        return '\n'.join(lines) + '\n'
1038000
def p_regularsec(self, regularsec):
        ''''''
        texts = []
        sections = regularsec[2]
        if len(regularsec) > 3:
            texts = regularsec[2]
            sections = regularsec[3]
        regularsec[0] = Section(regularsec[1], texts, sections)
465508
def headers(self):
        
        d = {}
        for k, v in self.message.items():
            d[k] = decode_header_part(v)
        return d
713096
def toc(self):
        
        output = []
        for key in sorted(self.catalog.keys()):
            edition = self.catalog[key]['edition']
            length = len(self.catalog[key]['transliteration'])
            output.append(
                "Pnum: {key}, Edition: {edition}, length: {length} line(s)".format(
                    key=key, edition=edition, length=length))
        return output
1277584
def parse_headers(buff):
    
    preamble_lines = list(map(
        lambda x: six.u(x).decode(),
        iter(lambda: buff.readline().strip(), b''))
    )
    if not preamble_lines:
        raise EmptyBuffer()
    return preamble_lines[0], OrderedDict([l.split(':') for l in preamble_lines[1:]])
364132
def parse_headers(header_list):
    
    header_string = b""
    for key, values in header_list.items():
        for v in values:
            header_string += \
                key.encode('utf-8') + b":" + v.encode('utf-8') + b"\r\n"
    return compat.get_httpmessage(header_string)
456423
def GetModuleText(heading, name, showprivate=False):
        """"""
        und = '='*len(heading)
        if showprivate:
            opts = ':private-members:'
        else:
            opts = ''
        return r'''

%s
%s

.. automodule:: %s
    %s

''' % (heading, und, name, opts)