def _parse_filename(self, f): date, slug = re.match(r'(?:(\d{4}(?:-\d{2}-\d{2}){1,2})-)?(.+)', f.name).groups() return ( slugify(slug), self._get_date(f.mtime, date) )
def _get_content_url(self, url, slug, date, frontmatter): subs = { '<year>': '%Y', '<month>': '%m', '<day>': '%d', '<i_month>': unicode(date.month), '<i_day>': unicode(date.day), '<slug>': slug } url = url.replace('%', '%%') for match, replace in subs.iteritems(): url = url.replace(match, replace) for attribute, value in frontmatter.iteritems(): if isinstance(value, basestring): url = url.replace('<{0}>'.format(attribute), slugify(value)) url = date.strftime(url).decode('utf-8') return format_url(url, url.endswith('/'))
def _get_page_url(self, url, text): slug = slugify(text) return format_url(absurl(url, slug), url.endswith('/'))
def _parse_filename(self, f): date, slug = re.match(r'(?:(\d{4}(?:-\d{2}-\d{2}){1,2})-)?(.+)', f.name).groups() return (slugify(slug), self._get_date(f.mtime, date))