Generate notes documents.

 @return [void]
500485
def document
      session = dnote_session

      output_mapping.each do |file, format|
        #next unless verify_format(format)

        dir = File.dirname(file)
        mkdir_p(dir) unless File.directory?(dir)

        session.output = file
        session.format = format
        session.run

        report "Updated #{file.sub(Dir.pwd+'/','')}"
      end
    end
546005
public function getNotes()
    {
        $notes = [];
        if ($this->entity->getNotes()) {
            foreach ($this->entity->getNotes() as $note) {
                $notes[] = $note;
            }
        }

        return $notes;
    }
470701
def list_notes(self, page=0, since=None):
        
        from highton.models.note import Note
        params = {'n': int(page) * self.NOTES_OFFSET}
        if since:
            params['since'] = since.strftime(self.COLLECTION_DATETIME)

        return fields.ListField(
            name=self.ENDPOINT,
            init_class=Note
        ).decode(
            self.element_from_string(
                self._get_request(
                    endpoint=self.ENDPOINT + '/' + str(self.id) + '/' + Note.ENDPOINT,
                    params=params
                ).text
            )
        )
859097
def generate_type_docs(types):
    
    output = StringIO()

    indent = "  "  # 2

    # loop through the basic types and add them to the RAML formatted output
    for type_name in types:

        if types[type_name].get("type") != None:

            output.write(indent + type_name + ":\n")

            indent += "  "  # 4

            type_safe = types[type_name]["type"].replace(" ", "_")

            # if we are dealing with a list, set type to array and specify type of items
            if types[type_name].get("items") != None:
                items_safe = types[type_name]["items"].replace(" ", "_")
                # if items_safe == "base":
                #     items_safe = "object"
                output.write(indent + "type: " + type_safe + "\n")
                output.write(indent + "items: " + items_safe + "\n")

            # otherwise, use the type per normal
            else:
                output.write(indent + "type: " + type_safe + "\n")

            # add the description
            if types[type_name].get("description") != None:
                output.write(indent + "description: " + types[type_name]["description"] + "\n")

            indent = indent[:-2]    # 2

    type_docs = output.getvalue()
    output.close()
    return type_docs
753382
def get_note_names(self):
        
        res = []
        for n in self.notes:
            if n.name not in res:
                res.append(n.name)
        return res
832689
def append_notes(self, notes, root, scale=0):
        
        for note in notes:
            self.append_note(note, root, scale)
559075
def _pages_to_generate(self):
        ''''''
        # right now it gets all the files. In theory, It should only
        # get what's changed... but the program is not doing that yet.

        all_pages = self.get_page_names()
        # keep only those whose status is published
        ptg = []
        for slug in all_pages:
            p = s2page.Page(self, slug, isslug=True)
            if p.published:
                ptg.append({'slug': p.slug, 'title':p.title, 'date': p.creation_date })

        # sort the ptg array in reverse chronological order of its entries.
        sptg = sorted(ptg, key=lambda x : x['date'],reverse=True)
        res = [ pinfo['slug'] for pinfo in sptg]
        return res
323099
def _generate(self):
        """"""
        doc_count = 0
        for fp in self.all_files:
            for doc in self._get_docs_for_path(fp):
                yield doc
                doc_count += 1
                if doc_count >= self.max_docs:
                    return
48872
def generate_xml
      values = { 
        'charset' => @options.charset,
        'files'   => gen_into(@files),
        'classes' => gen_into(@classes),
        'title'        => CGI.escapeHTML(@options.title),
      }
      
      # this method is defined in the template file
      write_extra_pages if defined? write_extra_pages

      template = TemplatePage.new(RDoc::Page::ONE_PAGE)

      if @options.op_name
        opfile = File.open(@options.op_name, "w")
      else
        opfile = $stdout
      end
      template.write_html_on(opfile, values)
    end
902714
def docs(self, fileids=None) -> Generator[str, str, None]:
        
        if not fileids:
            fileids = self.fileids()
        # Create a generator, loading one document into memory at a time.
        for path, encoding in self.abspaths(fileids, include_encoding=True):
            with codecs.open(path, 'r', encoding=encoding) as reader:
                if self.skip_keywords:
                    tmp_data = []
                    for line in reader:
                        skip = False
                        for keyword in self.skip_keywords:
                            if keyword in line:
                                skip = True
                        if not skip:
                            tmp_data.append(line)
                    yield ''.join(tmp_data)
                else:
                    yield reader.read()
297667
def _generate_ids(self, document, content):
        
        existing_ids = content.xpath('//*/@id')
        elements = [
            'p', 'dl', 'dt', 'dd', 'table', 'div', 'section', 'figure',
            'blockquote', 'q', 'code', 'pre', 'object', 'img', 'audio',
            'video',
            ]
        elements_xpath = '|'.join(['.//{}|.//xhtml:{}'.format(elem, elem)
                                  for elem in elements])

        data_types = [
            'equation', 'list', 'exercise', 'rule', 'example', 'note',
            'footnote-number', 'footnote-ref', 'problem', 'solution', 'media',
            'proof', 'statement', 'commentary'
            ]
        data_types_xpath = '|'.join(['.//*[@data-type="{}"]'.format(data_type)
                                     for data_type in data_types])

        xpath = '|'.join([elements_xpath, data_types_xpath])

        mapping = {}  # old id -> new id

        for node in content.xpath(xpath, namespaces=HTML_DOCUMENT_NAMESPACES):
            old_id = node.attrib.get('id')
            document_id = document.id.replace('_', '')
            if old_id:
                new_id = 'auto_{}_{}'.format(document_id, old_id)
            else:
                random_number = random.randint(0, 100000)
                new_id = 'auto_{}_{}'.format(document_id, random_number)
            while new_id in existing_ids:
                random_number = random.randint(0, 100000)
                new_id = 'auto_{}_{}'.format(document_id, random_number)
            node.attrib['id'] = new_id
            if old_id:
                mapping[old_id] = new_id
            existing_ids.append(new_id)

        for a in content.xpath('//a[@href]|//xhtml:a[@href]',
                               namespaces=HTML_DOCUMENT_NAMESPACES):
            href = a.attrib['href']
            if href.startswith('#') and href[1:] in mapping:
                a.attrib['href'] = '#{}'.format(mapping[href[1:]])
558708
def generate_page(page)
      output_filename = page.output_filename
      @log.success("creating #{output_filename}...")
      @log.debug("Rendering #{output_filename} from #{page.name}")
      file = File.join(@configuration.destination_path, output_filename)
      directory = File.dirname(file)

      unless File.directory?(directory)
        FileUtils.mkdir_p(directory)
      end

      File.write file, page.render

      FileUtils.touch file, mtime: page.mtime
      nil
    end
456099
def get_all_rotated_notes(notes):
    
    notes_list = []
    for x in range(len(notes)):
        notes_list.append(notes[x:] + notes[:x])
    return notes_list
1003231
def create_revision!
      revision_options = self.class.acts_as_revisionable_options
      revision = revision_record_class.new(self, revision_options[:encoding])
      if revision_options[:meta].is_a?(Hash)
        revision_options[:meta].each do |attribute, value|
          set_revision_meta_attribute(revision, attribute, value)
        end
      elsif revision_options[:meta].is_a?(Array)
        revision_options[:meta].each do |attribute|
          set_revision_meta_attribute(revision, attribute, attribute.to_sym)
        end
      elsif revision_options[:meta]
        set_revision_meta_attribute(revision, revision_options[:meta], revision_options[:meta].to_sym)
      end
      revision.save!
      return revision
    end
122486
private function buildRequiredNotes()
    {
        // Build the required notes container
        $requireNotesContainer = $this->getHTMLDocument()->getHTMLFactory()->buildHtmlElement('div', '', '', 'form-simple-required-notes');

        // Create note
        $note = $this->getHTMLDocument()->getHTMLFactory()->buildHtmlElement('p', '', '', 'rqNote');
        $requireNotesContainer->append($note);

        $star = $this->requiredStar();
        $note->append($star);
        $title = $this->getHTMLDocument()->getHTMLFactory()->buildHtmlElement('span', 'All fields marked with asterisk are required.');
        $note->append($title);

        // Append before controls
        $this->append($requireNotesContainer);

        return $this;
    }
668498
def generate_note(sound, options=nil)
      add case options
          when NilClass
            PocketMiku::Note.new default.to_h.merge sound: sound
          when Integer
            PocketMiku::Note.new default.to_h.merge sound: sound, key: options
          when Hash, -> _ {_.respond_to? :to_h}
            PocketMiku::Note.new default.to_h.merge(options).merge sound: sound
          else
            raise ArgumentError, "options must nil, Integer, or Hash. but given `#{options.class}'"
          end
    end
287669
def generate_docs(klass):
    """"""
    import numina.types.datatype

    attrh = ('Attributes\n'
             '----------\n')

    doc = getattr(klass, '__doc__', None)

    if doc is None or doc == '':
        doc = "%s documentation." % klass.__name__

    if len(klass.stored()):
        doc = doc + '\n\n' + attrh

    skeys = sorted(klass.stored().keys())
    for key in skeys:
        y = klass.stored()[key]

        if isinstance(y, Requirement):
            modo = 'requirement'
        elif isinstance(y, Result):
            modo = 'product'
        else:
            modo = ""
        if y.type.isproduct():
            tipo = y.type.__class__.__name__
        elif isinstance(y.type, numina.types.datatype.PlainPythonType):
            tipo = y.type.internal_type.__name__
        else:
            tipo = y.type.__class__.__name__

        if y.optional:
            if y.default_value():
                modo = "%s, optional, default=%s" % (modo, y.default)
            else:
                modo = "%s, optional" % (modo,)

        descript = y.description
        if descript:
            field = "%s : %s, %s\n %s\n" % (key, tipo, modo, descript)
        else:
            field = "%s : %s, %s\n" % (key, tipo, modo)
        doc = doc + field

    klass.__doc__ = doc
    return klass