hmml_to_html.c: Force integration
This commit is contained in:
parent
2059b9367a
commit
53aea540ab
|
@ -1222,6 +1222,8 @@ PrintUsage(char *BinaryLocation, char *DefaultCSSDir, char *DefaultImagesDir, ch
|
|||
"Options:\n"
|
||||
" -c <CSS directory path>\n"
|
||||
" Override default CSS directory (\"%s\")\n"
|
||||
" -f\n"
|
||||
" Force integration with an incomplete template\n"
|
||||
" -i <images directory path>\n"
|
||||
" Override default images directory (\"%s\")\n"
|
||||
" -j <JS directory path>\n"
|
||||
|
@ -1242,7 +1244,16 @@ PrintUsage(char *BinaryLocation, char *DefaultCSSDir, char *DefaultImagesDir, ch
|
|||
"Environment Variables:\n"
|
||||
" CINERA_MODE\n"
|
||||
" =INTEGRATE\n"
|
||||
" Enable integration\n",
|
||||
" Enable integration\n"
|
||||
"\n"
|
||||
"Template:\n"
|
||||
" A complete template shall contain exactly one each of the following tags:\n"
|
||||
" <!-- __CINERA_INCLUDES__ -->\n"
|
||||
" <!-- __CINERA_MENUS__ -->\n"
|
||||
" <!-- __CINERA_PLAYER__ -->\n"
|
||||
" <!-- __CINERA_SCRIPT__ --> (must come after <!-- __CINERA_PLAYER__ -->)\n"
|
||||
" Other available tags include:\n"
|
||||
" <!-- __CINERA_TITLE__ -->\n",
|
||||
BinaryLocation, DefaultCSSDir, DefaultImagesDir, DefaultJSDir, DefaultDefaultMedium, DefaultQuoteDir, DefaultOutLocation, DefaultTemplateLocation);
|
||||
}
|
||||
|
||||
|
@ -1277,6 +1288,9 @@ main(int ArgC, char **Args)
|
|||
|
||||
char *CINERA_MODE = getenv("CINERA_MODE");
|
||||
|
||||
bool DefaultForceIntegration = FALSE;
|
||||
bool ForceIntegration = DefaultForceIntegration;
|
||||
|
||||
if(ArgC < 2)
|
||||
{
|
||||
PrintUsage(Args[0], DefaultCSSDir, DefaultImagesDir, DefaultJSDir, DefaultDefaultMedium, DefaultQuoteDir, DefaultOutLocation, DefaultTemplateLocation);
|
||||
|
@ -1284,13 +1298,16 @@ main(int ArgC, char **Args)
|
|||
}
|
||||
|
||||
char CommandLineArg;
|
||||
while((CommandLineArg = getopt(ArgC, Args, "c:i:j:m:o:q:t:h")) != -1)
|
||||
while((CommandLineArg = getopt(ArgC, Args, "c:fi:j:m:o:q:t:h")) != -1)
|
||||
{
|
||||
switch(CommandLineArg)
|
||||
{
|
||||
case 'c':
|
||||
CSSDir = optarg;
|
||||
break;
|
||||
case 'f':
|
||||
ForceIntegration = TRUE;
|
||||
break;
|
||||
case 'i':
|
||||
ImagesDir = optarg;
|
||||
break;
|
||||
|
@ -1364,6 +1381,8 @@ main(int ArgC, char **Args)
|
|||
QuoteDir[StringLength(QuoteDir) - 1] = '\0';
|
||||
}
|
||||
|
||||
// TODO(matt): Validate template
|
||||
|
||||
// NOTE(matt): Init MemoryArena
|
||||
buffer MemoryArena;
|
||||
MemoryArena.Size = Megabytes(4);
|
||||
|
@ -2736,7 +2755,7 @@ main(int ArgC, char **Args)
|
|||
}
|
||||
else if(!(StringsDifferT(ScriptTag, Template.Ptr, 0)))
|
||||
{
|
||||
if(FoundPlayer == FALSE)
|
||||
if(!ForceIntegration && FoundPlayer == FALSE)
|
||||
{
|
||||
fprintf(stderr, "<!-- __CINERA_SCRIPT__ --> must come after <!-- __CINERA_PLAYER__ -->\n");
|
||||
free(Template.Location); free(Output.Location); hmml_free(&HMML); free(MemoryArena.Location); return 1;
|
||||
|
@ -2773,7 +2792,7 @@ main(int ArgC, char **Args)
|
|||
}
|
||||
}
|
||||
|
||||
if(FoundIncludes && FoundMenus && FoundPlayer && FoundScript)
|
||||
if(ForceIntegration || (FoundIncludes && FoundMenus && FoundPlayer && FoundScript))
|
||||
{
|
||||
FILE *OutFile;
|
||||
if(!(OutFile = fopen(OutIntegratedLocation, "w")))
|
||||
|
|
Loading…
Reference in New Issue