Turn the first paragraph of text into the summary text
6773
def paragraph(self, content):
        
        if not self._out.description:
            self._out.description = content
        return ' '
833718
def humanize(text):
    ''''''
    words = []
    for part in text.split('_'):
        for word in RE_CAMEL.findall(part) or [part]:
            words.append(word.lower())
    words[0] = words[0].title()
    return ' '.join(words)
1151834
def format_content(content):
    

    paragraphs = parse_html(content)

    first = True

    for paragraph in paragraphs:
        if not first:
            yield ""

        for line in paragraph:
            yield line

        first = False
323479
def p_text(self, text):
        ''''''
        item = text[1]
        text[0] = item if item[0] != "\n" else u""
        if len(text) > 2:
            text[0] += "\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)
1312941
def paragraph(content):
        

        # if the content contains a top-level div then don't wrap it in a <p>
        # tag
        if content.startswith('<div') and content.endswith('</div>'):
            return '\n' + content + '\n'

        text = '<p>' + content + '</p>'
        text = re.sub(r'<p>\s*</p>', r'', text)
        return text or ' '
7425
def _fill_text(self, text, width=None, indent=None):
        
        assert isinstance(text, str)
        if indent is None:
            indent = NBSP * self._current_indent
        assert isinstance(indent, str)
        paragraphs = []
        line_buf = []
        pre = ''
        for fragment in text.splitlines():
            pre_indent = self.leadingws.match(fragment)
            if not fragment or pre_indent:
                if line_buf:
                    line = ' '.join(line_buf)
                    paragraphs.append((pre, self.whitespace.sub(' ', line)))
                if not fragment:
                    paragraphs.append(('', ''))
                else:
                    pre = pre_indent.group()
                    fragment = self.leadingws.sub('', fragment)
                    paragraphs.append((pre, fragment))
                line_buf = []
                pre = ''
            else:
                line_buf.append(fragment)
        if line_buf:
            line = ' '.join(line_buf)
            paragraphs.append((pre, self.whitespace.sub(' ', line)))
        indent = VTMLBuffer(indent)
        nl = VTMLBuffer('\n')
        if width is None:
            width = self._width - len(indent)
        lines = []
        for pre, paragraph in paragraphs:
            pwidth = width - len(pre)
            lines.append(nl.join((indent + pre + x)
                         for x in vtmlrender(paragraph).wrap(pwidth)))
        return nl.join(lines)
22149
def paragraph_sub(match):
    """"""
    text = re.sub(r'  \n', r'\n<br/>\n', match.group(0).strip())
    return '<p>{}</p>'.format(text)
48148
def cli_info(data, title='Info'):
    '''
    
    '''

    wrapper = textwrap.TextWrapper()
    wrapper.initial_indent = ' ' * 4
    wrapper.subsequent_indent = wrapper.initial_indent

    return '{title}:\n\n{text}'.format(title=title, text=wrapper.fill(data))
1321090
def get_summary(content):
  """"""
  soup = BeautifulSoup(content, "html.parser")
  summary = soup.find_all(attrs={
      'class': re.compile(r".*\bsummary-content\b.*")})

  if summary[0].p.string is None:
    return summary[0].p.p.getText()
  return summary[0].p.getText()
902156
def summarize(self):
        ''''''

        self.speak('Here is a brief summary of {}.'.format(self.nametag))
        s = '\n'+pprint.pformat(self.__dict__)
        print(s.replace('\n', '\n'+' '*(len(self._prefix)+1)) + '\n')
1202979
function(post, summary) {
    var template = '';
    template += 'article.hentry\n';
    template += '  header\n';
    template += '    h1.entry-title\n';
    template += '      a(href=post.url) !{post.title}\n';
    template += '    time.updated(datetime=dx(post.date), pubdate) #{ds(post.date)}\n';
    if (post.author)
      template += '    p.byline.author.vcard by <span class="fn">#{post.author}</span>\n';

    if (post.tags) template += '    div.tags !{tags(post.tags)}\n';

    if (summary) {
      if (post.summary) {
        template += '  !{post.summary + "<p><a class=\\"read-more\\" href=\\"' + post.url + '\\">Read More &rarr;</a></p>"}\n';
      } else {
        template += '  !{truncateParagraphs(post.content, 3, "<p><a class=\\"read-more\\" href=\\"' + post.url + '\\">Read More &rarr;</a></p>")}\n';
      }
    } else {
      template += '  !{post.content}\n';
    }
    return helpers.render(template, { locals: this.applyHelpers({ post: post }) });
  }
283084
def parse(text: str) -> Docstring:
    
    ret = Docstring()
    if not text:
        return ret

    # Clean according to PEP-0257
    text = inspect.cleandoc(text)

    # Find first title and split on its position
    match = _titles_re.search(text)
    if match:
        desc_chunk = text[: match.start()]
        meta_chunk = text[match.start() :]
    else:
        desc_chunk = text
        meta_chunk = ""

    # Break description into short and long parts
    parts = desc_chunk.split("\n", 1)
    ret.short_description = parts[0] or None
    if len(parts) > 1:
        long_desc_chunk = parts[1] or ""
        ret.blank_after_short_description = long_desc_chunk.startswith("\n")
        ret.blank_after_long_description = long_desc_chunk.endswith("\n\n")
        ret.long_description = long_desc_chunk.strip() or None

    # Split by sections determined by titles
    matches = list(_titles_re.finditer(meta_chunk))
    if not matches:
        return ret
    splits = []
    for j in range(len(matches) - 1):
        splits.append((matches[j].end(), matches[j + 1].start()))
    splits.append((matches[-1].end(), len(meta_chunk)))

    chunks = {}
    for j, (start, end) in enumerate(splits):
        title = matches[j].group(1)
        if title not in _valid:
            continue
        chunks[title] = meta_chunk[start:end].strip("\n")
    if not chunks:
        return ret

    # Add elements from each chunk
    for title, chunk in chunks.items():
        # Determine indent
        indent_match = re.search(r"^\s+", chunk)
        if not indent_match:
            raise ParseError(f'Can\'t infer indent from "{chunk}"')
        indent = indent_match.group()

        # Check for returns/yeilds (only one element)
        if _sections[title] in ("returns", "yields"):
            part = inspect.cleandoc(chunk)
            ret.meta.append(_build_meta(part, title))
            continue

        # Split based on lines which have exactly that indent
        _re = "^" + indent + r"(?=\S)"
        c_matches = list(re.finditer(_re, chunk, flags=re.M))
        if not c_matches:
            raise ParseError(f'No specification for "{title}": "{chunk}"')
        c_splits = []
        for j in range(len(c_matches) - 1):
            c_splits.append((c_matches[j].end(), c_matches[j + 1].start()))
        c_splits.append((c_matches[-1].end(), len(chunk)))
        for j, (start, end) in enumerate(c_splits):
            part = chunk[start:end].strip("\n")
            ret.meta.append(_build_meta(part, title))

    return ret
131481
def titleize(text):
    
    if len(text) == 0: # if empty string, return it
        return text
    else:
        text = text.lower() # lower all char
        # delete redundant empty space 
        chunks = [chunk[0].upper() + chunk[1:] for chunk in text.split(" ") if len(chunk) >= 1]
        return " ".join(chunks)
688814
def heading(headingtext, headinglevel, lang='en'):
    ''''''
    lmap = {'en': 'Heading', 'it': 'Titolo'}
    # Make our elements
    paragraph = makeelement('p')
    pr = makeelement('pPr')
    pStyle = makeelement(
        'pStyle', attributes={'val': lmap[lang]+str(headinglevel)})
    run = makeelement('r')
    text = makeelement('t', tagtext=headingtext)
    # Add the text the run, and the run to the paragraph
    pr.append(pStyle)
    run.append(text)
    paragraph.append(pr)
    paragraph.append(run)
    # Return the combined paragraph
    return paragraph
682667
def wrap(wrap_at = DEFAULT_WIDTH)
      if text.length < wrap_at.to_i || wrap_at.to_i.zero?
        return text
      end
      ansi_stack = []
      text.split(NEWLINE, -1).map do |paragraph|
        format_paragraph(paragraph, wrap_at, ansi_stack)
      end * NEWLINE
    end
1233973
function paragraph(lang, wordCount, startWithCommon) {
		var data = langs[lang];
		if (!data) {
			return '';
		}

		var result = [];
		var totalWords = 0;
		var words;
		
		wordCount = parseInt(wordCount, 10);
		
		if (startWithCommon && data.common) {
			words = data.common.slice(0, wordCount);
			if (words.length > 5) {
				words[4] += ',';
			}
			totalWords += words.length;
			result.push(sentence(words, '.'));
		}
		
		while (totalWords < wordCount) {
			words = sample(data.words, Math.min(randint(2, 30), wordCount - totalWords));
			totalWords += words.length;
			insertCommas(words);
			result.push(sentence(words));
		}
		
		return result.join(' ');
	}