12 Replies Latest reply on Apr 20, 2017 7:12 AM by Beth Pickett

    Hyperlinks with id attribute with <a href>?

    Beth Pickett

      I just upgraded from RoboHelp 10 to 2017 (yes, a bit of a leap). While still using RH 10, I was asked to change all popup links in one of our projects to regular <a href> links that display in a window. Easy enough, searched and replaced, it was done.

       

      Now I've upgraded to RH 2017 and need to perform the same search and replace in another project. However, now the same operation inserts an id attribute with a unique number on each link, which appears to make a global search and replace impossible, at least within RH. I think it's inserting extra quotation marks, also, which isn't helping matters.

       

      Why can't I do a straight search and replace on the code without any HTML policing or whatever is going on? Or am I missing something?

        • 1. Re: Hyperlinks with id attribute with <a href>?
          Captiv8r Adobe Community Professional & MVP

          Hi there

           

          I believe you have the ability to use wildcard characters in the Multi File Find and Replace tool.

           

          My thought is that you could use the wildcards to overcome that "unique" bit of information that seems to be tripping you up.

           

          bc2.png

           

          Cheers... Rick

          • 2. Re: Hyperlinks with id attribute with <a href>?
            Beth Pickett Level 1

            Hi Rick,

             

            Thanks for the response. I think it's more complicated than that. Here's an example using the glossary term "default." (We use a manual glossary, not RoboHelp's automated one.) Here it is as a popup. RoboHelp added the id attribute when it converted the project to RoboHelp 2017.

             

                 <a href="javascript:BSSCPopup('../Gloss/Default_g.htm');" id="A3">default</a>

             

            I've got 300 or so of these in this project, and they all must become regular links:

             

             

                 <a href="../Gloss/Default_g.htm">default</a>

             

            As I said before, it was simple in the old software, because the unique id attributes weren't there, and I think fewer quotation marks. Nor can I enter a partial string like

             

                 <a href="javascript:BSSCPopup('../Gloss/

             

            and replace it with

             

                 <a href="../Gloss/

             

            because the incomplete syntax causes a wreck. That is, text disappears, it inserts text that shouldn't be there, crazy stuff. The syntax wouldn't be incomplete if RoboHelp hadn't added the extra and unique stuff when it converted the project.

             

            Also, I don't seem to have the same options as you do. I'm sure I could use wildcards if I could figure out how to apply them in this instance.

             

            Thanks,

            Beth

            • 3. Re: Hyperlinks with id attribute with <a href>?
              Captiv8r Adobe Community Professional & MVP

              The dialog appears different because I displayed the Find tab and it's different than the Replace tab.

              • 4. Re: Hyperlinks with id attribute with <a href>?
                Peter Grainge Adobe Community Professional (Moderator)

                Using Regular Expressions would be a solution to this problem but there's a design problem doing that within RoboHelp. You can use regular expressions in the Find settings but not in the Replace settings. The solution to anything other than a manual edit has to be regular expressions using a tool other than RoboHelp. The freeware Text Crawler is one example. This does of course depend on whether you know how to use regular expressions. If not, maybe one of your developers could help? Not all developers are skilled in their use so don't take that as being part of their skillset.

                 

                <a href="javascript:BSSCPopup('../Gloss/Default_g.htm');" id="A3">default</a>

                 

                You defined <a href="../Gloss/Default_g.htm">default</a> as what you want and if you remove what I have coloured red, that is what you get.

                 

                The regular expression would find the whole string and because of the way it is written, it would split it into five parts. In the Replace expression, it would delete parts two and four leaving one, three and five. The beauty of regular expressions is that they can capture strings such as _g and A3 even though the characters vary from one find to another.

                 

                Before embarking on this, create a backup first. You can wreck a project much quicker than you can create it. Warp speed by comparison. I always recommend creating the backup as a zip file. That prevents you opening it accidentally and working on it before you realise it was the backup. This way you always have a clean backup that can be used to create a new clean copy time after time.

                 


                See www.grainge.org for RoboHelp and Authoring information

                 

                 

                @petergrainge

                • 5. Re: Hyperlinks with id attribute with <a href>?
                  Beth Pickett Level 1

                  Well, that's true, isn't it? Having never needed those options before, I was unfamiliar with their location and non-location.

                  • 6. Re: Hyperlinks with id attribute with <a href>?
                    Beth Pickett Level 1

                    Peter,

                     

                    Thanks for the reply, as always. I can see where regular expressions could work as you explain them and they sound very handy; however, they're certainly not in my skillset. I'll see if any of our developers are familiar with them. For this round, likely I'll be stuck doing these one by one, as we have a client deadline looming. There may be time for a few hours of focused, tedious clicking but not for gambles. I would like to explore regular expressions--they sound interesting. Thanks again!

                    • 7. Re: Hyperlinks with id attribute with <a href>?
                      Amebr Level 4

                      This site might be useful when you have time to start exploring. Up to Shorthand Characters plus Grouping is probably more than enough for starters, then come back for anchors, the dot and lazy/greedy after you've had a chance to play around a bit (I still haven't got up to back references...) .

                       

                      Regular Expressions Quick Start

                       

                      And this cheatsheet:

                      https://www.cheatography.com/davechild/cheat-sheets/regular-expressions/

                       

                      Also, I highly recommend TextCrawler. It has a nifty feature where you can enter some sample text and quickly see the effect of your expression, without actually running your Find/Replace.

                       

                      Plus, you can save searches so you can run them again later. I once set this up and then copied it to colleagues when we were converting from RH to Flare (can I say that here? )

                      • 8. Re: Hyperlinks with id attribute with <a href>?
                        Peter Grainge Adobe Community Professional (Moderator)

                        Perhaps to late now but in case you or anyone else hits this problem, I believe this regex for the Find

                         

                        (.+?\")(.+?')(.+?htm)(.+?\d+)(.+?a>)

                         

                        and $1$3$5 for the replace will work.

                         

                        Don't even consider running this without a backup.

                         


                        See www.grainge.org for RoboHelp and Authoring information

                         

                         

                        @petergrainge

                        • 9. Re: Hyperlinks with id attribute with <a href>?
                          Beth Pickett Level 1

                          Thank you for that info--will definitely check it out!

                          • 10. Re: Hyperlinks with id attribute with <a href>?
                            Beth Pickett Level 1

                            I gave it a shot. I was supposed to select "Regular Expressions" in Find, yes? I looked at a few of them, and it might have fixed parts of them, but caused some mishaps, also. (I can't claim to have the cleanest code in these very old files, either.) Where should "javascript:BSSCPopup" appear in the Find? I've been clicking along at them today as I've had time, and it's going more quickly than anticipated, so I'll think I'll be okay. It just frustrated me that it's not a straightforward, easy find and replace.

                             

                            Thank goodness the several hundred in the other projects were done before I upgraded RH. However, I looked at a pre-RH upgrade version of this project, and I'll be darned, those id attributes were in there. Can't imagine why, since this project is just a spin-off of the others. So, I guess I can't blame the upgrade after all.

                             

                            Anyway, I'll keep playing with it after I get the official version out the door. Thanks again, Peter and all.

                            • 11. Re: Hyperlinks with id attribute with <a href>?
                              Peter Grainge Adobe Community Professional (Moderator)

                              First of all are you using RoboHelp's Find and Replace. The regular expression above will be found but you cannot use regular expressions in the Replace as RoboHelp does not include that option. You must use Text Crawler or something like that.

                               

                              Also it's not as simple as "what finds javascript:BSSCPopup"

                               

                              The logic of the expression in the find the whole string and split it into groups, then in the replace to ditch the second and fourth group. The groups are coloured alternately below so the second group finds javascript:BSSCPopup('. Note it includes an opening bracket and an apostrophe.

                               

                              <a href="javascript:BSSCPopup('../Gloss/Default_g.htm');" id="A3">default</a>

                               

                              If you are happy plodding along with the manual approach, fine. If you need something different, let me know what is to be found.

                               


                              See www.grainge.org for RoboHelp and Authoring information

                               

                               

                              @petergrainge

                              • 12. Re: Hyperlinks with id attribute with <a href>?
                                Beth Pickett Level 1

                                You did say not to use RH Find and Replace, and obviously it didn't register. I'll try Text Crawler. Honestly, I can't take too much of a chance with it at this point, it's too late in the development cycle. I'd have to go into each topic to verify that it worked anyway, so might as well do a quick plod along manually. Great info, though, thank you very much. I'm saving this thread for future and am eager to give it a try when this deadline has passed.