summaryrefslogtreecommitdiff
path: root/server/src/resumeparser.cc
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/resumeparser.cc')
-rw-r--r--server/src/resumeparser.cc37
1 files changed, 30 insertions, 7 deletions
diff --git a/server/src/resumeparser.cc b/server/src/resumeparser.cc
index 4d514ac..37b36f4 100644
--- a/server/src/resumeparser.cc
+++ b/server/src/resumeparser.cc
@@ -29,6 +29,7 @@
#include <string.h>
#include "luaresume.h"
+#include "configuration.h"
static std::string resume_parser_format(Resume &r, Commit &commit)
{
@@ -100,18 +101,40 @@ static std::string resume_parser_format(Resume &r, Commit &commit)
return resume;
}
-static std::string resume_parser_lua(Resume &resume, Commit &commit)
+static std::string resume_parser_lua(Macro &macro, Commit &commit)
{
LUAResume luaresume(commit);
-
- return luaresume.run(resume.attributes["format"]);
+ std::string lua;
+ /*
+ std::vector< ScriptInclude >::iterator spii =
+ macro.script_includes.begin();
+ while(spii != macro.script_includes.end()) {
+ std::string file =
+ Conf::xml_basedir + "/include/" + spii->attributes["file"];
+ FILE *fp = fopen(file.c_str(), "r");
+ if(fp) {
+ char buf[64];
+ size_t sz;
+ std::string inc;
+ while((sz = fread(buf, 1, sizeof(buf), fp)) != 0) {
+ lua.append(buf, sz);
+ }
+ fclose(fp);
+ }
+ spii++;
+ }
+ */
+ lua += macro.resume.attributes["format"];
+
+ return luaresume.run(lua);
}
-std::string resume_parser(Resume &resume, Commit &commit)
+std::string resume_parser(Macro &macro, Commit &commit)
{
- if(resume.attributes["language"] == "lua")
- return resume_parser_lua(resume, commit);
+ if(macro.resume.attributes["language"] == "lua") {
+ return resume_parser_lua(macro, commit);
+ }
// Default to pracro format language.
- return resume_parser_format(resume, commit);
+ return resume_parser_format(macro.resume, commit);
}