hmml_to_html.c: Introduce BuildCatgories()
Also update reference.html with :research as a CategoryMedium
This commit is contained in:
parent
30df421b9e
commit
b32fd1e066
|
@ -196,13 +196,39 @@ SanitisePunctuation(char *String)
|
||||||
char *CategoryMedium[] =
|
char *CategoryMedium[] =
|
||||||
{
|
{
|
||||||
"blackboard",
|
"blackboard",
|
||||||
"Blackboard",
|
|
||||||
"research",
|
"research",
|
||||||
"Research",
|
|
||||||
"run",
|
"run",
|
||||||
"Run",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
BuildCategories(buffer *AnnotationClass, buffer *Category, int *MarkerIndex, bool *HasCategory, char *Marker)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < ArrayCount(CategoryMedium); ++i)
|
||||||
|
{
|
||||||
|
if(!StringsDiffer(CategoryMedium[i], Marker))
|
||||||
|
{
|
||||||
|
CopyStringToBuffer(AnnotationClass, " %s", SanitisePunctuation(Marker));
|
||||||
|
++*MarkerIndex;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(*HasCategory == FALSE)
|
||||||
|
{
|
||||||
|
CopyStringToBuffer(Category, "<span class=\"categories\"><div class=\"category %s\"></div>",
|
||||||
|
SanitisePunctuation(Marker));
|
||||||
|
*HasCategory = TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CopyStringToBuffer(Category, "<div class=\"category %s\"></div>",
|
||||||
|
SanitisePunctuation(Marker));
|
||||||
|
}
|
||||||
|
CopyStringToBuffer(AnnotationClass, " cat_%s",
|
||||||
|
SanitisePunctuation(Marker));
|
||||||
|
++*MarkerIndex;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int ArgC, char **Args)
|
main(int ArgC, char **Args)
|
||||||
{
|
{
|
||||||
|
@ -271,6 +297,7 @@ main(int ArgC, char **Args)
|
||||||
{
|
{
|
||||||
bool HasCategory = FALSE;
|
bool HasCategory = FALSE;
|
||||||
ClaimBuffer(MemoryArena, &ClaimedMemory, &AnnotationHeader, 256);
|
ClaimBuffer(MemoryArena, &ClaimedMemory, &AnnotationHeader, 256);
|
||||||
|
ClaimBuffer(MemoryArena, &ClaimedMemory, &Category, 256);
|
||||||
ClaimBuffer(MemoryArena, &ClaimedMemory, &AnnotationClass, 128);
|
ClaimBuffer(MemoryArena, &ClaimedMemory, &AnnotationClass, 128);
|
||||||
ClaimBuffer(MemoryArena, &ClaimedMemory, &Text, 1024 * 4);
|
ClaimBuffer(MemoryArena, &ClaimedMemory, &Text, 1024 * 4);
|
||||||
|
|
||||||
|
@ -304,11 +331,12 @@ HMML.annotations[AnnotationIndex].author);
|
||||||
if(HMML.annotations[AnnotationIndex].markers[MarkerIndex].type == HMML_MEMBER)
|
if(HMML.annotations[AnnotationIndex].markers[MarkerIndex].type == HMML_MEMBER)
|
||||||
{
|
{
|
||||||
CopyStringToBuffer(&Text,
|
CopyStringToBuffer(&Text,
|
||||||
"<a href=\"https://handmade.network/m/%s\" target=\"blank\" style=\"color: #%X; text-decoration: none\">%s</a>",
|
"<a href=\"https://handmade.network/m/%s\" target=\"blank\" style=\"color: #%X; text-decoration: none\">%.*s</a>",
|
||||||
HMML.annotations[AnnotationIndex].markers[MarkerIndex].marker,
|
HMML.annotations[AnnotationIndex].markers[MarkerIndex].marker,
|
||||||
StringToColourHash(HMML.annotations[AnnotationIndex].markers[MarkerIndex].marker),
|
StringToColourHash(HMML.annotations[AnnotationIndex].markers[MarkerIndex].marker),
|
||||||
Readable);
|
StringLength(Readable), InPtr);
|
||||||
InPtr += StringLength(Readable);
|
InPtr += StringLength(Readable);
|
||||||
|
++MarkerIndex;
|
||||||
}
|
}
|
||||||
else if(HMML.annotations[AnnotationIndex].markers[MarkerIndex].type == HMML_PROJECT)
|
else if(HMML.annotations[AnnotationIndex].markers[MarkerIndex].type == HMML_PROJECT)
|
||||||
{
|
{
|
||||||
|
@ -318,34 +346,13 @@ HMML.annotations[AnnotationIndex].markers[MarkerIndex].marker,
|
||||||
StringToColourHash(HMML.annotations[AnnotationIndex].markers[MarkerIndex].marker),
|
StringToColourHash(HMML.annotations[AnnotationIndex].markers[MarkerIndex].marker),
|
||||||
Readable);
|
Readable);
|
||||||
InPtr += StringLength(Readable);
|
InPtr += StringLength(Readable);
|
||||||
|
++MarkerIndex;
|
||||||
}
|
}
|
||||||
else if(HMML.annotations[AnnotationIndex].markers[MarkerIndex].type == HMML_CATEGORY)
|
else if(HMML.annotations[AnnotationIndex].markers[MarkerIndex].type == HMML_CATEGORY)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < ArrayCount(CategoryMedium); ++i)
|
BuildCategories(&AnnotationClass, &Category, &MarkerIndex, &HasCategory, HMML.annotations[AnnotationIndex].markers[MarkerIndex].marker);
|
||||||
{
|
|
||||||
if(!StringsDiffer(CategoryMedium[i], HMML.annotations[AnnotationIndex].markers[MarkerIndex].marker))
|
|
||||||
{
|
|
||||||
CopyStringToBuffer(&AnnotationClass, " %s", SanitisePunctuation(HMML.annotations[AnnotationIndex].markers[MarkerIndex].marker));
|
|
||||||
goto NextCategory;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!HasCategory)
|
|
||||||
{
|
|
||||||
ClaimBuffer(MemoryArena, &ClaimedMemory, &Category, 256);
|
|
||||||
CopyStringToBuffer(&Category, "<span class=\"categories\"><div class=\"category %s\"></div>",
|
|
||||||
SanitisePunctuation(HMML.annotations[AnnotationIndex].markers[MarkerIndex].marker));
|
|
||||||
HasCategory = TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CopyStringToBuffer(&Category, "<div class=\"category %s\"></div>",
|
|
||||||
SanitisePunctuation(HMML.annotations[AnnotationIndex].markers[MarkerIndex].marker));
|
|
||||||
}
|
|
||||||
CopyStringToBuffer(&AnnotationClass, " cat_%s",
|
|
||||||
SanitisePunctuation(HMML.annotations[AnnotationIndex].markers[MarkerIndex].marker));
|
|
||||||
}
|
|
||||||
NextCategory: ++MarkerIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(RefIndex < HMML.annotations[AnnotationIndex].reference_count &&
|
if(RefIndex < HMML.annotations[AnnotationIndex].reference_count &&
|
||||||
InPtr - HMML.annotations[AnnotationIndex].text == HMML.annotations[AnnotationIndex].references[RefIndex].offset)
|
InPtr - HMML.annotations[AnnotationIndex].text == HMML.annotations[AnnotationIndex].references[RefIndex].offset)
|
||||||
|
@ -361,29 +368,7 @@ NextCategory: ++MarkerIndex;
|
||||||
|
|
||||||
while(MarkerIndex < HMML.annotations[AnnotationIndex].marker_count)
|
while(MarkerIndex < HMML.annotations[AnnotationIndex].marker_count)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < ArrayCount(CategoryMedium); ++i)
|
BuildCategories(&AnnotationClass, &Category, &MarkerIndex, &HasCategory, HMML.annotations[AnnotationIndex].markers[MarkerIndex].marker);
|
||||||
{
|
|
||||||
if(!StringsDiffer(CategoryMedium[i], HMML.annotations[AnnotationIndex].markers[MarkerIndex].marker))
|
|
||||||
{
|
|
||||||
CopyStringToBuffer(&AnnotationClass, " %s", SanitisePunctuation(HMML.annotations[AnnotationIndex].markers[MarkerIndex].marker));
|
|
||||||
goto NextCategoryInNode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!HasCategory)
|
|
||||||
{
|
|
||||||
ClaimBuffer(MemoryArena, &ClaimedMemory, &Category, 256);
|
|
||||||
CopyStringToBuffer(&Category, "<span class=\"categories\"><div class=\"category %s\"></div>",
|
|
||||||
SanitisePunctuation(HMML.annotations[AnnotationIndex].markers[MarkerIndex].marker));
|
|
||||||
HasCategory = TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CopyStringToBuffer(&Category, "<div class=\"category %s\"></div>",
|
|
||||||
SanitisePunctuation(HMML.annotations[AnnotationIndex].markers[MarkerIndex].marker));
|
|
||||||
}
|
|
||||||
CopyStringToBuffer(&AnnotationClass, " cat_%s",
|
|
||||||
SanitisePunctuation(HMML.annotations[AnnotationIndex].markers[MarkerIndex].marker));
|
|
||||||
NextCategoryInNode: ++MarkerIndex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyStringToBuffer(&AnnotationClass, "\"");
|
CopyStringToBuffer(&AnnotationClass, "\"");
|
||||||
|
@ -430,6 +415,7 @@ HMML.annotations[AnnotationIndex].time);
|
||||||
|
|
||||||
ClaimedMemory -= Text.Size;
|
ClaimedMemory -= Text.Size;
|
||||||
ClaimedMemory -= AnnotationHeader.Size;
|
ClaimedMemory -= AnnotationHeader.Size;
|
||||||
|
ClaimedMemory -= Category.Size;
|
||||||
ClaimedMemory -= AnnotationClass.Size;
|
ClaimedMemory -= AnnotationClass.Size;
|
||||||
ClaimedMemory -= Annotation.Size;
|
ClaimedMemory -= Annotation.Size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,13 +63,13 @@
|
||||||
<div class="player_container">
|
<div class="player_container">
|
||||||
<div class="video_container" data-videoId="ug5WkCROkOk"></div>
|
<div class="video_container" data-videoId="ug5WkCROkOk"></div>
|
||||||
<div class="markers_container">
|
<div class="markers_container">
|
||||||
<div class="marker authored cat_rendering cat_research" data-timestamp="60" data-ref="0,1">
|
<div class="marker authored cat_rendering research" data-timestamp="60" data-ref="0,1">
|
||||||
<div class="content"><span class="timecode">1:00</span><span class="author" style="color: #69D036;">insofaras</span> Some text referring to <a href="https://handmade.network/m/Zilarrezko" target="blank" style="color: #8624DC; text-decoration: none">Zilarrezko</a> about this thing<sup>1</sup> regarding triangle intersections he saw in the <a href="https://milton.handmade.network/" target="blank" style="color: #8369CF; text-decoration: none">milton</a> forums<sup>2</sup><span class="categories"><div class="category rendering"></div><div class="category research"></div></span></div>
|
<div class="content"><span class="timecode">1:00</span><span class="author" style="color: #69D036;">insofaras</span> Some text referring to <a href="https://handmade.network/m/Zilarrezko" target="blank" style="color: #8624DC; text-decoration: none">Zilarrezko</a> about this thing<sup>1</sup> regarding triangle intersections he saw in the <a href="https://milton.handmade.network/" target="blank" style="color: #8369CF; text-decoration: none">milton</a> forums<sup>2</sup><span class="categories"><div class="category rendering"></div></span></div>
|
||||||
<div class="progress faded">
|
<div class="progress faded">
|
||||||
<div class="content"><span class="timecode">1:00</span><span class="author" style="color: #69D036;">insofaras</span> Some text referring to <a href="https://handmade.network/m/Zilarrezko" target="blank" style="color: #8624DC; text-decoration: none">Zilarrezko</a> about this thing<sup>1</sup> regarding triangle intersections he saw in the <a href="https://milton.handmade.network/" target="blank" style="color: #8369CF; text-decoration: none">milton</a> forums<sup>2</sup><span class="categories"><div class="category rendering"></div><div class="category research"></div></span></div>
|
<div class="content"><span class="timecode">1:00</span><span class="author" style="color: #69D036;">insofaras</span> Some text referring to <a href="https://handmade.network/m/Zilarrezko" target="blank" style="color: #8624DC; text-decoration: none">Zilarrezko</a> about this thing<sup>1</sup> regarding triangle intersections he saw in the <a href="https://milton.handmade.network/" target="blank" style="color: #8369CF; text-decoration: none">milton</a> forums<sup>2</sup><span class="categories"><div class="category rendering"></div></span></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="progress main">
|
<div class="progress main">
|
||||||
<div class="content"><span class="timecode">1:00</span><span class="author" style="color: #69D036;">insofaras</span> Some text referring to <a href="https://handmade.network/m/Zilarrezko" target="blank" style="color: #8624DC; text-decoration: none">Zilarrezko</a> about this thing<sup>1</sup> regarding triangle intersections he saw in the <a href="https://milton.handmade.network/" target="blank" style="color: #8369CF; text-decoration: none">milton</a> forums<sup>2</sup><span class="categories"><div class="category rendering"></div><div class="category research"></div></span></div>
|
<div class="content"><span class="timecode">1:00</span><span class="author" style="color: #69D036;">insofaras</span> Some text referring to <a href="https://handmade.network/m/Zilarrezko" target="blank" style="color: #8624DC; text-decoration: none">Zilarrezko</a> about this thing<sup>1</sup> regarding triangle intersections he saw in the <a href="https://milton.handmade.network/" target="blank" style="color: #8369CF; text-decoration: none">milton</a> forums<sup>2</sup><span class="categories"><div class="category rendering"></div></span></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="marker" data-timestamp="176" data-ref="a">
|
<div class="marker" data-timestamp="176" data-ref="a">
|
||||||
|
|
Loading…
Reference in New Issue