Add 'orphan' to metadata for partials

    :type app: sphinx.application.Sphinx
    :type doctree: docutils.nodes.document
495549
def doctree_read_handler(app, doctree):
    
    # noinspection PyProtectedMember
    docname = sys._getframe(2).f_locals['docname']
    if docname.startswith('_partial'):
        app.env.metadata[docname]['orphan'] = True
22459
def call_missing_reference(cls, kb_app, sphinx_app: Sphinx,
                               sphinx_env: BuildEnvironment,
                               node,
                               contnode,
                               ):
        

        for callback in EventAction.get_callbacks(kb_app,
                                                  SphinxEvent.MR):
            return callback(kb_app, sphinx_app, sphinx_env, node, contnode)
598379
def setTreeDoc(self, doc):
        
        if doc is None: doc__o = None
        else: doc__o = doc._o
        libxml2mod.xmlSetTreeDoc(self._o, doc__o)
100192
private void linkInPlace(Node<K, V> orphan, Node<K, V> n) {
        // link orphan at node's position
        orphan.y_s = n.y_s;
        if (n.y_s != null) {
            n.y_s.o_s = orphan;
        }
        orphan.o_s = n.o_s;
        if (n.o_s != null) {
            if (n.o_s.o_c == n) { // node is the oldest :(
                n.o_s.o_c = orphan;
            } else { // node has an older sibling!
                n.o_s.y_s = orphan;
            }
        }
        n.o_s = null;
        n.y_s = null;
    }
1346983
def docCopyNode(self, doc, extended):
        
        if doc is None: doc__o = None
        else: doc__o = doc._o
        ret = libxml2mod.xmlDocCopyNode(self._o, doc__o, extended)
        if ret is None:raise treeError('xmlDocCopyNode() failed')
        __tmp = xmlNode(_obj=ret)
        return __tmp
1092441
def _add_model_fields_as_params(app, obj, lines):
    
    for field in obj._meta.get_fields():
        try:
            help_text = strip_tags(force_text(field.help_text))
            verbose_name = force_text(field.verbose_name).capitalize()
        except AttributeError:
            # e.g. ManyToOneRel
            continue

        # Add parameter
        if help_text:
            lines.append(u':param %s: %s' % (field.name, help_text))
        else:
            lines.append(u':param %s: %s' % (field.name, verbose_name))

        # Add type
        lines.append(_get_field_type(field))

    if 'sphinx.ext.inheritance_diagram' in app.extensions and \
            'sphinx.ext.graphviz' in app.extensions and \
            not any('inheritance-diagram::' in line for line in lines):
        lines.append('.. inheritance-diagram::')
123679
def add_doc_names_as_metadata(self, doc_names):
        '''
        
        '''
        if len(doc_names) != self.get_num_docs():
            raise Exception("The parameter doc_names contains %s elements. "
                            "It should have %s elements, one per document." % (len(doc_names), self.get_num_docs()))

        doc_names_counter = collections.Counter(np.array(doc_names))
        metafact = CSRMatrixFactory()
        metaidxstore = IndexStore()
        doc_id_uses = collections.Counter()
        for i in range(self.get_num_docs()):
            doc_id = doc_names[i]
            if doc_names_counter[doc_id] > 1:
                doc_id_uses[doc_id] += 1
                doc_name_idx = metaidxstore.getidx('%s (%s)' % (doc_id, doc_id_uses[doc_id]))
            else:
                doc_name_idx = metaidxstore.getidx(doc_id)
            metafact[i, i] = doc_name_idx
        return self.add_metadata(metafact.get_csr_matrix(), metaidxstore)
289765
def generate_doc_dict(module, user):
    
    from pale import extract_endpoints, extract_resources, is_pale_module
    if not is_pale_module(module):
        raise ValueError(
                """The passed in `module` (%s) is not a pale module. `paledoc`
                only works on modules with a `_module_type` set to equal
                `pale.ImplementationModule`.""")

    module_endpoints = extract_endpoints(module)
    ep_doc = { ep._route_name: document_endpoint(ep) for ep \
            in module_endpoints }

    ep_doc_filtered = {}

    for endpoint in ep_doc:
        # check if user has permission to view this endpoint
        # this is currently an on/off switch: if any endpoint has a "@requires_permission"
        # decorator, user.is_admin must be True for the user to see documentation
        # @TODO - make this permission more granular if necessary

        if ep_doc[endpoint].get("requires_permission") != None and user != None and user.is_admin or \
            ep_doc[endpoint].get("requires_permission") == None:
            ep_doc_filtered[endpoint] = ep_doc[endpoint]

    module_resources = extract_resources(module)
    res_doc = { r._value_type: document_resource(r) for r \
            in module_resources }

    return {'endpoints': ep_doc_filtered,
            'resources': res_doc}
1211507
private void addNthChild(final boolean byType) {
		for (Node node : nodes) {
			Index index = helper.getIndexInParent(node, byType);

			if (specifier.isMatch(index.index+1))
				result.add(node);
		}
	}
289703
private void addLastOfType() {
		for (Node node : nodes) {
			Index index = helper.getIndexInParent(node, true);
			if (index.index == (index.size-1))
				result.add(node);
		}
	}
489409
def document_changes(document)
      (document.changed + document._children.select{|child| child.changed? }.map { |child|
        "#{child.metadata_name.to_s}{#{child.changed.join(", ")}}"
      }).join(", ")
    end
285044
def md_el(node_type, children=[], meta={}, al=nil)
		if  (e=children.first).kind_of?(MDElement) and 
			e.node_type == :ial then
			if al
				al += e.ial
			else
				al = e.ial
			end
			children.shift
		end 
		e = MDElement.new(node_type, children, meta, al)
		e.doc = @doc
		return e
	end
679491
def _add_type_node(self, node, label):
        """"""
        child = node.add_child(name=label)
        child.add_feature(TYPE_NODE_TAG, True)
        return child
1055593
function setPartial(fs, path, nodeCount, callback) {
  fs.setxattr(path, constants.attributes.partial, nodeCount, callback);
}
1167753
def setup(app):
    """"""
    import sphinx
    from .parser import CommonMarkParser

    if sphinx.version_info >= (1, 8):
        app.add_source_suffix('.md', 'markdown')
        app.add_source_parser(CommonMarkParser)
    elif sphinx.version_info >= (1, 4):
        app.add_source_parser('.md', CommonMarkParser)

    return {'version': __version__, 'parallel_read_safe': True}
165118
function add_shared(hash, customTags, doc_map) {
    hash = utils.merge(hash, {
      "inheritable" : !!doc_map["inheritable"],
      "inheritdoc" : extract(doc_map, "inheritdoc"),
      "related" : extract(doc_map, "related"),
      "see" : extract(doc_map, "see"),
      "private" : extract(doc_map, "private") !== null ? true : false,
      "experimental" : extract(doc_map, "experimental") !== null ? true : false,
      "ignore" : extract(doc_map, "ignore") !== null ? true : false,
      "author" : extract_plural(doc_map["author"] || []),
      "version" : extract(doc_map, "version"),
      "since" : extract(doc_map, "since"),
      "todo" : extract(doc_map, "todo")
    });

    if (customTags !== undefined) {
      var custom = {};
      _.each(customTags, function(tag) {
        var text = extract(doc_map, tag);
        if (text !== null) {
          custom[tag] = text.doc.length > 0 ? text.doc : true;
        }
      });

      hash = utils.merge(hash, custom);
    }

    return hash;
}
241215
def create_doc(text, type = nil)
      @documents.include?(type) ? doc_of_type(text, type) : unknown_type(text)
    end