diff --git a/hmml_to_html/hmml_to_html.c b/hmml_to_html/hmml_to_html.c
index f2bfcaa..9fc2196 100644
--- a/hmml_to_html/hmml_to_html.c
+++ b/hmml_to_html/hmml_to_html.c
@@ -225,6 +225,8 @@ SanitisePunctuation(char *String)
char *CategoryMedium[] =
{
"blackboard",
+ "owl",
+ "rant",
"research",
"run",
};
@@ -256,6 +258,73 @@ BuildCategories(buffer *AnnotationClass, buffer *Category, int *MarkerIndex, boo
return;
}
+void
+GenerateTopicColours(char *Topic)
+{
+ for(int i = 0; i < ArrayCount(CategoryMedium); ++i)
+ {
+ if(!StringsDiffer(Topic, CategoryMedium[i]))
+ {
+ return;
+ }
+ }
+
+ FILE *TopicsFile;
+ char *TopicsBuffer;
+ char *TopicsPtr;
+ int PersistentLength = 89;
+ if((TopicsFile = fopen("topics.css", "r")))
+ {
+ fseek(TopicsFile, 0, SEEK_END);
+ int TopicsLength = ftell(TopicsFile);
+ fseek(TopicsFile, 0, SEEK_SET);
+
+ if(!(TopicsBuffer = malloc(TopicsLength + StringLength(Topic) + PersistentLength)))
+ {
+ perror("hmml_to_html");
+ return;
+ }
+
+ fread(TopicsBuffer, TopicsLength, 1, TopicsFile);
+ fclose(TopicsFile);
+
+ TopicsPtr = TopicsBuffer;
+
+ while(TopicsPtr - TopicsBuffer < TopicsLength)
+ {
+ TopicsPtr += 39;
+ if(!strncmp(SanitisePunctuation(Topic), TopicsPtr, StringLength(Topic)))
+ {
+ free(TopicsBuffer);
+ return;
+ }
+ while(TopicsPtr - TopicsBuffer < TopicsLength && *TopicsPtr != '\n')
+ {
+ ++TopicsPtr;
+ }
+ ++TopicsPtr;
+ }
+ }
+ else
+ {
+ if(!(TopicsBuffer = malloc(StringLength(Topic) + PersistentLength)))
+ {
+ perror("hmml_to_html");
+ return;
+ }
+ TopicsPtr = TopicsBuffer;
+ }
+
+ int PrintLength = sprintf(TopicsPtr, ".marker .content .categories .category.%s { border-color: #%X; background: #%X; }\n",
+ SanitisePunctuation(Topic), StringToColourHash(Topic), StringToColourHash(Topic));
+ TopicsPtr += PrintLength;
+
+ TopicsFile = fopen("topics.css", "w");
+ fwrite(TopicsBuffer, TopicsPtr - TopicsBuffer, 1, TopicsFile);
+ fclose(TopicsFile);
+ free(TopicsBuffer);
+}
+
int
main(int ArgC, char **Args)
{
@@ -389,6 +458,7 @@ Readable);
}
else if(Anno->markers[MarkerIndex].type == HMML_CATEGORY)
{
+ GenerateTopicColours(Anno->markers[MarkerIndex].marker);
BuildCategories(&AnnotationClass, &Category, &MarkerIndex, &HasCategory, Anno->markers[MarkerIndex].marker);
}
}
@@ -519,6 +589,7 @@ Anno->time);
while(MarkerIndex < Anno->marker_count)
{
+ GenerateTopicColours(Anno->markers[MarkerIndex].marker);
BuildCategories(&AnnotationClass, &Category, &MarkerIndex, &HasCategory, Anno->markers[MarkerIndex].marker);
}
@@ -598,7 +669,7 @@ Anno->time);
// TODO(matt): Fill the div class="ref_indices" with <= 3 span
// class="ref_index" and ensure to put these <=3 spans on the same line without
// a space between them
-"
\n",
+"
\n ",
ReferencesArray[i].ID,
"http://example.com/",
"Source",
@@ -606,14 +677,14 @@ ReferencesArray[i].ID,
for(int j = 0; j < ReferencesArray[i].IdentifierCount; ++j)
{
CopyStringToBuffer(&ReferenceMenu,
-" [%d]%s\n",
+"[%d]%s",
TimecodeToSeconds(ReferencesArray[i].Identifier[j].Timecode),
ReferencesArray[i].Identifier[j].Identifier,
ReferencesArray[i].Identifier[j].Timecode);
}
CopyStringToBuffer(&ReferenceMenu,
-"
\n"
+"\n
\n"
" \n");
}
@@ -642,6 +713,7 @@ ReferencesArray[i].Identifier[j].Timecode);
" \n"
" \n"
" \n"
+" \n"
" \n"
" \n");
diff --git a/hmml_to_html/out.html b/hmml_to_html/out.html
index 32fc6f8..f114545 100644
--- a/hmml_to_html/out.html
+++ b/hmml_to_html/out.html
@@ -5,6 +5,7 @@
+
@@ -52,8 +53,7 @@
Title
- [2]1:00
- [3]10:24
+ [2]1:00[3]10:24
diff --git a/hmml_to_html/style.css b/hmml_to_html/style.css
index 8102374..0d35e38 100644
--- a/hmml_to_html/style.css
+++ b/hmml_to_html/style.css
@@ -98,31 +98,6 @@
width: 8px;
}
-.marker .content .categories .category.hardware {
- border-color: #FF3333;
- background: #FF3333;
-}
-
-.marker .content .categories .category.mathematics {
- border-color: #5E0595;
- background: #5E0595;
-}
-
-.marker .content .categories .category.memory {
- border-color: #3399FF;
- background: #3399FF;
-}
-
-.marker .content .categories .category.rendering {
- border-color: #60B60A;
- background: #60B60A;
-}
-
-.marker .content .categories .category.research {
- border-color: #5851EB;
- background: #5851EB;
-}
-
/* MANDATORY */
.player_container {
diff --git a/hmml_to_html/topics.css b/hmml_to_html/topics.css
new file mode 100644
index 0000000..afb1158
--- /dev/null
+++ b/hmml_to_html/topics.css
@@ -0,0 +1,15 @@
+.marker .content .categories .category.rendering { border-color: #60B60A; background: #60B60A; }
+.marker .content .categories .category.mesh-building { border-color: #609FA2; background: #609FA2; }
+.marker .content .categories .category.physics { border-color: #869535; background: #869535; }
+.marker .content .categories .category.threading { border-color: #579BDF; background: #579BDF; }
+.marker .content .categories .category.procedural-generation { border-color: #67B347; background: #67B347; }
+.marker .content .categories .category.optimisation { border-color: #7E4B17; background: #7E4B17; }
+.marker .content .categories .category.experience { border-color: #604188; background: #604188; }
+.marker .content .categories .category.language { border-color: #4CCCCC; background: #4CCCCC; }
+.marker .content .categories .category.memory { border-color: #8DA740; background: #8DA740; }
+.marker .content .categories .category.demo { border-color: #547AE0; background: #547AE0; }
+.marker .content .categories .category.networking { border-color: #810623; background: #810623; }
+.marker .content .categories .category.simulation { border-color: #7DF3B5; background: #7DF3B5; }
+.marker .content .categories .category.profiling { border-color: #6E5D4B; background: #6E5D4B; }
+.marker .content .categories .category.trivia { border-color: #7C962E; background: #7C962E; }
+.marker .content .categories .category.mathematics { border-color: #5E0595; background: #5E0595; }