# Path: engine/conf.py
# PATH_TO_BASE_IMG = PATH_TO_TEMPLATE + "/img/"
# 
# PATH_TO_TEMPLATE = PATH + "/themes/" + TEMPLATE + "/notes/"  # don't forget about ending /
# 
# PATH_TO_TEMPLATE_HTML = PATH_TO_TEMPLATE + 'head.html'
# 
# PATH_TO_HTML = PATH + "/engine/data/html/"
# 
# PATH_TO_MD = PATH + '/notes/'


import sys
import re
import datetime
import os
import time
import logging
from pygments import highlight
from pygments.lexers import PythonLexer, HtmlLexer, CssLexer, EmacsLispLexer, BashLexer, HexdumpLexer, DjangoLexer
from pygments.formatters import HtmlFormatter
from engine.conf import PATH_TO_BASE_IMG, PATH_TO_TEMPLATE, PATH_TO_TEMPLATE_HTML, PATH_TO_HTML, PATH_TO_MD
    text = text.replace('[warning!]', '<br></p>')
    # danger text
    text = text.replace('[!danger]', '<p class="bg-danger">')
    text = text.replace('[danger!]', '<br></p>')
    # succes text
    text = text.replace('[!success]', '<p class="bg-success">')
    text = text.replace('[success!]', '<br></p>')
    # info text
    text = text.replace('[!info]', '<p class="bg-info">')
    text = text.replace('[info!]', '<br></p>')

    return text


def add_head_for_flask(text):
    head = open(PATH_TO_TEMPLATE_HTML).read()
    head = head.replace('{{ url_index }}', PATH_TO_HTML + '/' + 'index.html')
    head = head.replace('href="img/', 'href="' + '/img/')
    head = head.replace('="lib/', '="' + '/lib/')
    head = head.replace('="css/', '="' + '/css/')
    head = head.replace('="js/', '="' + '/js/')

    # remove demo content
    head = re.sub(r'<!-- start of demo -->.*<!-- end of demo -->',
                  r'', head, flags=re.M | re.DOTALL)
    return head + text


def add_head(text):
    """Add head html from template  """

# Path: engine/conf.py
# PATH_TO_BASE_IMG = PATH_TO_TEMPLATE + "/img/"
# 
# PATH_TO_TEMPLATE = PATH + "/themes/" + TEMPLATE + "/notes/"  # don't forget about ending /
# 
# PATH_TO_TEMPLATE_HTML = PATH_TO_TEMPLATE + 'head.html'
# 
# PATH_TO_HTML = PATH + "/engine/data/html/"
# 
# PATH_TO_MD = PATH + '/notes/'


# Path: engine/postprocessing.py
import sys
import re
import datetime
import os
import time
import logging
from pygments import highlight
from pygments.lexers import PythonLexer, HtmlLexer, CssLexer, EmacsLispLexer, BashLexer, HexdumpLexer, DjangoLexer
from pygments.formatters import HtmlFormatter
from engine.conf import PATH_TO_BASE_IMG, PATH_TO_TEMPLATE, PATH_TO_TEMPLATE_HTML, PATH_TO_HTML, PATH_TO_MD

    text = text.replace('[warning!]', '<br></p>')
    # danger text
    text = text.replace('[!danger]', '<p class="bg-danger">')
    text = text.replace('[danger!]', '<br></p>')
    # succes text
    text = text.replace('[!success]', '<p class="bg-success">')
    text = text.replace('[success!]', '<br></p>')
    # info text
    text = text.replace('[!info]', '<p class="bg-info">')
    text = text.replace('[info!]', '<br></p>')

    return text


def add_head_for_flask(text):
    head = open(PATH_TO_TEMPLATE_HTML).read()
    head = head.replace('{{ url_index }}', PATH_TO_HTML + '/' + 'index.html')
    head = head.replace('href="img/', 'href="' + '/img/')
    head = head.replace('="lib/', '="' + '/lib/')
    head = head.replace('="css/', '="' + '/css/')
    head = head.replace('="js/', '="' + '/js/')

    # remove demo content
    head = re.sub(r'<!-- start of demo -->.*<!-- end of demo -->',
                  r'', head, flags=re.M | re.DOTALL)
    return head + text


def add_head(text):
    """Add head html from template  """

    head = open(PATH_TO_TEMPLATE_HTML).read()