hmml_to_html.c: Enable custom title [#25]
Also track an example template.html
This commit is contained in:
parent
3ff29b39bf
commit
c8c9a19554
|
@ -20,3 +20,6 @@
|
||||||
.category.inventory { border: 1px solid hsl(111, 79%, 26%); background: hsl(111, 79%, 26%); }
|
.category.inventory { border: 1px solid hsl(111, 79%, 26%); background: hsl(111, 79%, 26%); }
|
||||||
.category.hardware { border: 1px solid hsl(284, 94%, 26%); background: hsl(284, 94%, 26%); }
|
.category.hardware { border: 1px solid hsl(284, 94%, 26%); background: hsl(284, 94%, 26%); }
|
||||||
.category.math { border: 1px solid hsl(185, 74%, 26%); background: hsl(185, 74%, 26%); }
|
.category.math { border: 1px solid hsl(185, 74%, 26%); background: hsl(185, 74%, 26%); }
|
||||||
|
.category.platform-layer { border: 1px solid hsl(160, 81%, 26%); background: hsl(160, 81%, 26%); }
|
||||||
|
.category.font { border: 1px solid hsl(13, 87%, 26%); background: hsl(13, 87%, 26%); }
|
||||||
|
.category.input-handling { border: 1px solid hsl(335, 94%, 26%); background: hsl(335, 94%, 26%); }
|
||||||
|
|
|
@ -1196,8 +1196,8 @@ main(int ArgC, char **Args)
|
||||||
|
|
||||||
// NOTE(matt): Tree structure of buffer dependencies
|
// NOTE(matt): Tree structure of buffer dependencies
|
||||||
// Master
|
// Master
|
||||||
// Header
|
// Includes
|
||||||
// Title
|
// Menus
|
||||||
// QuoteMenu
|
// QuoteMenu
|
||||||
// ReferenceMenu
|
// ReferenceMenu
|
||||||
// FilterMenu
|
// FilterMenu
|
||||||
|
@ -1215,9 +1215,9 @@ main(int ArgC, char **Args)
|
||||||
// FilterState
|
// FilterState
|
||||||
|
|
||||||
buffer Master;
|
buffer Master;
|
||||||
buffer Header;
|
buffer Includes;
|
||||||
|
|
||||||
buffer Title;
|
buffer Menus;
|
||||||
buffer QuoteMenu;
|
buffer QuoteMenu;
|
||||||
buffer ReferenceMenu;
|
buffer ReferenceMenu;
|
||||||
buffer FilterMenu;
|
buffer FilterMenu;
|
||||||
|
@ -1260,8 +1260,8 @@ main(int ArgC, char **Args)
|
||||||
{
|
{
|
||||||
// NOTE(matt): Tree structure of "global" buffer dependencies
|
// NOTE(matt): Tree structure of "global" buffer dependencies
|
||||||
// Master
|
// Master
|
||||||
// Header
|
// Includes
|
||||||
// Title
|
// Menus
|
||||||
// QuoteMenu
|
// QuoteMenu
|
||||||
// ReferenceMenu
|
// ReferenceMenu
|
||||||
// FilterMenu
|
// FilterMenu
|
||||||
|
@ -1275,9 +1275,9 @@ main(int ArgC, char **Args)
|
||||||
// FilterState
|
// FilterState
|
||||||
|
|
||||||
ClaimBuffer(MemoryArena, &ClaimedMemory, &Master, "Master", Kilobytes(512));
|
ClaimBuffer(MemoryArena, &ClaimedMemory, &Master, "Master", Kilobytes(512));
|
||||||
ClaimBuffer(MemoryArena, &ClaimedMemory, &Header, "Header", Kilobytes(1));
|
ClaimBuffer(MemoryArena, &ClaimedMemory, &Includes, "Includes", Kilobytes(1));
|
||||||
|
|
||||||
ClaimBuffer(MemoryArena, &ClaimedMemory, &Title, "Title", Kilobytes(16));
|
ClaimBuffer(MemoryArena, &ClaimedMemory, &Menus, "Menus", Kilobytes(16));
|
||||||
ClaimBuffer(MemoryArena, &ClaimedMemory, &QuoteMenu, "QuoteMenu", Kilobytes(16));
|
ClaimBuffer(MemoryArena, &ClaimedMemory, &QuoteMenu, "QuoteMenu", Kilobytes(16));
|
||||||
ClaimBuffer(MemoryArena, &ClaimedMemory, &ReferenceMenu, "ReferenceMenu", Kilobytes(16));
|
ClaimBuffer(MemoryArena, &ClaimedMemory, &ReferenceMenu, "ReferenceMenu", Kilobytes(16));
|
||||||
ClaimBuffer(MemoryArena, &ClaimedMemory, &FilterMenu, "FilterMenu", Kilobytes(16));
|
ClaimBuffer(MemoryArena, &ClaimedMemory, &FilterMenu, "FilterMenu", Kilobytes(16));
|
||||||
|
@ -1309,11 +1309,11 @@ main(int ArgC, char **Args)
|
||||||
int UniqueTopics = 0;
|
int UniqueTopics = 0;
|
||||||
int UniqueMedia = 0;
|
int UniqueMedia = 0;
|
||||||
|
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
" <div class=\"title %s\">\n"
|
" <div class=\"title %s\">\n"
|
||||||
" <span class=\"episode_name\">", HMML.metadata.project);
|
" <span class=\"episode_name\">", HMML.metadata.project);
|
||||||
CopyStringToBufferHTMLSafe(&Title, HMML.metadata.title);
|
CopyStringToBufferHTMLSafe(&Menus, HMML.metadata.title);
|
||||||
CopyStringToBuffer(&Title, "</span>\n"
|
CopyStringToBuffer(&Menus, "</span>\n"
|
||||||
" <span id=\"focus-warn\">⚠ Click here to regain focus ⚠</span>\n");
|
" <span id=\"focus-warn\">⚠ Click here to regain focus ⚠</span>\n");
|
||||||
|
|
||||||
CopyStringToBuffer(&Player,
|
CopyStringToBuffer(&Player,
|
||||||
|
@ -1785,7 +1785,7 @@ Anno->time);
|
||||||
CopyStringToBuffer(&QuoteMenu,
|
CopyStringToBuffer(&QuoteMenu,
|
||||||
" </div>\n"
|
" </div>\n"
|
||||||
" </div>\n");
|
" </div>\n");
|
||||||
CopyBuffer(&Title, &QuoteMenu);
|
CopyBuffer(&Menus, &QuoteMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(HasReferenceMenu)
|
if(HasReferenceMenu)
|
||||||
|
@ -1841,7 +1841,7 @@ ReferencesArray[i].Identifier[j].Timecode);
|
||||||
CopyStringToBuffer(&ReferenceMenu,
|
CopyStringToBuffer(&ReferenceMenu,
|
||||||
" </div>\n"
|
" </div>\n"
|
||||||
" </div>\n");
|
" </div>\n");
|
||||||
CopyBuffer(&Title, &ReferenceMenu);
|
CopyBuffer(&Menus, &ReferenceMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(HasFilterMenu)
|
if(HasFilterMenu)
|
||||||
|
@ -1942,18 +1942,18 @@ CategoryMedium[j][2]
|
||||||
" </div>\n");
|
" </div>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyBuffer(&Title, &FilterMenu);
|
CopyBuffer(&Menus, &FilterMenu);
|
||||||
|
|
||||||
if(HasCreditsMenu)
|
if(HasCreditsMenu)
|
||||||
{
|
{
|
||||||
CopyBuffer(&Title, &CreditsMenu);
|
CopyBuffer(&Menus, &CreditsMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG
|
#if CONFIG
|
||||||
// TODO(matt): Here is where I test ParseConfig
|
// TODO(matt): Here is where I test ParseConfig
|
||||||
ParseConfig(&Config, HMML.metadata.annotator);
|
ParseConfig(&Config, HMML.metadata.annotator);
|
||||||
#endif
|
#endif
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
" <div class=\"help\">\n"
|
" <div class=\"help\">\n"
|
||||||
" <span>?</span>\n"
|
" <span>?</span>\n"
|
||||||
" <div class=\"help_container\">\n"
|
" <div class=\"help_container\">\n"
|
||||||
|
@ -1964,64 +1964,64 @@ CategoryMedium[j][2]
|
||||||
|
|
||||||
if(HasFilterMenu)
|
if(HasFilterMenu)
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
" <span class=\"help_key\">z</span> <span class=\"help_text\">Toggle filter mode</span> <span class=\"help_key\">V</span> <span class=\"help_text\">Revert filter to original state</span>\n");
|
" <span class=\"help_key\">z</span> <span class=\"help_text\">Toggle filter mode</span> <span class=\"help_key\">V</span> <span class=\"help_text\">Revert filter to original state</span>\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
" <span class=\"help_key unavailable\">z</span> <span class=\"help_text unavailable\">Toggle filter mode</span> <span class=\"help_key unavailable\">V</span> <span class=\"help_text unavailable\">Revert filter to original state</span>\n");
|
" <span class=\"help_key unavailable\">z</span> <span class=\"help_text unavailable\">Toggle filter mode</span> <span class=\"help_key unavailable\">V</span> <span class=\"help_text unavailable\">Revert filter to original state</span>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
"\n"
|
"\n"
|
||||||
" <h2>Menu toggling</h2>\n");
|
" <h2>Menu toggling</h2>\n");
|
||||||
|
|
||||||
if(HasQuoteMenu)
|
if(HasQuoteMenu)
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
" <span class=\"help_key\">q</span> <span class=\"help_text\">Quotes</span>\n");
|
" <span class=\"help_key\">q</span> <span class=\"help_text\">Quotes</span>\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
" <span class=\"help_key unavailable\">q</span> <span class=\"help_text unavailable\">Quotes</span>\n");
|
" <span class=\"help_key unavailable\">q</span> <span class=\"help_text unavailable\">Quotes</span>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(HasReferenceMenu)
|
if(HasReferenceMenu)
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
" <span class=\"help_key\">r</span> <span class=\"help_text\">References</span>\n");
|
" <span class=\"help_key\">r</span> <span class=\"help_text\">References</span>\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
" <span class=\"help_key unavailable\">r</span> <span class=\"help_text unavailable\">References</span>\n");
|
" <span class=\"help_key unavailable\">r</span> <span class=\"help_text unavailable\">References</span>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(HasFilterMenu)
|
if(HasFilterMenu)
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
" <span class=\"help_key\">f</span> <span class=\"help_text\">Filter</span>\n");
|
" <span class=\"help_key\">f</span> <span class=\"help_text\">Filter</span>\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
" <span class=\"help_key unavailable\">f</span> <span class=\"help_text unavailable\">Filter</span>\n");
|
" <span class=\"help_key unavailable\">f</span> <span class=\"help_text unavailable\">Filter</span>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(HasCreditsMenu)
|
if(HasCreditsMenu)
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
" <span class=\"help_key\">c</span> <span class=\"help_text\">Credits</span>\n");
|
" <span class=\"help_key\">c</span> <span class=\"help_text\">Credits</span>\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
" <span class=\"help_key unavailable\">c</span> <span class=\"help_text unavailable\">Credits</span>\n");
|
" <span class=\"help_key unavailable\">c</span> <span class=\"help_text unavailable\">Credits</span>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
"\n"
|
"\n"
|
||||||
" <h2>Movement</h2>\n"
|
" <h2>Movement</h2>\n"
|
||||||
" <div class=\"help_paragraph\">\n"
|
" <div class=\"help_paragraph\">\n"
|
||||||
|
@ -2060,86 +2060,86 @@ CategoryMedium[j][2]
|
||||||
|
|
||||||
if(HasQuoteMenu)
|
if(HasQuoteMenu)
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
" <h2>Quotes ");
|
" <h2>Quotes ");
|
||||||
if(HasReferenceMenu)
|
if(HasReferenceMenu)
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title, "and References Menus</h2>\n");
|
CopyStringToBuffer(&Menus, "and References Menus</h2>\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title, "<span class=\"unavailable\">and References</span> Menus</h2>\n");
|
CopyStringToBuffer(&Menus, "<span class=\"unavailable\">and References</span> Menus</h2>\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
" <h2><span class=\"unavailable\">Quotes");
|
" <h2><span class=\"unavailable\">Quotes");
|
||||||
if(HasReferenceMenu)
|
if(HasReferenceMenu)
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title, " and</span> References Menus</h2>\n");
|
CopyStringToBuffer(&Menus, " and</span> References Menus</h2>\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title, " and References Menus</span></h2>\n");
|
CopyStringToBuffer(&Menus, " and References Menus</span></h2>\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(HasQuoteMenu || HasReferenceMenu)
|
if(HasQuoteMenu || HasReferenceMenu)
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
" <span style=\"width: auto\" class=\"help_key\">Enter</span> <span class=\"help_text\">Jump to timecode</span><br>\n");
|
" <span style=\"width: auto\" class=\"help_key\">Enter</span> <span class=\"help_text\">Jump to timecode</span><br>\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
" <span style=\"width: auto\" class=\"help_key unavailable\">Enter</span> <span class=\"help_text unavailable\">Jump to timecode</span><br>\n");
|
" <span style=\"width: auto\" class=\"help_key unavailable\">Enter</span> <span class=\"help_text unavailable\">Jump to timecode</span><br>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(HasReferenceMenu)
|
if(HasReferenceMenu)
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
" <h2>References ");
|
" <h2>References ");
|
||||||
if(HasCreditsMenu)
|
if(HasCreditsMenu)
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title, "and Credits Menus</h2>\n");
|
CopyStringToBuffer(&Menus, "and Credits Menus</h2>\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title, "<span class=\"unavailable\">and Credits</span> Menus</h2>\n");
|
CopyStringToBuffer(&Menus, "<span class=\"unavailable\">and Credits</span> Menus</h2>\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
" <h2><span class=\"unavailable\">References");
|
" <h2><span class=\"unavailable\">References");
|
||||||
if(HasCreditsMenu)
|
if(HasCreditsMenu)
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title, " and</span> Credits Menus</h2>\n");
|
CopyStringToBuffer(&Menus, " and</span> Credits Menus</h2>\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title, " and Credits Menus</span></h2>\n");
|
CopyStringToBuffer(&Menus, " and Credits Menus</span></h2>\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(HasReferenceMenu || HasCreditsMenu)
|
if(HasReferenceMenu || HasCreditsMenu)
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
" <span class=\"help_key\">o</span> <span class=\"help_text\">Open URL (in new tab)</span>\n");
|
" <span class=\"help_key\">o</span> <span class=\"help_text\">Open URL (in new tab)</span>\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
" <span class=\"help_key unavailable\">o</span> <span class=\"help_text unavailable\">Open URL (in new tab)</span>\n");
|
" <span class=\"help_key unavailable\">o</span> <span class=\"help_text unavailable\">Open URL (in new tab)</span>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
if(HasFilterMenu)
|
if(HasFilterMenu)
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
" <h2>Filter Menu</h2>\n"
|
" <h2>Filter Menu</h2>\n"
|
||||||
" <span class=\"help_key\">x</span>, <span style=\"width: auto\" class=\"help_key\">Space</span> <span class=\"help_text\">Toggle category and focus next</span><br>\n"
|
" <span class=\"help_key\">x</span>, <span style=\"width: auto\" class=\"help_key\">Space</span> <span class=\"help_text\">Toggle category and focus next</span><br>\n"
|
||||||
" <span class=\"help_key\">X</span>, <span style=\"width: auto; margin-right: 0px\" class=\"help_key\">Shift</span><span style=\"width: auto\" class=\"help_key\">Space</span> <span class=\"help_text\">Toggle category and focus previous</span><br>\n"
|
" <span class=\"help_key\">X</span>, <span style=\"width: auto; margin-right: 0px\" class=\"help_key\">Shift</span><span style=\"width: auto\" class=\"help_key\">Space</span> <span class=\"help_text\">Toggle category and focus previous</span><br>\n"
|
||||||
|
@ -2147,7 +2147,7 @@ CategoryMedium[j][2]
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
" <h2><span class=\"unavailable\">Filter Menu</span></h2>\n"
|
" <h2><span class=\"unavailable\">Filter Menu</span></h2>\n"
|
||||||
" <span class=\"help_key unavailable\">x</span>, <span style=\"width: auto\" class=\"help_key unavailable\">Space</span> <span class=\"help_text unavailable\">Toggle category and focus next</span><br>\n"
|
" <span class=\"help_key unavailable\">x</span>, <span style=\"width: auto\" class=\"help_key unavailable\">Space</span> <span class=\"help_text unavailable\">Toggle category and focus next</span><br>\n"
|
||||||
" <span class=\"help_key unavailable\">X</span>, <span style=\"width: auto; margin-right: 0px\" class=\"help_key unavailable\">Shift</span><span style=\"width: auto\" class=\"help_key unavailable\">Space</span> <span class=\"help_text unavailable\">Toggle category and focus previous</span><br>\n"
|
" <span class=\"help_key unavailable\">X</span>, <span style=\"width: auto; margin-right: 0px\" class=\"help_key unavailable\">Shift</span><span style=\"width: auto\" class=\"help_key unavailable\">Space</span> <span class=\"help_text unavailable\">Toggle category and focus previous</span><br>\n"
|
||||||
|
@ -2156,18 +2156,18 @@ CategoryMedium[j][2]
|
||||||
|
|
||||||
if(HasCreditsMenu)
|
if(HasCreditsMenu)
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
" <h2>Credits Menu</h2>\n"
|
" <h2>Credits Menu</h2>\n"
|
||||||
" <span style=\"width: auto\" class=\"help_key\">Enter</span> <span class=\"help_text\">Open URL (in new tab)</span><br>\n");
|
" <span style=\"width: auto\" class=\"help_key\">Enter</span> <span class=\"help_text\">Open URL (in new tab)</span><br>\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
" <h2><span class=\"unavailable\">Credits Menu</span></h2>\n"
|
" <h2><span class=\"unavailable\">Credits Menu</span></h2>\n"
|
||||||
" <span style=\"width: auto\" class=\"help_key unavailable\">Enter</span> <span class=\"help_text unavailable\">Open URL (in new tab)</span><br>\n");
|
" <span style=\"width: auto\" class=\"help_key unavailable\">Enter</span> <span class=\"help_text unavailable\">Open URL (in new tab)</span><br>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyStringToBuffer(&Title,
|
CopyStringToBuffer(&Menus,
|
||||||
" </div>\n"
|
" </div>\n"
|
||||||
" </div>\n"
|
" </div>\n"
|
||||||
|
|
||||||
|
@ -2178,11 +2178,8 @@ CategoryMedium[j][2]
|
||||||
" </div>");
|
" </div>");
|
||||||
|
|
||||||
// TODO(matt): Maybe do something about indentation levels
|
// TODO(matt): Maybe do something about indentation levels
|
||||||
CopyStringToBuffer(&Header,
|
CopyStringToBuffer(&Includes,
|
||||||
"<meta charset=\"UTF-8\">\n"
|
"<meta charset=\"UTF-8\">\n"
|
||||||
" <title>");
|
|
||||||
CopyStringToBufferHTMLSafe(&Header, HMML.metadata.title);
|
|
||||||
CopyStringToBuffer(&Header, "</title>\n" // TODO(matt): Add the full name of the project, parsed from a config
|
|
||||||
"\n"
|
"\n"
|
||||||
" <!-- Load the player -->\n"
|
" <!-- Load the player -->\n"
|
||||||
" <script type=\"text/javascript\" src=\"cinera.js\"></script>\n"
|
" <script type=\"text/javascript\" src=\"cinera.js\"></script>\n"
|
||||||
|
@ -2402,23 +2399,28 @@ HMML.metadata.project);
|
||||||
{
|
{
|
||||||
perror(Args[0]); hmml_free(&HMML); free(MemoryArena); return 1;
|
perror(Args[0]); hmml_free(&HMML); free(MemoryArena); return 1;
|
||||||
}
|
}
|
||||||
|
Template.Ptr = Template.Location;
|
||||||
fread(Template.Location, Template.Size, 1, TemplateFile);
|
fread(Template.Location, Template.Size, 1, TemplateFile);
|
||||||
fclose(TemplateFile);
|
fclose(TemplateFile);
|
||||||
|
|
||||||
buffer Output;
|
buffer Output;
|
||||||
|
Output.Size = Template.Size + Master.Size;
|
||||||
Output.ID = "Output";
|
Output.ID = "Output";
|
||||||
if(!(Output.Location = malloc(Template.Size + Master.Size)))
|
if(!(Output.Location = malloc(Output.Size)))
|
||||||
{
|
{
|
||||||
perror(Args[0]); free(Template.Location); hmml_free(&HMML); free(MemoryArena); return 1;
|
perror(Args[0]); free(Template.Location); hmml_free(&HMML); free(MemoryArena); return 1;
|
||||||
}
|
}
|
||||||
|
Output.Ptr = Output.Location;
|
||||||
|
|
||||||
char *HeaderTag = "__CINERA_HEADER__";
|
char *IncludesTag = "__CINERA_INCLUDES__";
|
||||||
char *TitleTag = "__CINERA_TITLE__";
|
char *TitleTag = "__CINERA_TITLE__";
|
||||||
|
char *MenusTag = "__CINERA_MENUS__";
|
||||||
char *PlayerTag = "__CINERA_PLAYER__";
|
char *PlayerTag = "__CINERA_PLAYER__";
|
||||||
char *ScriptTag = "__CINERA_SCRIPT__";
|
char *ScriptTag = "__CINERA_SCRIPT__";
|
||||||
|
|
||||||
bool FoundHeader = FALSE;
|
bool FoundIncludes = FALSE;
|
||||||
bool FoundTitle = FALSE;
|
bool FoundTitle = FALSE;
|
||||||
|
bool FoundMenus = FALSE;
|
||||||
bool FoundPlayer = FALSE;
|
bool FoundPlayer = FALSE;
|
||||||
bool FoundScript = FALSE;
|
bool FoundScript = FALSE;
|
||||||
|
|
||||||
|
@ -2429,16 +2431,16 @@ HMML.metadata.project);
|
||||||
char *CommentStart = &Output.Ptr[-1];
|
char *CommentStart = &Output.Ptr[-1];
|
||||||
while(Template.Ptr - Template.Location < Template.Size)
|
while(Template.Ptr - Template.Location < Template.Size)
|
||||||
{
|
{
|
||||||
if(!(StringsDifferT(HeaderTag, Template.Ptr, 0)))
|
if(!(StringsDifferT(IncludesTag, Template.Ptr, 0)))
|
||||||
{
|
{
|
||||||
if(FoundHeader == TRUE)
|
if(FoundIncludes == TRUE)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Template contains more than one <!-- __CINERA_HEADER__ --> tag\n");
|
fprintf(stderr, "Template contains more than one <!-- __CINERA_INCLUDES__ --> tag\n");
|
||||||
free(Template.Location); free(Output.Location); hmml_free(&HMML); free(MemoryArena); return 1;
|
free(Template.Location); free(Output.Location); hmml_free(&HMML); free(MemoryArena); return 1;
|
||||||
}
|
}
|
||||||
FoundHeader = TRUE;
|
FoundIncludes = TRUE;
|
||||||
Output.Ptr = CommentStart;
|
Output.Ptr = CommentStart;
|
||||||
CopyBuffer(&Output, &Header);
|
CopyBuffer(&Output, &Includes);
|
||||||
while(Template.Ptr - Template.Location < Template.Size)
|
while(Template.Ptr - Template.Location < Template.Size)
|
||||||
{
|
{
|
||||||
if(!StringsDifferT("-->", Template.Ptr, 0))
|
if(!StringsDifferT("-->", Template.Ptr, 0))
|
||||||
|
@ -2450,6 +2452,7 @@ HMML.metadata.project);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(!(StringsDifferT(TitleTag, Template.Ptr, 0)))
|
else if(!(StringsDifferT(TitleTag, Template.Ptr, 0)))
|
||||||
{
|
{
|
||||||
if(FoundTitle == TRUE)
|
if(FoundTitle == TRUE)
|
||||||
|
@ -2457,20 +2460,35 @@ HMML.metadata.project);
|
||||||
fprintf(stderr, "Template contains more than one <!-- __CINERA_TITLE__ --> tag\n");
|
fprintf(stderr, "Template contains more than one <!-- __CINERA_TITLE__ --> tag\n");
|
||||||
free(Template.Location); free(Output.Location); hmml_free(&HMML); free(MemoryArena); return 1;
|
free(Template.Location); free(Output.Location); hmml_free(&HMML); free(MemoryArena); return 1;
|
||||||
}
|
}
|
||||||
/* TODO(matt): Allow setting a Title format, e.g.
|
|
||||||
<-- __CINERA_TITLE__ "%s - HandmadeDev" -->
|
|
||||||
Where %s is replaced with the HMML.metadata.title
|
|
||||||
Perhaps it would be saner to do this in the config file
|
|
||||||
*/
|
|
||||||
FoundTitle = TRUE;
|
FoundTitle = TRUE;
|
||||||
Output.Ptr = CommentStart;
|
Output.Ptr = CommentStart;
|
||||||
CopyBuffer(&Output, &Title);
|
CopyStringToBuffer(&Output, HMML.metadata.title);
|
||||||
|
while(Template.Ptr - Template.Location < Template.Size)
|
||||||
|
{
|
||||||
|
if(!StringsDifferT("-->", Template.Ptr, 0))
|
||||||
|
{
|
||||||
|
Template.Ptr += StringLength("-->");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
++Template.Ptr;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if(!(StringsDifferT(MenusTag, Template.Ptr, 0)))
|
||||||
|
{
|
||||||
|
if(FoundMenus == TRUE)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Template contains more than one <!-- __CINERA_MENUS__ --> tag\n");
|
||||||
|
free(Template.Location); free(Output.Location); hmml_free(&HMML); free(MemoryArena); return 1;
|
||||||
|
}
|
||||||
|
FoundMenus = TRUE;
|
||||||
|
Output.Ptr = CommentStart;
|
||||||
|
CopyBuffer(&Output, &Menus);
|
||||||
while(Template.Ptr - Template.Location < Template.Size)
|
while(Template.Ptr - Template.Location < Template.Size)
|
||||||
{
|
{
|
||||||
if(!StringsDifferT("-->", Template.Ptr, 0))
|
if(!StringsDifferT("-->", Template.Ptr, 0))
|
||||||
{
|
{
|
||||||
Template.Ptr += StringLength("-->");
|
Template.Ptr += StringLength("-->");
|
||||||
printf("%c%c%c\n", Template.Ptr[-1], Template.Ptr[0], Template.Ptr[1]);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++Template.Ptr;
|
++Template.Ptr;
|
||||||
|
@ -2532,7 +2550,7 @@ HMML.metadata.project);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(FoundHeader && FoundTitle && FoundPlayer && FoundScript)
|
if(FoundIncludes && FoundMenus && FoundPlayer && FoundScript)
|
||||||
{
|
{
|
||||||
FILE *OutFile;
|
FILE *OutFile;
|
||||||
if(!(OutFile = fopen("out_integrated.html", "w")))
|
if(!(OutFile = fopen("out_integrated.html", "w")))
|
||||||
|
@ -2545,8 +2563,8 @@ HMML.metadata.project);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Template is missing necessary tags:\n");
|
fprintf(stderr, "Template is missing necessary tags:\n");
|
||||||
if(!FoundHeader) { fprintf(stderr, " <!-- __CINERA_HEADER__ -->\n"); }
|
if(!FoundIncludes) { fprintf(stderr, " <!-- __CINERA_INCLUDES__ -->\n"); }
|
||||||
if(!FoundTitle) { fprintf(stderr, " <!-- __CINERA_TITLE__ -->\n"); }
|
if(!FoundMenus) { fprintf(stderr, " <!-- __CINERA_MENUS__ -->\n"); }
|
||||||
if(!FoundPlayer) { fprintf(stderr, " <!-- __CINERA_PLAYER__ -->\n"); }
|
if(!FoundPlayer) { fprintf(stderr, " <!-- __CINERA_PLAYER__ -->\n"); }
|
||||||
if(!FoundScript) { fprintf(stderr, " <!-- __CINERA_SCRIPT__ -->\n"); }
|
if(!FoundScript) { fprintf(stderr, " <!-- __CINERA_SCRIPT__ -->\n"); }
|
||||||
free(Template.Location); free(Output.Location); hmml_free(&HMML); free(MemoryArena); return 1;
|
free(Template.Location); free(Output.Location); hmml_free(&HMML); free(MemoryArena); return 1;
|
||||||
|
@ -2563,12 +2581,12 @@ HMML.metadata.project);
|
||||||
" <head>\n");
|
" <head>\n");
|
||||||
|
|
||||||
//NOTE(matt): Here is where we do all our CopyBuffer() calls
|
//NOTE(matt): Here is where we do all our CopyBuffer() calls
|
||||||
CopyBuffer(&Master, &Header);
|
CopyBuffer(&Master, &Includes);
|
||||||
CopyStringToBuffer(&Master,
|
CopyStringToBuffer(&Master,
|
||||||
"\n"
|
"\n"
|
||||||
" </head>\n"
|
" </head>\n"
|
||||||
" <body>\n");
|
" <body>\n");
|
||||||
CopyBuffer(&Master, &Title);
|
CopyBuffer(&Master, &Menus);
|
||||||
CopyStringToBuffer(&Master, "\n");
|
CopyStringToBuffer(&Master, "\n");
|
||||||
CopyBuffer(&Master, &Player);
|
CopyBuffer(&Master, &Player);
|
||||||
CopyStringToBuffer(&Master, "\n");
|
CopyStringToBuffer(&Master, "\n");
|
||||||
|
@ -2603,8 +2621,8 @@ HMML.metadata.project);
|
||||||
// FilterMenu
|
// FilterMenu
|
||||||
// ReferenceMenu
|
// ReferenceMenu
|
||||||
// QuoteMenu
|
// QuoteMenu
|
||||||
// Title
|
// Menus
|
||||||
// Header
|
// Includes
|
||||||
// Master
|
// Master
|
||||||
|
|
||||||
DeclaimBuffer(&FilterState, &ClaimedMemory);
|
DeclaimBuffer(&FilterState, &ClaimedMemory);
|
||||||
|
@ -2621,9 +2639,9 @@ HMML.metadata.project);
|
||||||
DeclaimBuffer(&FilterMenu, &ClaimedMemory);
|
DeclaimBuffer(&FilterMenu, &ClaimedMemory);
|
||||||
DeclaimBuffer(&ReferenceMenu, &ClaimedMemory);
|
DeclaimBuffer(&ReferenceMenu, &ClaimedMemory);
|
||||||
DeclaimBuffer(&QuoteMenu, &ClaimedMemory);
|
DeclaimBuffer(&QuoteMenu, &ClaimedMemory);
|
||||||
DeclaimBuffer(&Title, &ClaimedMemory);
|
DeclaimBuffer(&Menus, &ClaimedMemory);
|
||||||
|
|
||||||
DeclaimBuffer(&Header, &ClaimedMemory);
|
DeclaimBuffer(&Includes, &ClaimedMemory);
|
||||||
DeclaimBuffer(&Master, &ClaimedMemory);
|
DeclaimBuffer(&Master, &ClaimedMemory);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Preceding Text - <!-- __CINERA_TITLE__ --> - Following Text</title>
|
||||||
|
<!-- __CINERA_INCLUDES__ -->
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- __CINERA_MENUS__ -->
|
||||||
|
<!-- __CINERA_PLAYER__ -->
|
||||||
|
<!-- __CINERA_SCRIPT__ -->
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue