mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Modernize code base to Python 3+ syntax
Replaces syntax that was relevant in earlier Python versions but that now has modernized equivalents.
This commit is contained in:
parent
2cd1d44576
commit
d43b786b30
37 changed files with 104 additions and 171 deletions
|
|
@ -1,5 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import copy
|
||||
import datetime
|
||||
import locale
|
||||
|
|
@ -22,7 +20,7 @@ from pelican.urlwrappers import (Author, Category, Tag, URLWrapper) # NOQA
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Content(object):
|
||||
class Content:
|
||||
"""Represents a content.
|
||||
|
||||
:param content: the string to parse, containing the original content.
|
||||
|
|
@ -216,7 +214,7 @@ class Content(object):
|
|||
def _expand_settings(self, key, klass=None):
|
||||
if not klass:
|
||||
klass = self.__class__.__name__
|
||||
fq_key = ('%s_%s' % (klass, key)).upper()
|
||||
fq_key = ('{}_{}'.format(klass, key)).upper()
|
||||
return self.settings[fq_key].format(**self.url_format)
|
||||
|
||||
def get_url_setting(self, key):
|
||||
|
|
@ -324,7 +322,7 @@ class Content(object):
|
|||
(?:href|src|poster|data|cite|formaction|action)\s*=\s*)
|
||||
|
||||
(?P<quote>["\']) # require value to be quoted
|
||||
(?P<path>{0}(?P<value>.*?)) # the url value
|
||||
(?P<path>{}(?P<value>.*?)) # the url value
|
||||
\2""".format(intrasite_link_regex)
|
||||
return re.compile(regex, re.X)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue