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 = { version CINERA_APP_VERSION = {
.Major = 0, .Major = 0,
.Minor = 5, .Minor = 5,
.Patch = 60 .Patch = 61
}; };
// TODO(matt): Copy in the DB 3 stuff from cinera_working.c // TODO(matt): Copy in the DB 3 stuff from cinera_working.c
@ -3031,7 +3031,13 @@ HMMLToBuffers(buffers *CollationBuffers, template **BespokeTemplate, char *Filen
HaveErrors = TRUE; HaveErrors = TRUE;
} }
if(!HMML.metadata.project && !StringsDiffer(CollationBuffers->Theme, "")) if(!StringsDiffer(CollationBuffers->Theme, ""))
{
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" fprintf(stderr, "Unable to determine which theme to apply to the HTML\n"
"Please set at least one of:\n" "Please set at least one of:\n"
@ -3041,6 +3047,7 @@ HMMLToBuffers(buffers *CollationBuffers, template **BespokeTemplate, char *Filen
); );
HaveErrors = TRUE; HaveErrors = TRUE;
} }
}
if(!HMML.metadata.id) if(!HMML.metadata.id)
{ {
@ -6490,7 +6497,7 @@ main(int ArgC, char **Args)
CopyStringNoFormat(CollationBuffers.ProjectID, sizeof(CollationBuffers.ProjectID), Config.ProjectID); CopyStringNoFormat(CollationBuffers.ProjectID, sizeof(CollationBuffers.ProjectID), Config.ProjectID);
if(!StringsDiffer(Config.Theme, "")) if(!StringsDiffer(Config.Theme, ""))
{ {
CopyStringNoFormat(Config.Theme, sizeof(Config.Theme), Config.ProjectID); Config.Theme = Config.ProjectID;
} }
CopyStringNoFormat(CollationBuffers.Theme, sizeof(CollationBuffers.Theme), Config.Theme); CopyStringNoFormat(CollationBuffers.Theme, sizeof(CollationBuffers.Theme), Config.Theme);
if(StringsDiffer(ProjectInfo[ProjectInfoIndex].FullName, "")) if(StringsDiffer(ProjectInfo[ProjectInfoIndex].FullName, ""))