cinera.c: Correctly set theme

This commit is contained in:
Matt Mascarenhas 2018-06-13 16:05:21 +01:00
parent a1e8efe431
commit 8c17194180
1 changed files with 17 additions and 10 deletions

View File

@ -16,7 +16,7 @@ typedef struct
version CINERA_APP_VERSION = {
.Major = 0,
.Minor = 5,
.Patch = 60
.Patch = 61
};
// TODO(matt): Copy in the DB 3 stuff from cinera_working.c
@ -3031,15 +3031,22 @@ HMMLToBuffers(buffers *CollationBuffers, template **BespokeTemplate, char *Filen
HaveErrors = TRUE;
}
if(!HMML.metadata.project && !StringsDiffer(CollationBuffers->Theme, ""))
if(!StringsDiffer(CollationBuffers->Theme, ""))
{
fprintf(stderr, "Unable to determine which theme to apply to the HTML\n"
"Please set at least one of:\n"
"\t1. project attribute in the [video] node of your .hmml file\n"
"\t2. ProjectID on the command line with -p\n"
"\t3. Style on the command line with -s\n"
);
HaveErrors = TRUE;
if(HMML.metadata.project)
{
CopyStringNoFormat(CollationBuffers->Theme, sizeof(CollationBuffers->Theme), HMML.metadata.project);
}
else
{
fprintf(stderr, "Unable to determine which theme to apply to the HTML\n"
"Please set at least one of:\n"
"\t1. project attribute in the [video] node of your .hmml file\n"
"\t2. ProjectID on the command line with -p\n"
"\t3. Style on the command line with -s\n"
);
HaveErrors = TRUE;
}
}
if(!HMML.metadata.id)
@ -6490,7 +6497,7 @@ main(int ArgC, char **Args)
CopyStringNoFormat(CollationBuffers.ProjectID, sizeof(CollationBuffers.ProjectID), Config.ProjectID);
if(!StringsDiffer(Config.Theme, ""))
{
CopyStringNoFormat(Config.Theme, sizeof(Config.Theme), Config.ProjectID);
Config.Theme = Config.ProjectID;
}
CopyStringNoFormat(CollationBuffers.Theme, sizeof(CollationBuffers.Theme), Config.Theme);
if(StringsDiffer(ProjectInfo[ProjectInfoIndex].FullName, ""))