Exemplo n.º 1
0
 def test_dollar_present(self):
     self.assertEqual(unescape_latex(
         'The revenue is $30 per cow'), 'The revenue is $30 per cow')
     self.assertEqual(remove_latex_math_dollars('The revenue is $30 per cow'),
                      'The revenue is $30 per cow')
     self.assertEqual(remove_latex_math_dollars('Instead of $15, the revenue is $30 per cow'),
                      'Instead of $15, the revenue is $30 per cow')
Exemplo n.º 2
0
 def test_crazy_accents(self):
     self.assertEqual(
         unescape_latex(
             "Cohomologie locale des faisceaux coh\\'erents et th\\'eor\\`emes de Lefschetz locaux et globaux (SGA 2)"
         ),
         "Cohomologie locale des faisceaux cohérents et théorèmes de Lefschetz locaux et globaux (SGA 2)"
     )
Exemplo n.º 3
0
def strip_latex(apps, schema_editor):
    Paper = apps.get_model('papers', 'Paper')
    size = 100
    cursor = 0
    count = Paper.objects.count()
    while cursor < count:
        papers = Paper.objects.all()[cursor:cursor + size]
        cursor += size
        for paper in papers:
            new_title = unescape_latex(paper.title)
            if new_title != paper.title:
                print '"%s" -> "%s"' % (paper.title, new_title)
                paper.title = new_title
                paper.save(update_fields=['title'])
Exemplo n.º 4
0
def strip_latex(apps, schema_editor):
    Paper = apps.get_model('papers','Paper')
    size = 100
    cursor = 0
    count = Paper.objects.count()
    while cursor < count:
        papers = Paper.objects.all()[cursor:cursor+size]
        cursor += size
        for paper in papers:
            new_title = unescape_latex(paper.title)
            if new_title != paper.title:
                print '"%s" -> "%s"' % (paper.title,new_title)
                paper.title = new_title
                paper.save(update_fields=['title'])
Exemplo n.º 5
0
 def test_crazy_accents(self):
     self.assertEqual(unescape_latex("Cohomologie locale des faisceaux coh\\'erents et th\\'eor\\`emes de Lefschetz locaux et globaux (SGA 2)"),
                      "Cohomologie locale des faisceaux cohérents et théorèmes de Lefschetz locaux et globaux (SGA 2)")
Exemplo n.º 6
0
 def test_simple(self):
     self.assertEqual(unescape_latex('This is a test'), 'This is a test')
     self.assertEqual(unescape_latex(
         'This is an \\alpha ray'), 'This is an α ray')
     self.assertEqual(unescape_latex(
         'This is an $\\alpha$ ray'), 'This is an $α$ ray')
Exemplo n.º 7
0
 def test_unescape_latex(self):
     self.assertEqual(unescape_latex('the $\\alpha$-rays of $\\Sigma$-algebras'), 'the $\u03b1$-rays of $\u03a3$-algebras')
     self.assertEqual(unescape_latex('$\\textit{K}$ -trivial'), '$\\textit{K}$ -trivial')
Exemplo n.º 8
0
def parse_authors_list(authors):
    authors = unescape_latex(authors)
    authors = et_al_re.sub('', authors)
    return map(parse_comma_name,
               remove_latex_braces(unescape_latex(authors)).split(' and '))
Exemplo n.º 9
0
def parse_authors_list(authors):
    authors = unescape_latex(authors)
    authors = et_al_re.sub('', authors)
    return map(parse_comma_name,
                remove_latex_braces(unescape_latex(authors)).split(' and '))