Howdy, Stranger!

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

How do I search/replace the passage using PassageDone? [SugarCube 2.1]

I just want to make sure everything following punctuation in a passage is properly capitalized, so I want to run a search/replace regex in PassageDone or postrender. Can someone tell me the name of the variable or object or whatever I need to perform the regex on?

Comments

  • I tried something like that. Heed my advice: Don't.

    https://blog.codinghorror.com/regular-expressions-now-you-have-two-problems/

    It's much, much easier and safer to just copy the Passage text outside, find and replace, paste it back in.

    TME can back me up here.
  • How do I copy the passage text?
  • As I understand it the contents of the Passage about to be shown is processed and converted into HTML node elements, these elements are then inserted into the current page's Document Object Model at the relevant location(s).

    So simple put there is no 'text' (String) for you to parse.
    Puppeteer wrote: »
    How do I copy the passage text?
    I believe @storymasterq meant the contents of the Passage in the Twine application's passage editor.
  • First. There is no SugarCube v2.1 at this point in time, so the thread title is incorrect. You might want to work on that in the future.


    If this is related to your How do you regex an entire page before it outputs to reader? [Sugarcube 2.1] thread, then see my initial post there.

    Beyond that, as noted by greyelf, there is no intermediate step in SugarCube's render pipeline where some kind of finalized string is available. For the most part, its parser converts markup and macros directly into document nodes for insertion into the DOM.
Sign In or Register to comment.