diff --git a/hmml_to_html/hmml_to_html.c b/hmml_to_html/hmml_to_html.c index b34e659..41b2cb6 100644 --- a/hmml_to_html/hmml_to_html.c +++ b/hmml_to_html/hmml_to_html.c @@ -1222,6 +1222,8 @@ PrintUsage(char *BinaryLocation, char *DefaultCSSDir, char *DefaultImagesDir, ch "Options:\n" " -c \n" " Override default CSS directory (\"%s\")\n" + " -f\n" + " Force integration with an incomplete template\n" " -i \n" " Override default images directory (\"%s\")\n" " -j \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" + " \n" + " \n" + " \n" + " (must come after )\n" + " Other available tags include:\n" + " \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, " must come after \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")))