diff --git a/hmml_to_html/hmml_to_html.c b/hmml_to_html/hmml_to_html.c
index 6abc505..ba18259 100644
--- a/hmml_to_html/hmml_to_html.c
+++ b/hmml_to_html/hmml_to_html.c
@@ -66,7 +66,8 @@ main(int ArgC, char **Args)
// NOTE(matt): Init MemoryArena
char *MemoryArena;
- int ArenaSize = 1024 * 64;
+ // TODO(matt): Actually calculate how much memory I'll need
+ int ArenaSize = 1024 * 512;
if(!(MemoryArena = calloc(ArenaSize, 1)))
{
perror(Args[0]);
@@ -76,28 +77,12 @@ main(int ArgC, char **Args)
// NOTE(matt): Setup buffers and ptrs
char *InPtr;
- buffer Template;
buffer Working;
+ buffer Text;
buffer Out;
- FILE *TemplateFile;
- if(!(TemplateFile = fopen("style.css", "r")))
- {
- perror(Args[0]);
- return 1;
- }
-
- fseek(TemplateFile, 0, SEEK_END);
- Template.Size = ftell(TemplateFile);
- fseek(TemplateFile, 0, SEEK_SET);
-
- Template.Location = MemoryArena + ClaimedMemory;
- ClaimedMemory += Template.Size;
- fread(Template.Location, Template.Size, 1, TemplateFile);
- fclose(TemplateFile);
-
Out.Location = MemoryArena + ClaimedMemory;
- Out.Size = 1024 * 32;
+ Out.Size = 1024 * 200;
ClaimedMemory += Out.Size;
for(int FileIndex = 1; FileIndex < ArgC; ++FileIndex)
@@ -116,7 +101,7 @@ main(int ArgC, char **Args)
if(HMML.well_formed)
{
Working.Location = MemoryArena + ClaimedMemory;
- Working.Size = 1024 * 2;
+ Working.Size = 1024 * 1;
ClaimedMemory += Working.Size;
sprintf(Working.Location,
@@ -141,6 +126,7 @@ main(int ArgC, char **Args)
}
int AnnotationIndex = 0;
+ int ReferenceIndex = 1;
while(AnnotationIndex < HMML.annotation_count)
{
if(HMML.annotations[AnnotationIndex].reference_count)
@@ -161,26 +147,34 @@ main(int ArgC, char **Args)
{
for(int i = 0; i < HMML.annotations[AnnotationIndex].reference_count; ++i)
{
+ // NOTE(matt): Consider removing the ref_index class if it ain't needed
sprintf(Working.Location,
" \n"
-" (%s)\n"
" \n"
" %s
\n"
" %s
\n"
" \n"
+// NOTE(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"
+" [%d]%s\n"
+"
\n"
" \n",
AnnotationIndex,
HMML.annotations[AnnotationIndex].references[i].url,
-TimecodeToSeconds(HMML.annotations[AnnotationIndex].time),
-HMML.annotations[AnnotationIndex].time,
HMML.annotations[AnnotationIndex].references[i].site ? HMML.annotations[AnnotationIndex].references[i].site : HMML.annotations[AnnotationIndex].references[i].author,
-HMML.annotations[AnnotationIndex].references[i].page ? HMML.annotations[AnnotationIndex].references[i].page : HMML.annotations[AnnotationIndex].references[i].title);
+HMML.annotations[AnnotationIndex].references[i].page ? HMML.annotations[AnnotationIndex].references[i].page : HMML.annotations[AnnotationIndex].references[i].title,
+TimecodeToSeconds(HMML.annotations[AnnotationIndex].time),
+ReferenceIndex,
+HMML.annotations[AnnotationIndex].time);
Working.Ptr = Working.Location;
while(*Working.Ptr)
{
*Out.Ptr++ = *Working.Ptr++;
}
+ ++ReferenceIndex;
}
++AnnotationIndex;
}
@@ -204,22 +198,82 @@ HMML.annotations[AnnotationIndex].references[i].page ? HMML.annotations[Annotati
*Out.Ptr++ = *Working.Ptr++;
}
- int DataRef = 0;
+ int DataRef = 1;
for(int AnnotationIndex = 0; AnnotationIndex < HMML.annotation_count; ++AnnotationIndex)
{
+ InPtr = HMML.annotations[AnnotationIndex].text;
+
+ Text.Location = MemoryArena + ClaimedMemory;
+ Text.Size = 256;
+ ClaimedMemory += Text.Size;
+ Text.Ptr = Text.Location;
+
if(HMML.annotations[AnnotationIndex].reference_count) // || HMML.annotations[AnnotationIndex].is_quote)
{
sprintf(Working.Location,
"
\n", TimecodeToSeconds(HMML.annotations[AnnotationIndex].time), AnnotationIndex);
- ++DataRef;
+
+ for(int RefLocalIndex = 0; RefLocalIndex < HMML.annotations[AnnotationIndex].reference_count; ++RefLocalIndex)
+ {
+ while(InPtr - HMML.annotations[AnnotationIndex].text < HMML.annotations[AnnotationIndex].references[RefLocalIndex].offset)
+ {
+ *Text.Ptr++ = *InPtr++;
+ }
+
+ int Inc = 0;
+ if(HMML.annotations[AnnotationIndex].references[RefLocalIndex].offset <= 2)
+ {
+ if(HMML.annotations[AnnotationIndex].references[RefLocalIndex].page)
+ {
+ Inc = sprintf(Text.Ptr, "%s",
+ HMML.annotations[AnnotationIndex].references[RefLocalIndex].page);
+ }
+ else if(HMML.annotations[AnnotationIndex].references[RefLocalIndex].site)
+ {
+ Inc = sprintf(Text.Ptr, "%s",
+ HMML.annotations[AnnotationIndex].references[RefLocalIndex].site);
+ }
+ else if(HMML.annotations[AnnotationIndex].references[RefLocalIndex].title)
+ {
+ Inc = sprintf(Text.Ptr, "%s",
+ HMML.annotations[AnnotationIndex].references[RefLocalIndex].title);
+ }
+ else
+ {
+ fprintf(stderr, "%s: Potentially incomplete reference at %s:%d\n",
+ Args[0],
+ Args[FileIndex],
+ HMML.annotations[AnnotationIndex].line);
+ }
+ Text.Ptr += Inc;
+ }
+
+ if(HMML.annotations[AnnotationIndex].references[RefLocalIndex].offset <= 2 && Text.Ptr[-1] == ' ')
+ {
+ --Text.Ptr;
+ }
+ Inc = sprintf(Text.Ptr, "
%d", DataRef);
+ Text.Ptr += Inc;
+ ++DataRef;
+ }
+ while(*InPtr)
+ {
+ *Text.Ptr++ = *InPtr++;
+ }
}
else
{
sprintf(Working.Location,
"
\n", TimecodeToSeconds(HMML.annotations[AnnotationIndex].time));
+ while(*InPtr)
+ {
+ *Text.Ptr++ = *InPtr++;
+ }
}
+ *Text.Ptr = '\0';
+ Text.Ptr = Text.Location;
Working.Ptr = Working.Location;
while(*Working.Ptr)
{
@@ -236,12 +290,14 @@ HMML.annotations[AnnotationIndex].references[i].page ? HMML.annotations[Annotati
"
\n"
"
\n",
HMML.annotations[AnnotationIndex].time,
- HMML.annotations[AnnotationIndex].text,
+ Text.Location,
HMML.annotations[AnnotationIndex].time,
- HMML.annotations[AnnotationIndex].text,
+ Text.Location,
HMML.annotations[AnnotationIndex].time,
- HMML.annotations[AnnotationIndex].text);
+ Text.Location);
Working.Ptr = Working.Location;
+
+ ClaimedMemory -= Text.Size;
while(*Working.Ptr)
{
@@ -279,6 +335,7 @@ HMML.annotations[AnnotationIndex].references[i].page ? HMML.annotations[Annotati
" player.setTime(parseInt(time, 10));\n"
" player.play();\n"
" ev.preventDefault();\n"
+" ev.stopPropagation();\n"
" return false;\n"
" }\n"
" });\n"
@@ -296,13 +353,14 @@ HMML.annotations[AnnotationIndex].references[i].page ? HMML.annotations[Annotati
"function onRefChanged(ref) {\n"
" if (ref !== undefined && ref !== null) {\n"
" document.querySelector(\".refs_container\").classList.add(\"current\");\n"
-" var refs = document.querySelectorAll(\".refs .ref\");\n"
-" for (var i = 0; i < refs.length; ++i) {\n"
-" var dataID = refs[i].getAttribute(\"data-id\");\n"
-" if (ref == dataID) {\n"
-" refs[i].classList.add(\"current\");\n"
+" var refElements = document.querySelectorAll(\".refs .ref\");\n"
+" var refs = ref.split(\",\");\n"
+"\n"
+" for (var i = 0; i < refElements.length; ++i) {\n"
+" if (refs.includes(refElements[i].getAttribute(\"data-id\"))) {\n"
+" refElements[i].classList.add(\"current\");\n"
" } else {\n"
-" refs[i].classList.remove(\"current\");\n"
+" refElements[i].classList.remove(\"current\");\n"
" }\n"
" }\n"
" } else {\n"
diff --git a/hmml_to_html/out.html b/hmml_to_html/out.html
index 06a8605..3cd8126 100644
--- a/hmml_to_html/out.html
+++ b/hmml_to_html/out.html
@@ -14,46 +14,46 @@
@@ -90,21 +90,21 @@
-
9:03Revisit instructions.scala and research register-transfer level
+
9:03Revisit instructions.scala1 and research register-transfer level2
-
9:03Revisit instructions.scala and research register-transfer level
+
9:03Revisit instructions.scala1 and research register-transfer level2
-
9:03Revisit instructions.scala and research register-transfer level
+
9:03Revisit instructions.scala1 and research register-transfer level2
-
15:55Come to understand how to specify that rs1 represents an immediate or a register, thanks to the reply to the "Confusion Regarding Freedom E SDK inline asm" forum thread
+
15:55Come to understand how to specify that rs1 represents an immediate or a register, thanks to the reply to the "Confusion Regarding Freedom E SDK inline asm" forum thread3
-
15:55Come to understand how to specify that rs1 represents an immediate or a register, thanks to the reply to the "Confusion Regarding Freedom E SDK inline asm" forum thread
+
15:55Come to understand how to specify that rs1 represents an immediate or a register, thanks to the reply to the "Confusion Regarding Freedom E SDK inline asm" forum thread3
-
15:55Come to understand how to specify that rs1 represents an immediate or a register, thanks to the reply to the "Confusion Regarding Freedom E SDK inline asm" forum thread
+
15:55Come to understand how to specify that rs1 represents an immediate or a register, thanks to the reply to the "Confusion Regarding Freedom E SDK inline asm" forum thread3
@@ -117,12 +117,12 @@
-
22:24Read about CSRRCI in the CSR Instructions section of the User-Level ISA Specification
+
22:24Read about CSRRCI in the CSR Instructions section of the User-Level ISA Specification4
-
22:24Read about CSRRCI in the CSR Instructions section of the User-Level ISA Specification
+
22:24Read about CSRRCI in the CSR Instructions section of the User-Level ISA Specification4
-
22:24Read about CSRRCI in the CSR Instructions section of the User-Level ISA Specification
+
22:24Read about CSRRCI in the CSR Instructions section of the User-Level ISA Specification4
@@ -135,12 +135,12 @@
-
28:53GNU Assembly Syntax: Constraints and Syntax
+
28:53GNU Assembly Syntax: Constraints and Syntax5
-
28:53GNU Assembly Syntax: Constraints and Syntax
+
28:53GNU Assembly Syntax: Constraints and Syntax5
-
28:53GNU Assembly Syntax: Constraints and Syntax
+
28:53GNU Assembly Syntax: Constraints and Syntax5
@@ -153,12 +153,12 @@
-
40:21Pop back up to the top of the stack, to reset_demo(), and read about the currently allocated RISC-V machine-level CSR addresses
+
40:21Pop back up to the top of the stack, to reset_demo(), and read about the currently allocated RISC-V machine-level CSR addresses6
-
40:21Pop back up to the top of the stack, to reset_demo(), and read about the currently allocated RISC-V machine-level CSR addresses
+
40:21Pop back up to the top of the stack, to reset_demo(), and read about the currently allocated RISC-V machine-level CSR addresses6
-
40:21Pop back up to the top of the stack, to reset_demo(), and read about the currently allocated RISC-V machine-level CSR addresses
+
40:21Pop back up to the top of the stack, to reset_demo(), and read about the currently allocated RISC-V machine-level CSR addresses6
@@ -244,6 +244,7 @@ for (var i = 0; i < refTimecodes.length; ++i) {
player.setTime(parseInt(time, 10));
player.play();
ev.preventDefault();
+ ev.stopPropagation();
return false;
}
});
@@ -261,13 +262,14 @@ for (var i = 0; i < refSources.length; ++i) {
function onRefChanged(ref) {
if (ref !== undefined && ref !== null) {
document.querySelector(".refs_container").classList.add("current");
- var refs = document.querySelectorAll(".refs .ref");
- for (var i = 0; i < refs.length; ++i) {
- var dataID = refs[i].getAttribute("data-id");
- if (ref == dataID) {
- refs[i].classList.add("current");
+ var refElements = document.querySelectorAll(".refs .ref");
+ var refs = ref.split(",");
+
+ for (var i = 0; i < refElements.length; ++i) {
+ if (refs.includes(refElements[i].getAttribute("data-id"))) {
+ refElements[i].classList.add("current");
} else {
- refs[i].classList.remove("current");
+ refElements[i].classList.remove("current");
}
}
} else {
diff --git a/hmml_to_html/player.js b/hmml_to_html/player.js
index 2eb8c97..293129d 100644
--- a/hmml_to_html/player.js
+++ b/hmml_to_html/player.js
@@ -66,6 +66,7 @@ Player.prototype.play = function() {
if (!this.playing) {
this.youtubePlayer.playVideo();
}
+ this.pauseAfterBuffer = false;
} else {
this.shouldPlay = true;
}
diff --git a/hmml_to_html/style.css b/hmml_to_html/style.css
index aa490df..0f7d53e 100644
--- a/hmml_to_html/style.css
+++ b/hmml_to_html/style.css
@@ -1,16 +1,16 @@
/* USER-DEFINED */
.marker .content {
-width: 320px;
-padding: 5px;
-font-size: 14px;
+ width: 320px;
+ padding: 5px;
+ font-size: 14px;
}
.timecode {
-font-size: 9px;
-padding-right: 8px;
-position: relative;
-top: -2px;
+ font-size: 9px;
+ padding-right: 8px;
+ position: relative;
+ top: -2px;
}
.marker {
@@ -160,7 +160,7 @@ body {
padding: 10px;
border-bottom: 1px solid rgb(51, 51, 51);
display: flex;
- flex-direction: row;
+ flex-direction: column;
align-items: center;
text-decoration: none;
color: white;
@@ -185,18 +185,43 @@ body {
.refs .ref .timecode {
display: inline-block;
- min-width: 55px;
font-size: 12px;
- padding-right: 10px;
- text-align: right;
+ padding: 0;
+}
+
+.refs .ref .ref_indices {
+ text-align: center;
+}
+
+.refs .ref .ref_indices .timecode {
+ display: inline-block;
+ font-size: 12px;
+}
+
+.refs .ref .ref_indices .timecode:first-child::before {
+ content: "";
+}
+
+.refs .ref .ref_indices .timecode::before {
+ content: "•";
+ margin: 0 4px;
}
.refs .ref .timecode:hover .time {
text-decoration: underline;
}
+.refs .ref .ref_content {
+ width: 100%;
+ text-align: center;
+}
+
.refs .ref .source {
font-size: 10px;
color: #888;
line-height: 8px;
}
+
+.refs .ref .timecode .ref_index {
+ margin-right: 4px;
+}