Commit 72a19913 authored by Andrey Golovizin's avatar Andrey Golovizin
Browse files

Get rid of ur'' strings

parent 0277d4f7
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -73,13 +73,13 @@ class Backend(BaseBackend):
        return escape(text)

    def format_protected(self, text):
        return ur'<span class="bibtex-protected">{}</span>'.format(text)
        return r'<span class="bibtex-protected">{}</span>'.format(text)

    def format_tag(self, tag, text):
        return ur'<{0}>{1}</{0}>'.format(tag, text) if text else u''
        return r'<{0}>{1}</{0}>'.format(tag, text) if text else u''

    def format_href(self, url, text):
        return ur'<a href="{0}">{1}</a>'.format(url, text) if text else u''
        return r'<a href="{0}">{1}</a>'.format(url, text) if text else u''

    def write_prologue(self):
        encoding = self.encoding or pybtex.io.get_default_encoding()
+2 −2
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ class Backend(BaseBackend):
        if tag is None:
            return u'{%s}' % text if text else u''
        else:
            return ur'\%s{%s}' % (tag, text) if text else u''
            return r'\%s{%s}' % (tag, text) if text else u''

    def format_href(self, url, text):
        if not text:
@@ -81,7 +81,7 @@ class Backend(BaseBackend):
        elif text == self.format_str(url):
            return u'\\url{%s}' % url
        else:
            return ur'\href{%s}{%s}' % (url, text) if text else u''
            return r'\href{%s}{%s}' % (url, text) if text else u''

    def format_protected(self, text):
        """
+2 −2
Original line number Diff line number Diff line
@@ -110,10 +110,10 @@ class Backend(BaseBackend):
        if tag is None:
            return text
        else:
            return ur'{0}{1}{0}'.format(tag, text) if text else u''
            return r'{0}{1}{0}'.format(tag, text) if text else u''

    def format_href(self, url, text):
        return ur'[%s](%s)' % (text, url) if text else u''
        return r'[%s](%s)' % (text, url) if text else u''

    def write_entry(self, key, label, text):
        # Support http://www.michelf.com/projects/php-markdown/extra/#def-list
+6 −6
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ def process_function(toks):
    return FunctionLiteral(toks[0])


quote_or_comment = re.compile(ur'[%"]')
quote_or_comment = re.compile(r'[%"]')
def strip_comment(line):
    """Strip the commented part of the line."

@@ -87,11 +87,11 @@ from pybtex.scanner import (


class BstParser(Scanner):
    LBRACE = Literal(u'{')
    RBRACE = Literal(u'}')
    STRING = Pattern(ur'"[^\"]*"', 'string')
    INTEGER = Pattern(ur'#-?\d+', 'integer')
    NAME = Pattern(ur'[^#\"\{\}\s]+', 'name')
    LBRACE = Literal('{')
    RBRACE = Literal('}')
    STRING = Pattern('"[^\"]*"', 'string')
    INTEGER = Pattern(r'#-?\d+', 'integer')
    NAME = Pattern(r'[^#\"\{\}\s]+', 'name')

    COMMANDS = {
        'ENTRY': 3,
+3 −3
Original line number Diff line number Diff line
@@ -287,9 +287,9 @@ class UnbalancedBraceError(PybtexSyntaxError):
class NameFormatParser(Scanner):
    LBRACE = Literal(u'{')
    RBRACE = Literal(u'}')
    TEXT = Pattern(ur'[^{}]+', 'text')
    NON_LETTERS = Pattern(ur'[^{}\w]|\d+', 'non-letter characters', flags=re.IGNORECASE | re.UNICODE)
    FORMAT_CHARS = Pattern(ur'[^\W\d_]+', 'format chars', flags=re.IGNORECASE | re.UNICODE)
    TEXT = Pattern(r'[^{}]+', 'text')
    NON_LETTERS = Pattern(r'[^{}\w]|\d+', 'non-letter characters', flags=re.IGNORECASE | re.UNICODE)
    FORMAT_CHARS = Pattern(r'[^\W\d_]+', 'format chars', flags=re.IGNORECASE | re.UNICODE)

    lineno = None

Loading