Build docstring element.

    :param text: docstring element text
    :param title: title of section containing element
    :return:
762315
def _build_meta(text: str, title: str) -> DocstringMeta:
    

    meta = _sections[title]
    if meta == "returns" and ":" not in text.split()[0]:
        return DocstringMeta([meta], description=text)

    # Split spec and description
    before, desc = text.split(":", 1)
    if desc:
        desc = desc[1:] if desc[0] == " " else desc
        if "\n" in desc:
            first_line, rest = desc.split("\n", 1)
            desc = first_line + "\n" + inspect.cleandoc(rest)
        desc = desc.strip("\n")

    # Build Meta args
    m = re.match(r"(\S+) \((\S+)\)$", before)
    if meta == "param" and m:
        arg_name, type_name = m.group(1, 2)
        args = [meta, type_name, arg_name]
    else:
        args = [meta, before]

    return DocstringMeta(args, description=desc)
855491
def append(self, text):
        
        cursor = QTextCursor(self._doc)
        cursor.movePosition(QTextCursor.End)
        cursor.insertBlock()
        cursor.insertText(text)
1248221
function(str, lex) {
    if (lex) {
      w2.plugin({
        words: lex
      });
    }
    let doc = buildText(str, w2);
    doc.tagger();
    return doc;
  }
1227159
def version_title_header_element(feature, parent):
    """"""
    _ = feature, parent  # NOQA
    header = version_title_header['string_format']
    return header.capitalize()
1099403
def elements_as_text(self, elems, indent=2):
        
        assert elems
        text = ""
        for elename, eledesc in elems.items():
            if isinstance(eledesc, dict):
                desc_txt = self.elements_as_text(eledesc, indent + 2)
                desc_txt = ''.join(['\n', desc_txt])
            elif isinstance(eledesc, str):
                desc_txt = ''.join([eledesc, '\n'])
            else:
                assert False, "Only string or dictionary"
            ele_txt = "\t{0}{1: <22} {2}".format(' ' * indent, elename,
                                                 desc_txt)
            text = ''.join([text, ele_txt])
        return text
1066847
def extract_intro_and_title(filename, docstring):
    

    # lstrip is just in case docstring has a '\n\n' at the beginning
    paragraphs = docstring.lstrip().split('\n\n')
    # remove comments and other syntax like `.. _link:`
    paragraphs = [p for p in paragraphs
                  if not p.startswith('.. ') and len(p) > 0]
    if len(paragraphs) == 0:
        raise ValueError(
            "Example docstring should have a header for the example title. "
            "Please check the example file:\n {}\n".format(filename))
    # Title is the first paragraph with any ReSTructuredText title chars
    # removed, i.e. lines that consist of (all the same) 7-bit non-ASCII chars.
    # This conditional is not perfect but should hopefully be good enough.
    title_paragraph = paragraphs[0]
    match = re.search(r'([\w ]+)', title_paragraph)

    if match is None:
        raise ValueError(
            'Could not find a title in first paragraph:\n{}'.format(
                title_paragraph))
    title = match.group(1).strip()
    # Use the title if no other paragraphs are provided
    intro_paragraph = title if len(paragraphs) < 2 else paragraphs[1]
    # Concatenate all lines of the first paragraph and truncate at 95 chars
    intro = re.sub('\n', ' ', intro_paragraph)
    if len(intro) > 95:
        intro = intro[:95] + '...'

    return intro, title
1222365
function DocCommentParser(text) {
  this.lines = text.split(END_OF_LINE);
  this.lineNumber = 0;
  this.length = this.lines.length;
  this.line = '';

  this.match = [];
  this.tagDef = {};

  this.mode = this._extractLine;

  this.data = {};
}
422922
def title(self, txt=None):
        '''
        if txt:
            self.SetConsoleTitleW(txt)
        else:
            buffer = create_unicode_buffer(200)
            n = self.GetConsoleTitleW(buffer, 200)
            if n > 0:
                return buffer.value[:n]
1052749
def fmt_title(text):
    
    text = text.strip()
    if len(text) == 0:  # if empty string, return it
        return text
    else:
        text = text.lower()  # lower all char
        # delete redundant empty space
        chunks = [chunk for chunk in text.split(" ") if len(chunk) >= 1]

        new_chunks = list()
        for chunk in chunks:
            if chunk not in _function_words:
                chunk = chunk[0].upper() + chunk[1:]
            new_chunks.append(chunk)

        new_chunks[0] = new_chunks[0][0].upper() + new_chunks[0][1:]

        return " ".join(new_chunks)
580418
def information_title_header_element(feature, parent):
    """"""
    _ = feature, parent  # NOQA
    header = information_title_header['string_format']
    return header.capitalize()
543654
def title
      doc.at("//head/meta[@name='title']")["content"].split(/\(.*\)/)[0].strip! ||
          doc.at("h1.header").children.first.text.strip

    end
1155094
function(text) {

            urls = [];
            titles = [];
            htmlBlock = [];

            text = text.replace(/~/g,"~T");
            text = text.replace(/\$/g,"~D");
            text = text.replace(/\r\n/g,"\n");
            text = text.replace(/\r/g,"\n");
            text = "\n\n" + text + "\n\n";
            text = detab(text);
            text = text.replace(/^[ \t]+$/mg,"");
            text = hashHTMLBlocks(text);
            text = stripLinkDefinitions(text);
            text = runBlockGamut(text);
            text = unescapeSpecialChars(text);
            text = text.replace(/~D/g,"$$");
            text = text.replace(/~T/g,"~");

            return text;
        }
411007
def tag_and_stem(text):
    
    tokens = tokenize(text)
    tagged = nltk.pos_tag(tokens)
    out = []
    for token, tag in tagged:
        stem = morphy_stem(token, tag)
        out.append((stem, tag, token))
    return out
1005320
def text
      temp_doc = doc
      temp_doc.css('script, noscript, style, link').each { |node| node.remove }
      @text = temp_doc.css('body').text.split("\n").collect { |line| line.strip }.join("\n")
    end
828377
def _prepare_text(self, text):
        
        # Remove characters that should be escaped for XML input (but
        # which cause problems when escaped, since they become
        # tokens).
        text = re.sub(r'[<>&]', '', text)
        pattern = r'({})'.format(self._tokenizer.pattern)
        return re.sub(pattern, self._base_token_markup, text)
47051
def nav_title(self, article):
        
        article_title = article.metadata.front.article_meta.title_group.article_title.node
        return str(etree.tostring(article_title, method='text', encoding='utf-8'), encoding='utf-8')
348314
def title(self) -> str:
        """"""
        title_element = _find_tag(self.head, 'title')
        if title_element:
            return title_element.textContent
        return ''