from markdown import Extension
# from markdown.treeprocessors import Treeprocessor
import xml.etree.ElementTree as etree
import copy
import html

from markdown import Extension
from markdown.inlinepatterns import InlineProcessor
# from markdown.blockprocessors import BlockProcessor
from markdown import util as md_util
# from functools import partial
import xml.etree.ElementTree as etree
from . import util
import re

DEFAULT_CONFIG = {}

RE_STATIC=r'''\{% *static '([a-zA-Z0-9_/\.\-]*)' *%\}'''

class StaticProcessor(InlineProcessor):
    def __init__(self, pattern, config, md):

        super().__init__(pattern, md)

    def handle_match(self, m, data):
        el = etree.Element(
            ('div'),
            ({})
        )

class StaticExtension(Extension):
    def __init__(self, *args, **kwargs):

        self.config = {
        }

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

    def extendMarkdown(self, md):
        """Add support for keys."""

        md.inlinePatterns.register(StaticProcessor(RE_STATIC, self.getConfigs(), md))
        
def makeExtension(*args, **kwargs):
    return StaticExtension(*args, **kwargs)