Add an external documentation
5275
protected function addDocumentation()
    {
        $docDirectory = $this->getDocumentationDirectory();

        // If there's a documentation directory
        if (is_dir($docDirectory)) {
            $validIndexDocuments = [
                'index.md',
                'readme.md',
                strtolower($this->basename.'.md')
            ];
            $indexDocument       = null;
            $documents           = [];

            // Run through all documentation files
            foreach (scandir($docDirectory) as $document) {
                if (!is_file($docDirectory.DIRECTORY_SEPARATOR.$document)) {
                    continue;
                }

                // If there's a valid documentation index file
                if (in_array(strtolower($document), $validIndexDocuments)) {
                    if ($indexDocument === null) {
                        $indexDocument = $docDirectory.DIRECTORY_SEPARATOR.$document;
                    }
                    continue;
                }

                $documents[] = $docDirectory.DIRECTORY_SEPARATOR.$document;
            }

            // If there's an index document
            if ($indexDocument !== null) {
                $this->addNotice(file_get_contents($indexDocument));

                return;
            }

            // If there are remaining documents: Auto-create a simple listing
            if (count($documents)) {
                $listing = [];

                // Run through all documents
                foreach ($documents as $document) {
                    $extension = strtolower(pathinfo($document, PATHINFO_EXTENSION));
                    $listing[] = '* '.(in_array($extension, ['jpg', 'jpeg', 'png', 'gif', 'svg']) ? '!' : '').
                                 '['.pathinfo($document, PATHINFO_FILENAME).']('.basename($document).')';
                }

                $this->addNotice(implode(PHP_EOL, $listing));
            }
        }
    }
165740
function buildDocs() {
  return Promise.resolve()
    .then(() => new Promise((resolve, reject) => {
      Metalsmith(__dirname)
        .source('./source/docs')
        .destination('./docs')
        .clean(true)
        .use(Markdown())
        .metadata({
          version: __version
        })
        .use(Layouts({
          engine: 'handlebars',
          directory: './source/layouts',
          rename: false
        }))
        // Update {{version}} in content since it's not processed with Handlebars
        .use((files, metalsmith, done) => {
          Object.keys(files).forEach((key) => {
            let file = files[key];

            file.contents = new Buffer(
              file.contents
                .toString()
                .replace(/\{\{version\}\}/g, __version)
            );
          });

          done();
        })
        .build((err) => {
          if(err) {
            reject(err);
            return;
          }
          console.log(Chalk.green('Docs generated! 📚'));

          resolve();
        });
    }));
}
427370
def add_directives(kb_app: kb,
                   sphinx_app: Sphinx,
                   sphinx_env: BuildEnvironment,
                   docnames=List[str],
                   ):
    

    for k, v in list(kb_app.config.resources.items()):
        sphinx_app.add_directive(k, ResourceDirective)
945045
def add_external_reference(self,term_id, external_ref):
        
        if term_id in self.idx:
            term_obj = Cterm(self.idx[term_id],self.type)
            term_obj.add_external_reference(external_ref)
        else:
            print('{term_id} not in self.idx'.format(**locals()))
1046742
def documentation(self, add_to=None, version=None, prefix="", base_url="", url=""):
        """"""
        doc = OrderedDict() if add_to is None else add_to

        usage = self.interface.spec.__doc__
        if usage:
            doc['usage'] = usage

        for example in self.examples:
            example_text = "{0}{1}{2}{3}".format(prefix, base_url, '/v{0}'.format(version) if version else '', url)
            if isinstance(example, str):
                example_text += "?{0}".format(example)
            doc_examples = doc.setdefault('examples', [])
            if not example_text in doc_examples:
                doc_examples.append(example_text)

        doc = super().documentation(doc)

        if getattr(self, 'output_doc', ''):
            doc['outputs']['type'] = self.output_doc

        return doc
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)
1287102
def add(self, elt):
        
        if isinstance(elt, Brok):
            # For brok, we tag the brok with our instance_id
            elt.instance_id = self.instance_id
            if elt.type == 'monitoring_log':
                # The brok is a monitoring event
                with self.events_lock:
                    self.events.append(elt)
                statsmgr.counter('events', 1)
            else:
                with self.broks_lock:
                    self.broks.append(elt)
            statsmgr.counter('broks.added', 1)
        elif isinstance(elt, ExternalCommand):
            logger.debug("Queuing an external command '%s'", str(elt.__dict__))
            with self.external_commands_lock:
                self.external_commands.append(elt)
                statsmgr.counter('external-commands.added', 1)
        else:  # pragma: no cover, simple dev alerting
            logger.error('Do not manage object type %s (%s)', type(elt), elt)
830326
def add_external_reference_to_entity(self,entity_id,ext_ref):
        
        node_entity = self.map_entity_id_to_node.get(entity_id)
        if node_entity is not None:
            entity = Centity(node_entity,self.type)
            entity.add_external_reference(ext_ref)
        else:
            print>>sys.stderr,'Trying to add a reference to the entity',entity_id,'but can not be found in this file'
805691
def addDocs(self, docs):
        """"""
        lst = ['<add>']
        for fields in docs:
            self.__add(lst, fields)
        lst.append('</add>')
        xstr = ''.join(lst)
        return self.doUpdateXML(xstr)
1317096
def update_docs(self, iface, module):
        """"""        
        #We need to look in the parent module docstrings for this types decorating tags.
        key = "{}.{}".format(module.name, iface.name)
        if key in module.predocs:
            iface.docstring = self.docparser.to_doc(module.predocs[key][0], iface.name)
            iface.docstart, iface.docend = (module.predocs[key][1], module.predocs[key][2])
875396
def write_documentation(self, doc_type):
        
        for handler_name in sorted(self._documentation):
            if "controller." in handler_name:
                server_type = "controller"
            elif "compute" in handler_name:
                server_type = "compute"
            else:
                server_type = "root"

            if doc_type != server_type:
                continue

            print("Build {}".format(handler_name))

            for path in sorted(self._documentation[handler_name]):

                api_version = self._documentation[handler_name][path]["api_version"]
                if api_version is None:
                    continue

                filename = self._file_path(path)
                handler_doc = self._documentation[handler_name][path]
                handler = handler_name.replace(server_type + ".", "")

                self._create_handler_directory(handler, api_version, server_type)
                with open("{}/api/v{}/{}/{}/{}.rst".format(self._directory, api_version, server_type, handler, filename), 'w+') as f:
                    f.write('{}\n------------------------------------------------------------------------------------------------------------------------------------------\n\n'.format(path))
                    f.write('.. contents::\n')
                    for method in handler_doc["methods"]:
                        f.write('\n{} {}\n'.format(method["method"], path.replace("{", '**{').replace("}", "}**")))
                        f.write('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n')
                        f.write('{}\n\n'.format(method["description"]))

                        if len(method["parameters"]) > 0:
                            f.write("Parameters\n**********\n")
                            for parameter in method["parameters"]:
                                desc = method["parameters"][parameter]
                                f.write("- **{}**: {}\n".format(parameter, desc))
                            f.write("\n")

                        f.write("Response status codes\n**********************\n")
                        for code in method["status_codes"]:
                            desc = method["status_codes"][code]
                            f.write("- **{}**: {}\n".format(code, desc))
                        f.write("\n")

                        if "properties" in method["input_schema"]:
                            f.write("Input\n*******\n")
                            self._write_definitions(f, method["input_schema"])
                            self._write_json_schema(f, method["input_schema"])

                        if "properties" in method["output_schema"]:
                            f.write("Output\n*******\n")
                            self._write_json_schema(f, method["output_schema"])

                        self._include_query_example(f, method, path, api_version, server_type)
455481
def import_documentations
      require SwaggerDocsGenerator.file_base
      SwaggerDocsGenerator.file_docs.each { |rb| require rb }
    end
985372
def add_external_reference(self,ext_ref):
        
        #check if the externalreferences sublayer exist for the role, and create it in case
        node_ext_refs = self.node.find('externalReferences')
        ext_refs = None
        if node_ext_refs == None:
            ext_refs = CexternalReferences()
            self.node.append(ext_refs.get_node())
        else:
            ext_refs = CexternalReferences(node_ext_refs)
        
        ext_refs.add_external_reference(ext_ref)
567309
def _build_menu(docs):
    

    paths = []
    current = docs.filename
    while current != docs.root:
        current = current.parent
        paths.append(current)

    for path in reversed(paths):
        docs.add_menu(path.stem.title(), link=path / 'index.html')

    if docs.filename.stem != 'index':
        docs.add_menu(docs.title, link=docs.filename)

    docs.end_menu()
872715
def document(schema_file):
    ''''''
    schema = load_schema_file(open(schema_file, 'r'))
    documentation = generate_documentation(schema)
    sys.stdout.write(documentation)
1220659
def update_metatab(self, doc, resources):
        """"""

        if not 'Documentation' in doc:

            doc.new_section("Documentation")

        ds = doc['Documentation']

        if not 'Name' in ds.args:
            ds.add_arg('Name', prepend=True)

        # This is the main output from the HTML exporter, not a resource.
        ds.new_term('Root.Documentation', 'docs/notebook.html', name="notebook.html", title='Jupyter Notebook (HTML)')

        for name, data in resources.get('outputs', {}).items():

            if name == 'documentation.html':
                ds.new_term('Root.Documentation', 'docs/' + name, name=name, title='Primary Documentation (HTML)')

            elif name == 'html_basic_body.html':
                pass
            elif name.endswith('.html'):
                ds.new_term('Root.Documentation', 'docs/' + name, name=name, title='Documentation (HTML)')
            elif name.endswith('.md'):
                ds.new_term('Root.Documentation', 'docs/' + name, name=name, title='Documentation (Markdown)')
            elif name.endswith('.pdf'):
                ds.new_term('Root.Documentation', 'docs/' + name, name=name, title='Documentation (PDF)')
            elif name.endswith('.png'):
                ds.new_term('Root.Image', 'docs/' + name, name=name, title='Image for HTML Documentation')
            else:
                pass
1360303
def _init_externals():
    """"""
    if __version__ == 'git':
        sys.path.insert(0, osp.join(osp.dirname(__file__), 'ext', 'gitdb'))

    try:
        import gitdb
    except ImportError:
        raise ImportError("'gitdb' could not be found in your PYTHONPATH")