Callback used as the handler argument to process_docs(). This converts
        Stone doc references to Sphinx-friendly annotations.
8231
def _docf(self, tag, val):
        
        if tag == 'type':
            return ':class:`{}`'.format(val)
        elif tag == 'route':
            if self.args.route_method:
                return ':meth:`%s`' % self.args.route_method.format(
                    ns=self.cur_namespace.name, route=fmt_func(val))
            else:
                return val
        elif tag == 'link':
            anchor, link = val.rsplit(' ', 1)
            return '`{} <{}>`_'.format(anchor, link)
        elif tag == 'val':
            if val == 'null':
                return 'None'
            elif val == 'true' or val == 'false':
                return '``{}``'.format(val.capitalize())
            else:
                return val
        elif tag == 'field':
            return '``{}``'.format(val)
        else:
            raise RuntimeError('Unknown doc ref tag %r' % tag)
1058975
public void processDocument(WikiDoc doc) {

        String rawArticleName = doc.name;        
        String articleName = StringUtils.unescapeHTML(rawArticleName);
        articleName = articleName.trim().toLowerCase();

        // skip articles that are not text-based or are
        // wikipedia-specific
        if (!isArticleLink(articleName)) {
            LOGGER.fine("skipping non-article document: " + articleName);
            return;
        } 
        // Skip processing articles that exist solely to direct the user to a
        // different article
        else if (articleName.indexOf("#REDIRECT") >= 0 ||
                   doc.text.indexOf("#REDIRECT") >= 0) {
            LOGGER.fine("skipping redirect: " + articleName);
            return;
        }
        LOGGER.log(Level.FINE, "Procesing article {0} with {1} characters",
                   new Object[] { articleName, doc.text.length() });
    
        // Gets the raw tokens contained in the article XML
        StringBuilder rawArticleText = doc.text;

        // Remove all the header and footer information from the article
        LOGGER.finer("extracting raw article text");        
        extractArticle(rawArticleText);

        // Remove any tables
        LOGGER.finer("removing tables");
        removeTables(rawArticleText);       

        // Remove the {{ text }} content from the document first as it sometimes
        // contains [[ text ]], which would be needlessly processed prior to
        // removal if this were called later.
        LOGGER.finer("removing {{text}} from article");
        removeDoubleBraceMarkup(rawArticleText);

        // Next remove the [[ link ]] markup
        LOGGER.finer("removing [[wiki-link]] from article");
        removeWikiLinkMarkup(rawArticleText, articleName);

        // Once the wiki-links are removed, go after external links, which are
        // only a single [link].  Occassinally, these will have text.
        LOGGER.finer("removing [external-link] from article");
        removeExternalLinkMarkup(rawArticleText);
                
        // Once all of the wiki markup has been removed, replace all of the
        // encoded HTML with its equivalents
        LOGGER.finer("unescaping HTML");
        StringUtils.unescapeHTML(rawArticleText);

        // Remove auto-generated Wikipedia warnings which appear in HTML comment
        // text
        LOGGER.finer("removing HTML comments");
        removeHtmlComments(rawArticleText);
        
        String article = rawArticleText.toString();

        // Being removing any tokens according to the options
        if (options.contains(CleanerOption.USE_PREPROCESSOR)) {
            LOGGER.finer("applying preprocessor");
            article = new DocumentPreprocessor().process(article);
        }
        if (options.contains(CleanerOption.FILTER_TOKENS)) {
            LOGGER.finer("filtering tokens");
            article = filterTokens(article);
        }
            
        // Count how many tokens remain in the document after all of the
        // processing stages.  If too few remain, do not write the document
        int finalTokenCount = getTokenCount(article);
        if (finalTokenCount < minTokensPerArticle) {
            LOGGER.log(Level.FINE, "Document {0} contained only {1} tokens"
                       + " and was not printed", new Object[] {
                           articleName, finalTokenCount });
            return;
        }

        if (options.contains(CleanerOption.INCLUDE_TITLES)) {
            processedArticleWriter.print(articleName);
            processedArticleWriter.print(" ");
        }
        
        // Write the remaining part of the article
        processedArticleWriter.println(article);
        processedArticleWriter.flush();
    }
732366
def process_documents(docs)
      return if @active_lang == @default_lang
      url = config.fetch('url', false)
      rel_regex = relative_url_regex
      abs_regex = absolute_url_regex(url)
      docs.each do |doc|
        relativize_urls(doc, rel_regex)
        if url
        then relativize_absolute_urls(doc, abs_regex, url)
        end
      end
    end
477416
def resolve_ref(cls, domain, env, fromdocname, builder, typ, target, node,
                    contnode):
        
        # indexes appear to be automatically generated at doc DOMAIN-NAME
        todocname = "bb-%s" % target

        node = nodes.reference('', '', internal=True)
        node['refuri'] = builder.get_relative_uri(fromdocname, todocname)
        node['reftitle'] = cls.localname
        node.append(nodes.emphasis(cls.localname, cls.localname))
        return node
520448
def openAPIDoc(**kwargs):
    
    s = yaml.dump(kwargs, default_flow_style=False)
    def deco(routeHandler):
        # Wrap routeHandler, retaining name and __doc__, then edit __doc__.

        # The only reason we need to do this is so we can be certain
        # that __doc__ will be modifiable. partial() objects have
        # a modifiable __doc__, but native function objects do not.
        ret = functools.wraps(routeHandler)(routeHandler)
        if not ret.__doc__:
            ret.__doc__ = ''
        ret.__doc__ = cleandoc(ret.__doc__) + '\n---\n' + s
        return ret
    return deco
508878
def process_item_nodes(app, doctree, fromdocname):
    
    env = app.builder.env

    all_items = sorted(env.traceability_all_items, key=naturalsortkey)

    # Item matrix:
    # Create table with related items, printing their target references.
    # Only source and target items matching respective regexp shall be included
    for node in doctree.traverse(item_matrix):
        table = nodes.table()
        tgroup = nodes.tgroup()
        left_colspec = nodes.colspec(colwidth=5)
        right_colspec = nodes.colspec(colwidth=5)
        tgroup += [left_colspec, right_colspec]
        tgroup += nodes.thead('', nodes.row(
            '',
            nodes.entry('', nodes.paragraph('', 'Source')),
            nodes.entry('', nodes.paragraph('', 'Target'))))
        tbody = nodes.tbody()
        tgroup += tbody
        table += tgroup

        for source_item in all_items:
            if re.match(node['source'], source_item):
                row = nodes.row()
                left = nodes.entry()
                left += make_item_ref(app, env, fromdocname,
                                      env.traceability_all_items[source_item])
                right = nodes.entry()
                for target_item in all_items:
                    if (re.match(node['target'], target_item) and
                            are_related(
                                env, source_item, target_item, node['type'])):
                        right += make_item_ref(
                            app, env, fromdocname,
                            env.traceability_all_items[target_item])
                row += left
                row += right
                tbody += row

        node.replace_self(table)

    # Item list:
    # Create list with target references. Only items matching list regexp
    # shall be included
    for node in doctree.traverse(item_list):
        content = nodes.bullet_list()
        for item in all_items:
            if re.match(node['filter'], item):
                bullet_list_item = nodes.list_item()
                paragraph = nodes.paragraph()
                paragraph.append(
                    make_item_ref(app, env, fromdocname,
                                  env.traceability_all_items[item]))
                bullet_list_item.append(paragraph)
                content.append(bullet_list_item)

        node.replace_self(content)

    # Resolve item cross references (from ``item`` role)
    for node in doctree.traverse(pending_item_xref):
        # Create a dummy reference to be used if target reference fails
        new_node = make_refnode(app.builder,
                                fromdocname,
                                fromdocname,
                                'ITEM_NOT_FOUND',
                                node[0].deepcopy(),
                                node['reftarget'] + '??')
        # If target exists, try to create the reference
        if node['reftarget'] in env.traceability_all_items:
            item_info = env.traceability_all_items[node['reftarget']]
            try:
                new_node = make_refnode(app.builder,
                                        fromdocname,
                                        item_info['docname'],
                                        item_info['target']['refid'],
                                        node[0].deepcopy(),
                                        node['reftarget'])
            except NoUri:
                # ignore if no URI can be determined, e.g. for LaTeX output :(
                pass

        else:
            env.warn_node(
                'Traceability: item %s not found' % node['reftarget'], node)

        node.replace_self(new_node)
669547
def process document
      return unless document.valid
      # If we're debugging, output the canonical_url
      emitter.log(document.url.canonical_url.colorize(:green))
      # Attach the emitter to the document
      document.emitter = emitter
      # enqueue any other pages being linked to
      enqueue(document.links)

      # rewrite all absolute links, asset urls, etc
      # to use local, relative paths
      # document.rewrite

      # Write the document to file
      document.write!

      # Mark this document's canonical_url as processed
      processed_urls << document.url.canonical_url
    end
940634
def pandoc_process(app, what, name, obj, options, lines):
    "

    if not lines:
        return None

    input_format = app.config.mkdsupport_use_parser
    output_format = 'rst'

    # Since default encoding for sphinx.ext.autodoc is unicode and pypandoc.convert_text, which will always return a
    # unicode string, expects unicode or utf-8 encodes string, there is on need for dealing with coding
    text = SEP.join(lines)
    text = pypandoc.convert_text(text, output_format, format=input_format)

    # The 'lines' in Sphinx is a list of strings and the value should be changed
    del lines[:]
    lines.extend(text.split(SEP))
982223
function (args, callback) {
        if (ternserver) {
          ternserver.request({
              query: {
                type: "documentation",  //$NON-NLS-1$
                file: args.meta.location,
                end: args.params.offset,
                docFormat: args.params.docFormat
              },
              files: args.files
            },
            function (error, doc) {
              if (error) {
                callback({request: 'documentation', error: error.message, message: Messages['failedToComputeDoc']}); //$NON-NLS-1$
              } else if (doc && doc.doc) {
                callback({request: 'documentation', doc: doc}); //$NON-NLS-1$
              } else {
                callback({request: 'documentation', doc: null}); //$NON-NLS-1$
              }
            });
        } else {
          callback({request: 'documentation', message: Messages['failedToComputeDocNoServer']}); //$NON-NLS-1$
        }
      }
215784
def get_doc(node):
    
    res = " ".join(get_doc_annotations(node))
    if not res:
        res = "(%s)" % node.__class__.__name__.lower()
    return res
1079370
def process(self, content):
        
        log.debug('processing:\n%s', content)
        self.reset()
        if content.tag is None:
            content.tag = content.value.__class__.__name__
        document = Document()
        self.append(document, content)
        return document.root()
692994
def docs(node, manifest, config, column_name=None):
    
    current_project = config.project_name

    def do_docs(*args):
        if len(args) == 1:
            doc_package_name = None
            doc_name = args[0]
        elif len(args) == 2:
            doc_package_name, doc_name = args
        else:
            dbt.exceptions.doc_invalid_args(node, args)

        target_doc = ParserUtils.resolve_doc(
            manifest, doc_name, doc_package_name, current_project,
            node.package_name
        )

        if target_doc is None:
            dbt.exceptions.doc_target_not_found(node, doc_name,
                                                doc_package_name)

        return target_doc.block_contents

    return do_docs
115465
def process_paper_helper(model_name, pmid, start_time_local):
    """"""
    try:
        if not aws_available:
            rp, txt_format = process_paper(model_name, pmid)
        else:
            rp, txt_format = process_paper_aws(pmid, start_time_local)
    except:
        logger.exception('uncaught exception while processing %s', pmid)
        return None, None

    return rp, txt_format
1311787
def _do_document(self, node):
        ''''''

        self.documentOrder = _LesserElement
        for child in node.childNodes:
            if child.nodeType == Node.ELEMENT_NODE:
                self.documentOrder = _Element        # At document element
                self._do_element(child)
                self.documentOrder = _GreaterElement # After document element
            elif child.nodeType == Node.PROCESSING_INSTRUCTION_NODE:
                self._do_pi(child)
            elif child.nodeType == Node.COMMENT_NODE:
                self._do_comment(child)
            elif child.nodeType == Node.DOCUMENT_TYPE_NODE:
                pass
            else:
                raise TypeError, str(child)
623970
def process_f2pydoc(f2pydoc):
    
    # ---- split f2py document in its parts
    # 0=Call Signature
    # 1=Parameters
    # 2=Other (optional) Parameters (only if present)
    # 3=Returns
    docparts = re.split('\n--', f2pydoc)

    if len(docparts) == 4:
        doc_has_optionals = True
    elif len(docparts) == 3:
        doc_has_optionals = False
    else:
        print('-- uninterpretable f2py documentation --')
        return f2pydoc

    # ---- replace arguments with _d suffix with empty string in ----
    # ---- function signature (remove them): ----
    docparts[0] = re.sub('[\[(,]\w+_d\d', '', docparts[0])

    # ---- replace _d arguments of the return arrays with their default value:
    if doc_has_optionals:

        returnarray_dims = re.findall('[\[(,](\w+_d\d)', docparts[3])
        for arg in returnarray_dims:
            searchpattern = arg + ' : input.*\n.*Default: (.*)\n'
            match = re.search(searchpattern, docparts[2])
            if match:
                default = match.group(1)
                docparts[3] = re.sub(arg, default, docparts[3])
                docparts[2] = re.sub(searchpattern, '', docparts[2])

    # ---- remove all optional _d# from optional argument list:
    if doc_has_optionals:
        searchpattern = '\w+_d\d : input.*\n.*Default: (.*)\n'
        docparts[2] = re.sub(searchpattern, '', docparts[2])

    # ---- combine doc parts to a single string
    processed_signature = '\n--'.join(docparts)

    return processed_signature
1153791
def setup(sphinx):
    
    create_auto_documentation()

    # add the py3status lexer (for code blocks)
    from sphinx.highlighting import lexers
    lexers['py3status'] = Py3statusLexer()

    # enable screenshot directive for dynamic screenshots
    sphinx.add_directive('screenshot', ScreenshotDirective)
323430
private static void callback(long handle, String docID, long sequence) {
        final C4DocumentObserver obs = REVERSE_LOOKUP_TABLE.get(handle);
        if (obs != null && obs.listener != null) { obs.listener.callback(obs, docID, sequence, obs.context); }
    }