read the designated TOC file (toc.html)
2386
function(next) {
            fs.readFile(path.join(config.root_out, config.akashacmsEPUB.bookmetadata.toc.href), 'utf8',
                function(err, data) {
                    if (err) next(err);
                    else {
                        // logger.info('read '+ path.join(config.root_out, config.akashacmsEPUB.bookmetadata.toc.href));
                        tocHtml = data;
                        next();
                    }
                });
        }
1085867
def save_toc(self, tocpos):
        """"""
        self.tocpos = tocpos
        tocstr = self.toc.tobinary()
        self.toclen = len(tocstr)
        self.lib.write(tocstr)
749997
def get_text(html):
    """"""

    # Ignore warnings made by BeautifulSoup, if passed something that looks like
    # a file (e.g. a dot which matches current dict), it will warn that the file
    # should be opened instead of passing a filename.
    with warnings.catch_warnings():
        warnings.simplefilter("ignore")
        text = BeautifulSoup(html.replace('&apos;', "'"), "html.parser").get_text()

    return unicodedata.normalize('NFKC', text)
1016130
def get_params_from_page(path, file_name, method_count):
    
    # open the rendered file.
    file_name = file_name.replace(".rst", "")
    file_path = "{0}/../_build/html/endpoints/{1}/index.html".format(
        path, file_name)
    soup = bs4.BeautifulSoup(open(file_path))

    # Pull out the relevant section
    section = soup.find_all('div', class_='section')[method_count]

    # get the tbody of the params table
    tbody = section.find('tbody')
    params = []
    if tbody is not None:
        for row in tbody.find_all('tr'):
            name, param_type, required, description = row.find_all('td')
            required = required.text == 'Yes'
            param = dict(
                name=name.text,
                type=param_type.text,
                required=required,
                description=description.text
            )
            params.append(param)
    params = sorted(params, key=lambda k: not k['required'])
    return params
1306604
function(handlebars, directory, filepath, opts, done) {
		var regex = (typeof opts.match === 'string') ? new RegExp(opts.match) : opts.match || /\.(html|hbs)$/,
			isValidTemplate = regex.test(filepath);

		if (!isValidTemplate) {
			return done(null);
		}

		fs.readFile(filepath, 'utf8', function(err, data) {
			if (!err) {
				var ext = path.extname(filepath);
				var templateName = path.relative(directory, filepath)
				.slice(0, -(ext.length)).replace(/[ -]/g, '_').replace(/\\/g, '/');
				if (typeof opts.name === 'function') templateName = opts.name(templateName);
				handlebars.registerPartial(templateName, data);
				return done(undefined, templateName);
			}

			done(err);
		});
	}
603244
def htmlParseFile(filename, encoding):
    
    ret = libxml2mod.htmlParseFile(filename, encoding)
    if ret is None:raise parserError('htmlParseFile() failed')
    return xmlDoc(_obj=ret)
727580
def read(afile):
    """"""
    the_relative_file = os.path.join(HERE, afile)
    with codecs.open(the_relative_file, 'r', 'utf-8') as opened_file:
        content = filter_out_test_code(opened_file)
        content = "".join(list(content))
        return content
153605
def htmlCtxtReadFile(self, filename, encoding, options):
        
        ret = libxml2mod.htmlCtxtReadFile(self._o, filename, encoding, options)
        if ret is None:raise treeError('htmlCtxtReadFile() failed')
        __tmp = xmlDoc(_obj=ret)
        return __tmp
159706
def htmlReadFile(filename, encoding, options):
    
    ret = libxml2mod.htmlReadFile(filename, encoding, options)
    if ret is None:raise treeError('htmlReadFile() failed')
    return xmlDoc(_obj=ret)
1070561
def read(self):
        
        todos = []
        try:
            todofile = codecs.open(self.path, 'r', encoding="utf-8")
            todos = todofile.readlines()
            todofile.close()
        except IOError:
            pass

        return todos
590031
def htmlReadDoc(cur, URL, encoding, options):
    
    ret = libxml2mod.htmlReadDoc(cur, URL, encoding, options)
    if ret is None:raise treeError('htmlReadDoc() failed')
    return xmlDoc(_obj=ret)
1312741
def fromMarkdown(md, *args, **kwargs):
        
        return TOC.fromHTML(markdown(md, *args, **kwargs))
1192142
def htmlCtxtReadDoc(self, cur, URL, encoding, options):
        
        ret = libxml2mod.htmlCtxtReadDoc(self._o, cur, URL, encoding, options)
        if ret is None:raise treeError('htmlCtxtReadDoc() failed')
        __tmp = xmlDoc(_obj=ret)
        return __tmp
101844
def read(self):
        """"""
        self.convertRSTmetaToMD()
        self._md = Markdown(extensions=['meta', 'codehilite(linenums=True)'])
        content = self._md.convert(self.source)
        metadata = self._parse_metadata(self._md.Meta)
        return content, metadata
1278186
def read(self, file_or_path):
        """"""
        if file_or_path in self._cached_templates:
            return self._cached_templates[file_or_path]

        if is_filelike(file_or_path):
            template = file_or_path.read()
            dirname = None
        else:
            with open(file_or_path, 'r') as f:
                template = f.read()
            dirname = os.path.dirname(file_or_path)

        template = self._engine(template,
                                dirname=dirname,
                                tolerant=self._tolerant)

        self._cached_templates[file_or_path] = template
        return template
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='')
15333
def read_directive(allowed)
      tk = get_tk
      puts "directive: #{tk.inspect}" if $DEBUG
      result = nil
      if tk.kind_of?(TkCOMMENT) 
        if tk.text =~ /\s*:?(\w+):\s*(.*)/
          directive = $1.downcase
          if allowed.include?(directive)
            result = [directive, $2]
          end
        end
      else
        unget_tk(tk)
      end
      result
    end