Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Best way to get code into [Twine+Sugarcube]

edited June 2014 in Help! with 1.x
I have asked a similar question before, but now that I'm using Twine (1.4) rather Twee, I'm wondering if anything might have changed. It's kind of a hail-mary pass, as I don't expect it has, but I thought I'd try.

I would like to add some <meta> tags to my Sugarcube joint to customize behavior on mobile devices. Of course, it would also be nice to insert <script> tags as well. Is there currently a good way to do these sorts of insertions other than hand-editing the HTML file after building? (I use an eval() based script loader now that inserts script tags into the head, but that hacky method doesn't work for all javascript libraries, and I'm reasonably certain that method wouldn't work for meta tags anyway.)

If not, is there any chance of getting a special passage whose content would be inserted directly into <head>?

Comments

  • That probably needs to be a compilation step.  While you can inject some things after the document has been loaded (e.g. scripts and stylesheets), I'm uncertain if injecting &lt;meta&gt; tags would work out as well (some might, others not so much).

    Someone else recently (past week) inquired about the same ability (though in their case it was to add metadata required by some IF hosting/database site via &lt;meta&gt; tags).

    Twine 1.4.2 gained a limited ability to inject metadata into &lt;meta&gt; tags during compilation (Twee should have the same ability now, however, it's not exposed in any way).  I have a idea to allow arbitrary &lt;meta&gt; tag injection, but I haven't really had the time to either suggest it properly or do it myself.
  • Hmm, this metadata is not currently stored in a passage, making it unavailable to Twee. I could add command line options for it, but that's the wrong approach in my opinion: this metadata is part of the story that is being compiled, so it should appear somewhere in the source code.

    So my request is that whatever mechanism you design, please store the data inside a passage.
  • Have you found a solution? I am currently looking into the same problem and any advice would be welcome.
Sign In or Register to comment.