diff --git a/README.md b/README.md index e69de29..617e2ef 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,54 @@ +Fair warning: This is all under development and not production ready + +## hmml_to_html.c + +### Build + +Clone the repo, `cd hmml_to_html` and run: + zsh hmml_to_html.c + + (replacing zsh with your shell as appropriate) + +This outputs a binary `hmml_to_html` + +### Run + +#### Ordinary operation + + ./hmml_to_html test.hmml + +This simply generates an HTML file (and updates `cinera_topics.css` if needed) +from `test.hmml` and outputs to `out.html` + +Note that if the .hmml file contains quotes (as `test.hmml` does), it would be +easiest for now just to remove the quote from `test.hmml`. If you want quotes +to work, run: + + mkdir /home/matt/GitHub/insofaras/25fc16d58a297a486334 + git clone https://gist.github.com/insofaras/25fc16d58a297a486334 /home/matt/GitHub/insofaras/25fc16d58a297a486334 + + (Seriously, the path is hardcoded for now) + +Note also that `cinera.css` contains a `body {}` block at the bottom which you +may want to remove / comment out + +#### Integration + + CINERA_MODE=INTEGRATE ./hmml_to_html test.hmml + +This will integrate into template.html (currently hardcoded) the player and +related elements generated from test.hmml and output to out.html + +Feel free to play with template.html to your heart's content. If you do +anything invalid, `hmml_to_html` will tell you what's wrong + +Valid tags: + +- `` _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_ +- `<!-- __CINERA_INCLUDES__ -->` _the necessary `.css` and `.js` files, and charset setting_ +- `<!-- __CINERA_MENUS__ -->` _ _the menu bar that typically appears above the + player in my samples_ +- `<!-- __CINERA_PLAYER__ -->` _the player_ +- `<!-- __CINERA_SCRIPT__ -->` _the listeners that enable interaction with the player_ diff --git a/hmml_to_html/hmml_to_html.c b/hmml_to_html/hmml_to_html.c index 9edad8d..06d495e 100644 --- a/hmml_to_html/hmml_to_html.c +++ b/hmml_to_html/hmml_to_html.c @@ -2419,7 +2419,6 @@ HMML.metadata.project); char *ScriptTag = "__CINERA_SCRIPT__"; bool FoundIncludes = FALSE; - bool FoundTitle = FALSE; bool FoundMenus = FALSE; bool FoundPlayer = FALSE; bool FoundScript = FALSE; @@ -2455,12 +2454,6 @@ HMML.metadata.project); else if(!(StringsDifferT(TitleTag, Template.Ptr, 0))) { - if(FoundTitle == TRUE) - { - fprintf(stderr, "Template contains more than one <!-- __CINERA_TITLE__ --> tag\n"); - free(Template.Location); free(Output.Location); hmml_free(&HMML); free(MemoryArena); return 1; - } - FoundTitle = TRUE; Output.Ptr = CommentStart; CopyStringToBuffer(&Output, HMML.metadata.title); while(Template.Ptr - Template.Location < Template.Size) @@ -2518,6 +2511,11 @@ HMML.metadata.project); } else if(!(StringsDifferT(ScriptTag, Template.Ptr, 0))) { + if(FoundPlayer == FALSE) + { + fprintf(stderr, "<!-- __CINERA_SCRIPT__ --> must come after <!-- __CINERA_PLAYER__ -->\n"); + free(Template.Location); free(Output.Location); hmml_free(&HMML); free(MemoryArena); return 1; + } if(FoundScript == TRUE) { fprintf(stderr, "Template contains more than one <!-- __CINERA_SCRIPT__ --> tag\n");