File: wiki.py

package info (click to toggle)
python-markdown2 2.4.11-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,104 kB
  • sloc: python: 5,416; perl: 1,493; php: 865; makefile: 34
file content (21 lines) | stat: -rw-r--r-- 471 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

import sys
import re
from os.path import *

sys.path.insert(0, dirname(dirname(abspath(__file__))))
import markdown2

wiki_page = """
# This is my WikiPage!

This is AnotherPage and YetAnotherPage.
"""

link_patterns = [
    # Match a wiki page link LikeThis.
    (re.compile(r"(\b[A-Z][a-z]+[A-Z]\w+\b)"), r"/\1")
]
processor = markdown2.Markdown(extras=["link-patterns"],
                               link_patterns=link_patterns)
print(processor.convert(wiki_page))