diff --git a/README.md b/README.md index dd7e0a9..991dc99 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,7 @@ anything invalid, `cinera` will tell you what's wrong Valid tags: +- `` _the project's full name_ - `` _the day / episode name, intended to be used inside your own `` element, but may be used wherever and as many times as you want on your page_ @@ -114,6 +115,9 @@ Valid tags: Force integration with an incomplete template -p <project ID> Set the project ID, corresponding to the "project" field in the HMML files + -s <style> + Set the style / theme, corresponding to a cinera__*.css file + This is equal to the "project" field in the HMML files by default -l <n> Override default log level (0), where n is from 0 (terse) to 7 (verbose) -m <default medium> diff --git a/cinera/cinera.c b/cinera/cinera.c index a27a67d..e17809f 100644 --- a/cinera/cinera.c +++ b/cinera/cinera.c @@ -14,7 +14,7 @@ typedef struct version CINERA_APP_VERSION = { .Major = 0, .Minor = 5, - .Patch = 4 + .Patch = 5 }; #define CINERA_DB_VERSION 1 @@ -109,6 +109,7 @@ typedef struct char *JSDir; // Relative to RootDir and RootURL char *TemplateIndexLocation; // Relative to RootDir and RootURL char *TemplatePlayerLocation; // Relative to RootDir and RootURL + char *Theme; char CacheDir[256]; char *DefaultMedium; char *OutLocation; @@ -156,6 +157,7 @@ enum TAG_SCRIPT, // Anywhere + TAG_PROJECT, TAG_TITLE } template_tags; @@ -171,6 +173,7 @@ tag Tags[] = { { TAG_MENUS, "__CINERA_MENUS__" }, { TAG_PLAYER, "__CINERA_PLAYER__" }, { TAG_SCRIPT, "__CINERA_SCRIPT__" }, + { TAG_PROJECT, "__CINERA_PROJECT__" }, { TAG_TITLE, "__CINERA_TITLE__" }, }; @@ -198,13 +201,14 @@ typedef struct { buffer IncludesIndex; buffer Search; - buffer Index; + buffer Index; // NOTE(matt): This buffer is malloc'd separately, rather than claimed from the memory_arena buffer ScriptIndex; buffer IncludesPlayer; buffer Menus; buffer Player; buffer ScriptPlayer; char Title[256]; + char ProjectName[32]; } buffers; // TODO(matt): Consider putting the ref_info and quote_info into linked lists on the heap, just to avoid all the hardcoded sizes @@ -260,6 +264,7 @@ credential_info Credentials[] = { "/a_waterman", "Andrew Waterman", "https://www.linkedin.com/in/andrew-waterman-76805788", "", ""}, { "/y_lee", "Yunsup Lee", "https://www.linkedin.com/in/yunsup-lee-385b692b/", "", ""}, { "AndrewJDR", "Andrew Johnson", "", "", ""}, + { "AsafGartner", "Asaf Gartner", "", "", ""}, { "BretHudson", "Bret Hudson", "http://www.brethudson.com/", "cinera_sprite_patreon.png", "https://www.patreon.com/indieFunction"}, { "ChronalDragon", "Andrew Chronister", "http://chronal.net/", "", ""}, { "Kelimion", "Jeroen van Rijn", "https://handmade.network/home", "", ""}, @@ -282,7 +287,7 @@ credential_info Credentials[] = { "insofaras", "Alex Baines", "https://abaines.me.uk/", "", ""}, { "jacebennett", "Jace Bennett", "", "", ""}, { "jon", "Jonathan Blow", "http://the-witness.net/news/", "", ""}, - { "jpike", "jpike", "", "", ""}, + { "jpike", "Jacob Pike", "", "", ""}, { "martincohen", "Martin Cohen", "http://blog.coh.io/", "", ""}, { "miotatsu", "Mio Iwakura", "http://riscy.tv/", "cinera_sprite_patreon.png", "https://patreon.com/miotatsu"}, { "nothings", "Sean Barrett", "https://nothings.org/", "", ""}, @@ -293,7 +298,7 @@ credential_info Credentials[] = { "schme", "Kasper Sauramo", "", "", ""}, { "sssmcgrath", "Shawn McGrath", "http://www.dyadgame.com/", "", ""}, { "thehappiecat", "Anne", "https://www.youtube.com/c/TheHappieCat", "cinera_sprite_patreon.png", "https://www.patreon.com/thehappiecat"}, - { "theinternetftw", "theinternetftw", "", "", ""}, + { "theinternetftw", "Ben Craddock", "", "", ""}, { "wheatdog", "Tim Liou", "http://stringbulbs.com/", "", ""}, { "williamchyr", "William Chyr", "http://williamchyr.com/", "", ""}, { "wonchun", "Won Chun", "https://twitter.com/won3d", "", ""}, @@ -342,10 +347,19 @@ typedef struct project_info ProjectInfo[] = { - { "hero", "Handmade Hero", "Day", NS_LINEAR }, - { "hmdshow", "HandmadeDev Show", "", NS_SEASONAL }, - { "obbg", "Open Block Building Game", "Episode", NS_LINEAR }, + { "book", "Book Club", "Day", NS_LINEAR }, { "riscy", "RISCY BUSINESS", "Day", NS_LINEAR }, + + { "chat", "Handmade Chat", "Day", NS_LINEAR }, + { "code", "Handmade Hero", "Day", NS_LINEAR }, + { "intro-to-c", "Intro to C on Windows", "Day", NS_LINEAR }, + { "misc", "Handmade Miscellany", "", NS_LINEAR }, + { "ray", "Handmade Ray", "Day", NS_LINEAR }, + + { "hmdshow", "HandmadeDev Show", "", NS_SEASONAL }, + + { "obbg", "Open Block Building Game", "Episode", NS_LINEAR }, + { "sysadmin", "SysAdmin", "Session", NS_LINEAR }, }; @@ -717,7 +731,14 @@ ClaimTemplate(template **Template, char *Location) (*Template)->Buffer.Location = MemoryArena.Ptr + sizeof(template); (*Template)->Buffer.Ptr = (*Template)->Buffer.Location; (*Template)->Buffer.ID = Location; - CopyString((*Template)->Metadata.Filename, "%s/%s", Config.RootDir, Location); + if(Location[0] != '/') + { + CopyString((*Template)->Metadata.Filename, "%s/%s", Config.RootDir, Location); + } + else + { + CopyString((*Template)->Metadata.Filename, "%s", Location); + } FILE *File; if(!(File = fopen((*Template)->Metadata.Filename, "r"))) @@ -934,18 +955,9 @@ SearchCredentials(buffer *CreditsMenu, bool *HasCreditsMenu, char *Person, char } if(StringsDiffer(Config.ImagesDir, "")) { - Ptr += CopyString(Ptr, "%s/", Config.ImagesDir); + CopyString(Ptr, "%s/", Config.ImagesDir); } - if(Config.Edition == EDITION_PROJECT) - { - if(!StringsDiffer(Config.RootURL, "")) - { - char Temp[1027]; - CopyString(Temp, "../%s", URLPrefix); - CopyString(URLPrefix, Temp); - } - } CopyStringToBuffer(CreditsMenu, " <a class=\"support\" href=\"%s\" target=\"_blank\"><div class=\"support_icon\" style=\"background-image: url(%s%s);\"></div></a>\n", Credentials[CredentialIndex].SupportURL, @@ -1618,6 +1630,9 @@ PrintUsage(char *BinaryLocation, config *DefaultConfig) " Force integration with an incomplete template\n" " -p <project ID>\n" " Set the project ID, corresponding to the \"project\" field in the HMML files\n" + " -s <style>\n" + " Set the style / theme, corresponding to a cinera__*.css file\n" + " This is equal to the \"project\" field in the HMML files by default\n" " -l <n>\n" " Override default log level (%d), where n is from 0 (terse) to 7 (verbose)\n" " -m <default medium>\n" @@ -1636,12 +1651,18 @@ PrintUsage(char *BinaryLocation, config *DefaultConfig) " Enable integration\n" "\n" "Template:\n" - " A complete template shall contain exactly one each of the following tags:\n" - " <!-- __CINERA_INCLUDES__ -->\n" + " A complete index template shall contain exactly one each of the following tags:\n" + " <!-- __CINERA_INCLUDES__ --> - to put inside your own <head></head>\n" + " <!-- __CINERA_INDEX__ -->\n" + "\n" + " A complete player template shall contain exactly one each of the following tags:\n" + " <!-- __CINERA_INCLUDES__ --> - to put inside your own <head></head>\n" " <!-- __CINERA_MENUS__ -->\n" " <!-- __CINERA_PLAYER__ -->\n" " <!-- __CINERA_SCRIPT__ --> (must come after <!-- __CINERA_PLAYER__ -->)\n" - " Other available tags include:\n" + "\n" + " Other available tags:\n" + " <!-- __CINERA_PROJECT__ -->\n" " <!-- __CINERA_TITLE__ -->\n" "\n" "HMML Specification:\n" @@ -1777,6 +1798,13 @@ Here: Previous = (*Template)->Buffer.Ptr; FoundScript = TRUE; goto Here; + case TAG_PROJECT: + (*Template)->Metadata.Tag[(*Template)->Metadata.TagCount].Offset = CommentStart - Previous; + (*Template)->Metadata.Tag[(*Template)->Metadata.TagCount].TagCode = TAG_PROJECT; + (*Template)->Metadata.TagCount++; + DepartComment(&(*Template)->Buffer); + Previous = (*Template)->Buffer.Ptr; + goto Here; case TAG_TITLE: (*Template)->Metadata.Tag[(*Template)->Metadata.TagCount].Offset = CommentStart - Previous; (*Template)->Metadata.Tag[(*Template)->Metadata.TagCount].TagCode = TAG_TITLE; @@ -1861,6 +1889,16 @@ HMMLToBuffers(buffers *CollationBuffers, char *Filename) if(HMML.well_formed) { CopyString(CollationBuffers->Title, HMML.metadata.title); + int ProjectIndex; + for(ProjectIndex = 0; ProjectIndex < ArrayCount(ProjectInfo); ++ProjectIndex) + { + if(!StringsDiffer(ProjectInfo[ProjectIndex].ProjectID, Config.ProjectID)) + { + CopyString(CollationBuffers->ProjectName, ProjectInfo[ProjectIndex].FullName); + break; + } + } + #if DEBUG printf( "================================================================================\n" @@ -1898,8 +1936,8 @@ HMMLToBuffers(buffers *CollationBuffers, char *Filename) buffer FilterState; - if(ClaimBuffer(&QuoteMenu, "QuoteMenu", Kilobytes(16)) == RC_ARENA_FULL) { hmml_free(&HMML); return RC_ARENA_FULL; }; - if(ClaimBuffer(&ReferenceMenu, "ReferenceMenu", Kilobytes(16)) == RC_ARENA_FULL) { hmml_free(&HMML); return RC_ARENA_FULL; }; + if(ClaimBuffer(&QuoteMenu, "QuoteMenu", Kilobytes(32)) == RC_ARENA_FULL) { hmml_free(&HMML); return RC_ARENA_FULL; }; + if(ClaimBuffer(&ReferenceMenu, "ReferenceMenu", Kilobytes(32)) == RC_ARENA_FULL) { hmml_free(&HMML); return RC_ARENA_FULL; }; if(ClaimBuffer(&FilterMenu, "FilterMenu", Kilobytes(16)) == RC_ARENA_FULL) { hmml_free(&HMML); return RC_ARENA_FULL; }; if(ClaimBuffer(&FilterTopics, "FilterTopics", Kilobytes(8)) == RC_ARENA_FULL) { hmml_free(&HMML); return RC_ARENA_FULL; }; if(ClaimBuffer(&FilterMedia, "FilterMedia", Kilobytes(8)) == RC_ARENA_FULL) { hmml_free(&HMML); return RC_ARENA_FULL; }; @@ -1921,7 +1959,7 @@ HMMLToBuffers(buffers *CollationBuffers, char *Filename) CopyStringToBuffer(&CollationBuffers->Menus, " <div class=\"title %s\">\n" - " <span class=\"episode_name\">", HMML.metadata.project); + " <span class=\"episode_name\">", StringsDiffer(Config.Theme, "") ? Config.Theme : HMML.metadata.project); CopyStringToBufferHTMLSafe(&CollationBuffers->Menus, HMML.metadata.title); CopyStringToBuffer(&CollationBuffers->Menus, "</span>\n" " <span id=\"focus-warn\">⚠ Click here to regain focus ⚠</span>\n"); @@ -1929,7 +1967,7 @@ HMMLToBuffers(buffers *CollationBuffers, char *Filename) CopyStringToBuffer(&CollationBuffers->Player, " <div class=\"player_container\">\n" " <div class=\"video_container\" data-videoId=\"%s\"></div>\n" - " <div class=\"markers_container %s\">\n", HMML.metadata.id, HMML.metadata.project); + " <div class=\"markers_container %s\">\n", HMML.metadata.id, StringsDiffer(Config.Theme, "") ? Config.Theme : HMML.metadata.project); int CreditsErrorCode = BuildCredits(&CreditsMenu, &HasCreditsMenu, &HMML.metadata); if(CreditsErrorCode) @@ -2573,7 +2611,6 @@ AppendedIdentifier: char URLPrefix[1024] = { 0 }; char *Ptr = URLPrefix; - if(StringsDiffer(Config.RootURL, "")) { Ptr += CopyString(Ptr, "%s/", Config.RootURL); @@ -2584,21 +2621,12 @@ AppendedIdentifier: { Ptr += CopyString(Ptr, "../"); } - if(StringsDiffer(Config.ImagesDir, "")) - { - Ptr += CopyString(Ptr, "%s/", Config.ImagesDir); - } + } + if(StringsDiffer(Config.ImagesDir, "")) + { + CopyString(Ptr, "%s/", Config.ImagesDir); } - if(Config.Edition == EDITION_PROJECT) - { - if(!StringsDiffer(Config.RootURL, "")) - { - char Temp[1027]; - CopyString(Temp, "../%s", URLPrefix); - CopyString(URLPrefix, Temp); - } - } CopyStringToBuffer(&FilterMenu, " <div class=\"menu filter\">\n" " <span><img src=\"%scinera_icon_filter.png\"></span>\n" @@ -2976,7 +3004,7 @@ AppendedIdentifier: " <meta charset=\"UTF-8\">\n" " <meta name=\"generator\" content=\"Cinera %d.%d.%d\">\n", URLPrefix, - URLPrefix, HMML.metadata.project, + URLPrefix, StringsDiffer(Config.Theme, "") ? Config.Theme : HMML.metadata.project, URLPrefix, CINERA_APP_VERSION.Major, @@ -3001,7 +3029,7 @@ AppendedIdentifier: " <meta charset=\"UTF-8\">\n" " <meta name=\"generator\" content=\"Cinera %d.%d.%d\">\n", URLPrefix, - URLPrefix, HMML.metadata.project, + URLPrefix, StringsDiffer(Config.Theme, "") ? Config.Theme : HMML.metadata.project, URLPrefix, CINERA_APP_VERSION.Major, @@ -3033,20 +3061,22 @@ AppendedIdentifier: CopyStringToBuffer(&CollationBuffers->IncludesPlayer, "\">\n\n"); } - if(Config.Edition == EDITION_PROJECT) + Ptr = URLPrefix; + if(StringsDiffer(Config.RootURL, "")) { - if(!StringsDiffer(Config.RootURL, "")) + Ptr += StringLength(Config.RootURL) + 1; + } + else + { + if(Config.Edition == EDITION_PROJECT) { - Ptr = URLPrefix; - Ptr += StringLength("../../"); - Ptr += CopyString(Ptr, "%s", Config.JSDir); - if(StringsDiffer(Config.JSDir, "")) - { - Ptr[0] = '/'; - Ptr[1] = '\0'; - } + Ptr += StringLength("../"); } } + if(StringsDiffer(Config.JSDir, "")) + { + CopyString(Ptr, "%s/", Config.JSDir); + } CopyStringToBuffer(&CollationBuffers->IncludesPlayer, " <script type=\"text/javascript\" src=\"%scinera_player_pre.js\"></script>\n", @@ -3143,6 +3173,9 @@ BuffersToHTML(buffers *CollationBuffers, template *Template, char *OutputPath, i case TAG_TITLE: CopyStringToBuffer(&Output, CollationBuffers->Title); break; + case TAG_PROJECT: + CopyStringToBuffer(&Output, CollationBuffers->ProjectName); + break; case TAG_INDEX: CopyBuffer(&Output, &CollationBuffers->Index); break; @@ -3427,7 +3460,7 @@ InsertIntoIndex(buffers *CollationBuffers, char *BaseFilename) break; } - Index.File.Buffer.ID = "Index"; + Index.File.Buffer.ID = "IndexFile"; CopyString(Index.File.Path, "%s/%s.index", Config.BaseDir, Config.ProjectID); int IndexFileReadCode = ReadFileIntoBuffer(&Index.File, 0); switch(IndexFileReadCode) @@ -3677,7 +3710,6 @@ DeleteFromIndex(char *BaseFilename) int IndexToBuffer(buffers *CollationBuffers) { - RewindBuffer(&CollationBuffers->Index); // TODO(matt): Consider parsing the index into a linked list, or do something to save us having to iterate through the index // file multiple times @@ -3686,7 +3718,7 @@ IndexToBuffer(buffers *CollationBuffers) CopyString(Index.Metadata.Path, "%s/%s.metadata", Config.BaseDir, Config.ProjectID); int IndexMetadataFileReadCode = ReadFileIntoBuffer(&Index.Metadata, 0); - Index.File.Buffer.ID = "Index"; + Index.File.Buffer.ID = "IndexFile"; CopyString(Index.File.Path, "%s/%s.index", Config.BaseDir, Config.ProjectID); int IndexFileReadCode = ReadFileIntoBuffer(&Index.File, 0); @@ -3697,21 +3729,6 @@ IndexToBuffer(buffers *CollationBuffers) Index.File.Buffer.Ptr += StringLength("---\n"); char *IndexEntryStart = Index.File.Buffer.Ptr; - CopyStringToBuffer(&CollationBuffers->Index, - "<div class=\"queryContainer\">\n" - " <label for=\"query\">Query:</label>\n" - " <div class=\"inputContainer\">\n" - " <input type=\"text\" id=\"query\" autofocus=\"\">\n" - " <div class=\"spinner\">\n" - " Downloading data...\n" - " </div>\n" - " </div>\n" - " </div>\n" - " <div id=\"resultsSummary\">Found: 0 episodes, 0 markers, 0h 0m 0s total.</div>\n" - " <div id=\"results\"></div>\n" - "\n" - " <dl id=\"cineraIndex\" class=\"riscy\">\n"); - bool ProjectFound = FALSE; int ProjectIndex; for(ProjectIndex = 0; ProjectIndex < ArrayCount(ProjectInfo); ++ProjectIndex) @@ -3729,6 +3746,61 @@ IndexToBuffer(buffers *CollationBuffers) return RC_ERROR_PROJECT; } + char queryContainer[512]; + CopyString(queryContainer, + "<div class=\"queryContainer %s\">\n" + " <label for=\"query\">Query:</label>\n" + " <div class=\"inputContainer\">\n" + " <input type=\"text\" id=\"query\" autofocus=\"\">\n" + " <div class=\"spinner\">\n" + " Downloading data...\n" + " </div>\n" + " </div>\n" + " </div>\n" + " <div id=\"resultsSummary\">Found: 0 episodes, 0 markers, 0h 0m 0s total.</div>\n" + " <div id=\"results\"></div>\n" + "\n" + " <dl id=\"cineraIndex\" class=\"%s\">\n", + StringsDiffer(Config.Theme, "") ? Config.Theme : Config.ProjectID, + StringsDiffer(Config.Theme, "") ? Config.Theme : Config.ProjectID); + + char URLPrefix[1024] = { 0 }; + char *Ptr = URLPrefix; + if(StringsDiffer(Config.RootURL, "")) + { + Ptr += CopyString(Ptr, "%s/", Config.RootURL); + } + else + { + Ptr += CopyString(Ptr, "../"); + } + if(StringsDiffer(Config.JSDir, "")) + { + Ptr += CopyString(Ptr, "%s/", Config.JSDir); + } + + char Script[512 + StringLength(URLPrefix) + (StringLength(Config.ProjectID) * 2)]; + CopyString(Script, " </dl>\n" + " <script type=\"text/javascript\">\n" + " var indexLocation = \"%s.index\";\n" + " var projectID = \"%s\";\n" + " </script>\n" + " <script type=\"text/javascript\" src=\"%scinera_search.js\"></script>\n", + Config.ProjectID, + StringsDiffer(Config.Theme, "") ? Config.Theme : Config.ProjectID, + URLPrefix); + + int EntryLength = 32 + StringLength(ProjectInfo[ProjectIndex].Unit) + 16 + 256; + + CollationBuffers->Index.Size = StringLength(queryContainer) + (Index.Header.EntryCount * EntryLength) + StringLength(Script); + if(!(CollationBuffers->Index.Location = malloc(CollationBuffers->Index.Size))) + { + return(RC_ERROR_MEMORY); + } + CollationBuffers->Index.Ptr = CollationBuffers->Index.Location; + + CopyStringToBuffer(&CollationBuffers->Index, queryContainer); + for(int EntryIndex = 0; EntryIndex < Index.Header.EntryCount; ++EntryIndex) { index_metadata This = *(index_metadata *)Index.Metadata.Buffer.Ptr; @@ -3750,44 +3822,33 @@ IndexToBuffer(buffers *CollationBuffers) CopyStringNoFormatT(Title, Index.File.Buffer.Ptr, '\n'); Title[StringLength(Title) - 1] = '\0'; - CopyStringToBuffer(&CollationBuffers->Index, - " <dt>\n" - " <a href=\"%s\">%s %s: %s</a>\n" - " </dt>\n", - This.BaseFilename, - ProjectInfo[ProjectIndex].Unit, // TODO(matt): Do we need to special-case the various numbering schemes? - Number, - Title); + if(StringsDiffer(ProjectInfo[ProjectIndex].Unit, "")) + { + CopyStringToBuffer(&CollationBuffers->Index, + " <dt>\n" + " <a href=\"%s\">%s %s: %s</a>\n" + " </dt>\n", + This.BaseFilename, + ProjectInfo[ProjectIndex].Unit, // TODO(matt): Do we need to special-case the various numbering schemes? + Number, + Title); + } + else + { + CopyStringToBuffer(&CollationBuffers->Index, + " <dt>\n" + " <a href=\"%s\">%s</a>\n" + " </dt>\n", + This.BaseFilename, + Title); + } Index.Metadata.Buffer.Ptr += sizeof(Index.Entry); IndexEntryStart += This.Size; Index.File.Buffer.Ptr = IndexEntryStart; } - char URLPrefix[1024] = { 0 }; - char *Ptr = URLPrefix; - if(StringsDiffer(Config.RootURL, "")) - { - Ptr += CopyString(Ptr, "%s/", Config.RootURL); - } - else - { - Ptr += CopyString(Ptr, "../"); - } - if(StringsDiffer(Config.JSDir, "")) - { - Ptr += CopyString(Ptr, "%s/", Config.JSDir); - } - - CopyStringToBuffer(&CollationBuffers->Index, " </dl>\n" - " <script type=\"text/javascript\">\n" - " var indexLocation = \"%s.index\";\n" - " var projectID = \"%s\";\n" - " </script>\n" - " <script type=\"text/javascript\" src=\"%scinera_search.js\"></script>\n", - Config.ProjectID, - Config.ProjectID, - URLPrefix); + CopyStringToBuffer(&CollationBuffers->Index, Script); FreeBuffer(&Index.Metadata.Buffer); return RC_SUCCESS; @@ -3829,6 +3890,7 @@ GenerateIndexPage(buffers *CollationBuffers, template *IndexTemplate) CopyString(IndexPagePath, "%s/index.html", Config.BaseDir); IndexToBuffer(CollationBuffers); BuffersToHTML(CollationBuffers, IndexTemplate, IndexPagePath, PAGE_INDEX); + FreeBuffer(&CollationBuffers->Index); return RC_SUCCESS; } @@ -4098,6 +4160,7 @@ main(int ArgC, char **Args) .ProjectID = "", .RootDir = ".", .RootURL = "", + .Theme = "", .TemplatePlayerLocation = "template_player.html", .TemplateIndexLocation = "template_index.html", .UpdateInterval = 4 @@ -4121,7 +4184,7 @@ main(int ArgC, char **Args) } char CommandLineArg; - while((CommandLineArg = getopt(ArgC, Args, "b:c:d:fhi:j:l:m:o:p:r:u:t:U:vx:")) != -1) + while((CommandLineArg = getopt(ArgC, Args, "b:c:d:fhi:j:l:m:o:p:r:u:s:t:U:vx:")) != -1) { switch(CommandLineArg) { @@ -4160,6 +4223,9 @@ main(int ArgC, char **Args) case 'r': Config.RootDir = StripTrailingSlash(optarg); break; + case 's': + Config.Theme = optarg; + break; case 't': Config.TemplatePlayerLocation = optarg; Config.Mode = MODE_INTEGRATE; @@ -4249,7 +4315,6 @@ main(int ArgC, char **Args) if(ClaimBuffer(&CollationBuffers.IncludesIndex, "IncludesIndex", Kilobytes(1)) == RC_ARENA_FULL) { goto RIP; }; if(ClaimBuffer(&CollationBuffers.Search, "Search", Kilobytes(32)) == RC_ARENA_FULL) { goto RIP; }; - if(ClaimBuffer(&CollationBuffers.Index, "Index", Kilobytes(8)) == RC_ARENA_FULL) { goto RIP; }; if(ClaimBuffer(&CollationBuffers.ScriptIndex, "ScriptIndex", 256) == RC_ARENA_FULL) { goto RIP; }; *CollationBuffers.Title = '\0'; @@ -4341,13 +4406,15 @@ main(int ArgC, char **Args) " Input Directory:\t\t%s\n" " Output Base Directory:\t%s\n" " Default Medium:\t\t%s\n" + " Style / Theme:\t\t%s\n" "\n" "┌╼ Synchronising with annotation files in Project Input Directory ╾┐\n", Config.ProjectID, Config.ProjectDir, Config.BaseDir, - Config.DefaultMedium); + Config.DefaultMedium, + StringsDiffer(Config.Theme, "") ? Config.Theme: Config.ProjectID); SyncIndexWithInput(&CollationBuffers, IndexTemplate, PlayerTemplate); @@ -4414,7 +4481,6 @@ NextFile: } DeclaimBuffer(&CollationBuffers.ScriptIndex); - DeclaimBuffer(&CollationBuffers.Index); DeclaimBuffer(&CollationBuffers.Search); DeclaimBuffer(&CollationBuffers.IncludesIndex); diff --git a/cinera/cinera.css b/cinera/css/cinera.css similarity index 100% rename from cinera/cinera.css rename to cinera/css/cinera.css diff --git a/cinera/template_index.html b/cinera/examples/template_index.html similarity index 68% rename from cinera/template_index.html rename to cinera/examples/template_index.html index 32d2c8b..cae64cc 100644 --- a/cinera/template_index.html +++ b/cinera/examples/template_index.html @@ -1,11 +1,11 @@ <!-- Index template --> <html> <head> - <title>RISCY BUSINESS Episode Guide + <!-- __CINERA_PROJECT__ --> Episode Guide -

RISCY BUSINESS Episode Guide

+

Episode Guide

This should just be the table of contents, heroes and heroines
diff --git a/cinera/template_player.html b/cinera/examples/template_player.html similarity index 89% rename from cinera/template_player.html rename to cinera/examples/template_player.html index 489ae96..21e93b4 100644 --- a/cinera/template_player.html +++ b/cinera/examples/template_player.html @@ -1,7 +1,7 @@ - <!-- __CINERA_TITLE__ --> - RISCY BUSINESS + <!-- __CINERA_TITLE__ --> - <!-- __CINERA_PROJECT__ --> diff --git a/cinera/cinera_icon_filter.png b/cinera/images/cinera_icon_filter.png similarity index 100% rename from cinera/cinera_icon_filter.png rename to cinera/images/cinera_icon_filter.png diff --git a/cinera/cinera_sprite_patreon.png b/cinera/images/cinera_sprite_patreon.png similarity index 100% rename from cinera/cinera_sprite_patreon.png rename to cinera/images/cinera_sprite_patreon.png diff --git a/cinera/cinera_player_post.js b/cinera/js/cinera_player_post.js similarity index 100% rename from cinera/cinera_player_post.js rename to cinera/js/cinera_player_post.js diff --git a/cinera/cinera_player_pre.js b/cinera/js/cinera_player_pre.js similarity index 100% rename from cinera/cinera_player_pre.js rename to cinera/js/cinera_player_pre.js diff --git a/cinera/cinera_search.js b/cinera/js/cinera_search.js similarity index 100% rename from cinera/cinera_search.js rename to cinera/js/cinera_search.js