Exemple #1
0
    def handleMatch(self, m):
        label = m.group(2).strip()
        url = resolve("wiki", self.project.slug, slugify(label))

        if m.group(3):
            title = m.group(3).strip()[1:]
        else:
            title = label

        a = etree.Element("a")
        a.text = title
        a.set("href", url)
        a.set("title", title)
        a.set("class", "reference wiki")
        return a
Exemple #2
0
    def handleMatch(self, m):
        label = m.group(2).strip()

        # `project` could be other object (!)
        slug = getattr(self.project, "slug")
        if not slug:
            project = getattr(self.project, "project")
            slug = getattr(project, "slug")
            if not slug:
                return

        url = resolve("wiki", slug, slugify(label))

        if m.group(3):
            title = m.group(3).strip()[1:]
        else:
            title = label

        a = etree.Element("a")
        a.text = title
        a.set("href", url)
        a.set("title", title)
        a.set("class", "reference wiki")
        return a
Exemple #3
0
def test_slugify_3():
    assert slugify(None) == ""
Exemple #4
0
def test_slugify_2():
    assert slugify("TestExamplePage") == "testexamplepage"
Exemple #5
0
def test_slugify_1():
    assert slugify("漢字") == "han-zi"
Exemple #6
0
def test_slugify_3():
    assert slugify(None) == ""
Exemple #7
0
def test_slugify_2():
    assert slugify("TestExamplePage") == "testexamplepage"
Exemple #8
0
def test_slugify_1():
    assert slugify("漢字") == "han-zi"
Exemple #9
0
 def save(self, *args, **kwargs):
     if not self.slug:
         self.slug = slugify(self.title, self.__class__)
     super().save(*args, **kwargs)
Exemple #10
0
    def save(self, *args, **kwargs):
        if not self.href:
            self.href = slugify(self.title)

        super().save(*args, **kwargs)
Exemple #11
0
    def save(self, *args, **kwargs):
        if not self.href:
            self.href = slugify(self.title)

        super().save(*args, **kwargs)