'''
Created on 2016-04-29

Copyright (c) 2016 Bradford Dillman

@author: bdillman

xform which generates documentation from models and templates.
'''

import logging

from fashion import templates

logging.debug("fashion_doc loaded")

def outputKinds():
    '''Outputs generated by this xform'''
    return [ ]

def police(fashion_gen):
    '''Validate models before xform.'''
    pass

def xform(fashion_gen):
    '''Perform source generation from template.'''
    logging.debug("fashion_doc xform running")
    genModels = [f.loadFile() for f in fashion_gen]
    docModel = {'genModels': genModels}
    args = {'model'       : docModel, 
            'templateFile': 'fashion_build.html', 
            'targetFile'  : 'fashion/build.html'}
    templates.generateFile(**args)
