# Path: parm/_compat.py
# PY3 = sys.version_info[0] == 3
# PY2 = sys.version_info[0] == 2
# PY26 = sys.version_info[0:2] == (2, 6)
# PYPY = hasattr(sys, 'pypy_translation_info')
#     def reraise(tp, value, tb=None):
#     def u(s, encoding='utf8'):
#     def b(s):
#     def implements_iterator(cls):
#     def python_2_unicode_compatible(cls):
#     def u(s, encoding='utf8'):
#     def b(s, encoding='utf8'):
#     def exec_(code, globs=None, locs=None):
#     def next(it):
# def with_metaclass(meta, *bases):
#         def __new__(cls, name, this_bases, d):
# def import_(module, objects=None, via=None):
#     class metaclass(meta):
# 
# Path: parm/utils.py
# def safe_import(path):
# def import_mod_attr(path):
# def import_attr(func):
# def myimport(module):
#     def resource_filename(module, path):
#     def resource_listdir(module, path):
#     def resource_isdir(module, path):
# def extract_file(module, path, dist, verbose=False, replace=True):
# def extract_dirs(mod, path, dst, verbose=False, exclude=None, exclude_ext=None, recursion=True, replace=True):
# def match(f, patterns):
# def walk_dirs(path, include=None, include_ext=None, exclude=None, 
#         exclude_ext=None, recursion=True, file_only=False):
# def copy_dir(src, dst, verbose=False, check=False, processor=None):
#     def _md5(filename):
# def copy_dir_with_check(dirs, dst, verbose=False, check=True, processor=None):
# def encode_basestring(s):
#     def replace(match):
# def encode_unicode(s):
# def simple_value(v):
#     def __init__(self, encoding='utf-8', unicode=False, default=None):
#     def iterencode(self, obj, key=False):
#     def encode(self, obj):
# def json_dumps(obj, unicode=False, **kwargs):
# class MyPkg(object):
# class JSONEncoder(object):
# ESCAPE = re.compile(r'[\x00-\x1f\\"\b\f\n\r\t]')
# ESCAPE_DCT = {
#     '\\': '\\\\',
#     '"': '\\"',
#     '\b': '\\b',
#     '\f': '\\f',
#     '\n': '\\n',
#     '\r': '\\r',
#     '\t': '\\t',
# }


from ._compat import range, open, u
from .utils import log
    from .utils import json_dumps
    from .utils import json_dumps
    from .utils import json_dumps
import re
import os
            if len(v) == 1:
                lineno.append(b)
            else:
                lineno.append((b, e))

    s = []
    first = '```'
    lang = kw.pop('language', '')
    if lang:
        first += lang+','
    x = []
    for k, v in kw.items():
        x.append('%s=%s' % (k, v))
    if x:
        first += ','.join(x)
    s.append(first)
    
    with open(filename, 'r') as f:
        buf = f.readlines()
    
    if lineno and pattern:
        #calculate patterns
        for i, line in enumerate(buf):
            for j, v in enumerate(lineno):
                if isinstance(v, tuple):
                    lineno[j] = (get_line_index(line, v[0], i+1, 'begin'), get_line_index(line, v[1], i+1, 'end'))
                else:
                    t = get_line_index(line, v, i+1)
                    lineno[j] = t, t
        

# Path: parm/_compat.py
# PY3 = sys.version_info[0] == 3
# PY2 = sys.version_info[0] == 2
# PY26 = sys.version_info[0:2] == (2, 6)
# PYPY = hasattr(sys, 'pypy_translation_info')
#     def reraise(tp, value, tb=None):
#     def u(s, encoding='utf8'):
#     def b(s):
#     def implements_iterator(cls):
#     def python_2_unicode_compatible(cls):
#     def u(s, encoding='utf8'):
#     def b(s, encoding='utf8'):
#     def exec_(code, globs=None, locs=None):
#     def next(it):
# def with_metaclass(meta, *bases):
#         def __new__(cls, name, this_bases, d):
# def import_(module, objects=None, via=None):
#     class metaclass(meta):
# 
# Path: parm/utils.py
# def safe_import(path):
# def import_mod_attr(path):
# def import_attr(func):
# def myimport(module):
#     def resource_filename(module, path):
#     def resource_listdir(module, path):
#     def resource_isdir(module, path):
# def extract_file(module, path, dist, verbose=False, replace=True):
# def extract_dirs(mod, path, dst, verbose=False, exclude=None, exclude_ext=None, recursion=True, replace=True):
# def match(f, patterns):
# def walk_dirs(path, include=None, include_ext=None, exclude=None, 
#         exclude_ext=None, recursion=True, file_only=False):
# def copy_dir(src, dst, verbose=False, check=False, processor=None):
#     def _md5(filename):
# def copy_dir_with_check(dirs, dst, verbose=False, check=True, processor=None):
# def encode_basestring(s):
#     def replace(match):
# def encode_unicode(s):
# def simple_value(v):
#     def __init__(self, encoding='utf-8', unicode=False, default=None):
#     def iterencode(self, obj, key=False):
#     def encode(self, obj):
# def json_dumps(obj, unicode=False, **kwargs):
# class MyPkg(object):
# class JSONEncoder(object):
# ESCAPE = re.compile(r'[\x00-\x1f\\"\b\f\n\r\t]')
# ESCAPE_DCT = {
#     '\\': '\\\\',
#     '"': '\\"',
#     '\b': '\\b',
#     '\f': '\\f',
#     '\n': '\\n',
#     '\r': '\\r',
#     '\t': '\\t',
# }


# Path: parm/md_ext.py
from ._compat import range, open, u
from .utils import log
    from .utils import json_dumps
    from .utils import json_dumps
    from .utils import json_dumps
import re
import os

            if len(v) == 1:
                lineno.append(b)
            else:
                lineno.append((b, e))

    s = []
    first = '```'
    lang = kw.pop('language', '')
    if lang:
        first += lang+','
    x = []
    for k, v in kw.items():
        x.append('%s=%s' % (k, v))
    if x:
        first += ','.join(x)
    s.append(first)
    
    with open(filename, 'r') as f:
        buf = f.readlines()
    
    if lineno and pattern:
        #calculate patterns
        for i, line in enumerate(buf):
            for j, v in enumerate(lineno):
                if isinstance(v, tuple):
                    lineno[j] = (get_line_index(line, v[0], i+1, 'begin'), get_line_index(line, v[1], i+1, 'end'))
                else:
                    t = get_line_index(line, v, i+1)
                    lineno[j] = t, t
        

        for i in range(len(lineno)-1, -1, -1):