<commit_before>from glob import glob

import datetime
import markdown
import os
import re
import yaml

from flask import *
from jinja2.filters import do_truncate, do_striptags

# Regex matching valid blog post files
_FILE_PATTERN = re.compile(r'(\d{4})-(\d{2})-(\d{2})-(.+)\.mdown\Z')

_posts = []

class Post(object):
    """Represents one post on the blog.

    Parameters:
        title : The "raw title" of the blog post. Used as a fallback when no
        title metadata is found.

        date : The "raw date" of the blog post. Used as a fallback when no date
        metadata is found.

        content : The text of the blog post. Can contain html tags.

        metadata : Optional. A dictionary containing additional data describing
        the post. Accepted fields are 'title', 'date', 'categories', and 'tags'

    """

    def __init__(self, title, date, content, metadata):
        self._title = title
        self.date = date
        self._content = content
        self.metadata = metadata or {}

    @property
    def url(self):
        return url_for( 'show_post',  year=self.date.year,
                month=self.date.month, day=self.date.day, title=self._title)

    @property
    def title(self):
        """Returns a displayable title for the post."""
        try:
            return self.metadata['title']
        except KeyError:
            return self._title.replace('-', ' ').title()

    @property
    def preview(self):
        """HTML representing a short preview of the post.

        Contains the first 200 characters of the post's content, followed by a
        link to the post itself.

        """
        preview_text = do_striptags(self._content)
        link = '... <a href="{}">Continue Reading&rarr;</a>'.format(self.url)
        preview_html = do_truncate(preview_text, length=200, end=link)
        return preview_html

    @property
    def content(self):
        """The content of the blog post."""
        return self._content

    @property
    def pretty_date(self):
        """Returns a formatted version of the date."""
        return self.date.strftime('%B %d, %Y')

def get_post(date, title):
    """Returns a Post representing a given blog post.

    Each post is uniquely identified by its date and title.

    """<commit_msg>change "continue reading" text to "continue"<commit_after>from glob import glob

import datetime
import markdown
import os
import re
import yaml

from flask import *
from jinja2.filters import do_truncate, do_striptags

# Regex matching valid blog post files
_FILE_PATTERN = re.compile(r'(\d{4})-(\d{2})-(\d{2})-(.+)\.mdown\Z')

_posts = []

class Post(object):
    """Represents one post on the blog.

    Parameters:
        title : The "raw title" of the blog post. Used as a fallback when no
        title metadata is found.

        date : The "raw date" of the blog post. Used as a fallback when no date
        metadata is found.

        content : The text of the blog post. Can contain html tags.

        metadata : Optional. A dictionary containing additional data describing
        the post. Accepted fields are 'title', 'date', 'categories', and 'tags'

    """

    def __init__(self, title, date, content, metadata):
        self._title = title
        self.date = date
        self._content = content
        self.metadata = metadata or {}

    @property
    def url(self):
        return url_for( 'show_post',  year=self.date.year,
                month=self.date.month, day=self.date.day, title=self._title)

    @property
    def title(self):
        """Returns a displayable title for the post."""
        try:
            return self.metadata['title']
        except KeyError:
            return self._title.replace('-', ' ').title()

    @property
    def preview(self):
        """HTML representing a short preview of the post.

        Contains the first 200 characters of the post's content, followed by a
        link to the post itself.

        """
        preview_text = do_striptags(self._content)
        link = '... <a href="{}">Continue&rarr;</a>'.format(self.url)
        preview_html = do_truncate(preview_text, length=200, end=link)
        return preview_html

    @property
    def content(self):
        """The content of the blog post."""
        return self._content

    @property
    def pretty_date(self):
        """Returns a formatted version of the date."""
        return self.date.strftime('%B %d, %Y')

def get_post(date, title):
    """Returns a Post representing a given blog post.

    Each post is uniquely identified by its date and title.

    """
{'fraction_non_alphanumeric': 0.1064340239912759, 'fraction_numerical': 0.004362050163576881, 'mean_word_length': 2.48745247148289, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3776939', 'n_tokens_mistral': 1335, 'n_tokens_neox': 1260, 'n_words': 472}