Skip to main content
November 2, 2010
Question

replacing legacy twisty code without breaking the twisty

  • November 2, 2010
  • 3 replies
  • 1830 views

We started using twistys back in 2005, with the original twisty code from grainge.org. We've started using the newer twisty code mentioned, but I haven't been able to figure out a way to update the legacy twisties to the new code without vaporizing the content of the twisty. We've tried scripting it in perl, and the Brute Force find and replace method using FAR.

With over 2400 to replace, my boss has ruled out the piecework method, but a recent Mozilla Firefox update has rendered our older twisties inert, so I need a solution sooner rather than later.

Has anyone had any experience with this kind of find and replace project? I can supply a "before" and "after" code sample on request.

.MW

    This topic has been closed for replies.

    3 replies

    November 4, 2010

    More information on this. I checked our published webhelp with the Firefox 4 beta, and the results are not encouraging. Twistys don't seem to work at all, or with very limited functionality (I tested the original twisty format and the TSPaul format). Twistys in the merged TOC are dead as well.

    Willam van Weelden
    Inspiring
    November 5, 2010

    Are only the twisties broken? How about TOC, Index and search? FF4 is in beta and changing a script now may be a waste of time as a new beta may break the updated script. I'd wait for the FF4 release before worrying.

    Greet,

    Willam

    November 5, 2010

    Actually, I think it would be more productive for Adobe to work with Mozilla to fix this issue. To paraphrase Leonard "Bones" McCoy, "Dammit Jim! I'm a technical writer, not a software engineer!"

    MergeThis
    Inspiring
    November 2, 2010

    Have you investigated FAR's Define Substring use of variables? That is, you can identify start and end strings, then identify the substring that you want to maintain as a variable within changed or new start and/or end strings.

    For example, say you want to change all <h1></h1> tags to <h2 class=BBB></h2> tags while, of course, maintaining each topic's original h1 heading text.

    This will replace all instances of <h1>MyHeading</h1> with <h2 class=BBB>MyHeading</h2>. Of course, I don't know what your original code is, but you might need to do this in two stages instead of one, depending on the complexity of that code and what you want it changed into.

    Although I doubt that you would be confident enough to instruct FAR to Replace All (I know I wouldn't), you could certainly step through each instance quite quickly.

    Good luck,

    Leon

    November 2, 2010

    It has been a few months since I experimented with FAR (everything was working then, so it wasn't deemed

    an effective use of my time), and I did have to use some ofthe advaced features. My recollection of experimenting in an offline project was that the twisty code was updated cosmetically but then failed to work(?). Perhaps I'll give it another go.

    Which version of FAR is that?

    MergeThis
    Inspiring
    November 2, 2010

    FAR 5.0.0.698

    Willam van Weelden
    Inspiring
    November 2, 2010

    Hi,

    Which newer twisty method are you referring to? If you refer to my twisty script, updating may indeed prove a bit of a pain, so to speak. It isn't made with backward compatibility in mind.

    Some of the old twisty methods stopped working, but those scripts have been updated. Are they broken again?

    Greet,

    Willam

    November 2, 2010

    First off, mez apologe, RH8.0.2, WindowsXP 32 SP3.

    Older twisty code:

    <p id="P1"><a class="dropspot" href="javascript:TextPopup(this)" onclick="JavaScript:swapImage(dropdown1);showhidecheck()"
         onfocus="this.blur()" id="a1" style="position: relative;">

          <img src="../image/plus_sign.gif" name="dropdown1" alt="click to expand" title="click to expand" id="dropdown1"

           style="border: none; margin-right: 10px;" width="11" height="11" border="0" />Analysis & Synthesis Settings Report</a></p>


    Newer twisty code (which may well be yours Willem):

    <p id="p23"><a class="dropspot" href="javascript:TextPopup(this)" id="a2"
         style="position: relative;"><img class="TwistyImage" alt="Collapse"
                  src="../image/minus_sign.gif"
                  style="border: none;
                  display: none;" width="11"
                  height="11" border="0" />
    <img class="TwistyImage" alt="Expand" src="../image/plus_sign.gif" style="border: none;
       margin-right: 10px;" width="11" height="11" border="0" />GXB Behavior
    Differences Report</a></p>

    I can dig around on grainge.org and look for solutions there. I see that there's a section on twisties with sample projects and the li,e. We've been using showhide_twisty.js for years. I guess I need to get with the program!

    .MW

    Willam van Weelden
    Inspiring
    November 2, 2010

    Hi,

    The latest version of the twisty scripts that I know exist, are available on http://www.grainge.org/pages/authoring/twisty/twisty.htm

    I do believe that migrating to the TS Paul method or my method should be possible. Be sure to check out the RH scripting tool. If you can script in Perl, you can surely master the power of the RH scripting tool.

    Greet,

    Willam