contentPath,
hasHeader,
content
);
MarkupEngine engine = Engines.get(FileUtil.fileExt(file));
if (engine==null) {
LOGGER.error("Unable to find suitable markup engine for {}",file);
return null;
}
if (hasHeader) {
// read header from file
processHeader(fileContents, content);
}
// then read engine specific headers
engine.processHeader(context);
if (config.getString(Keys.DEFAULT_STATUS) != null) {
// default status has been set
if (content.get("status") == null) {
// file hasn't got status so use default
content.put("status", config.getString(Keys.DEFAULT_STATUS));
}
}
if (content.get("type")==null||content.get("status")==null) {
// output error
LOGGER.error("Error parsing meta data from header!");
return null;
}
// generate default body
processBody(fileContents, content);
// eventually process body using specific engine
if (engine.validate(context)) {
engine.processBody(context);
} else {
LOGGER.error("Incomplete source file ({}) for markup engine:", file, engine.getClass().getSimpleName());
return null;
}
return content;
}