import os
from ed_folder import start_ed
from xslt_handler import process_xml
import lxml.etree as etree 

#Need to create here some global variable 

counter = 0

for i in os.listdir('/home/jgillium/Bureau/Corpus_modern_english/modern_english/uvaGenText/tei'):
    if counter < 300:
        xslt_path = '/home/jgillium/Bureau/Ed_modern_english/XSLT/modern_english_corpus.xsl'
        folder_path = '/home/jgillium/Bureau/Ed_modern_english/XML/modern_english/uvaGenText/tei' 
        name_file_without_extension = os.path.splitext(i)[0]
#Below the folder_mdf variable for one ed repository for each text
#    folder_mdf = os.path.join('/home/jgillium/Bureau/Ed_modern_english/Output',name_file_without_extension,'_texts')
        folder_mdf = os.path.join('/home/jgillium/Bureau/Output_ed_modern_english/ed/_texts')
        name_file_without_extension = os.path.splitext(i)[0]
        name_markdown_file = name_file_without_extension+'.md'
        print name_markdown_file
        path_output = os.path.join(folder_mdf,name_markdown_file)                 
        xml_path = os.path.join(folder_path,i)
#Below the code to create one ed repository for each text
#    ed_repository_creation = start_ed(name_file_without_extension)
        markdown_file_creation = process_xml(name_file_without_extension, xml_path, xslt_path, path_output)
        counter += 1
        print counter

    



