Find and Replace Internet Link Targets?

Please post all questions on Help+Manual 8 here

Moderators: Alexander Halser, Tim Green

Post Reply
DanCooperstock
Posts: 27
Joined: Fri Jan 28, 2005 2:12 pm
Location: Toronto Canada
Contact:

Find and Replace Internet Link Targets?

Unread post by DanCooperstock »

We are converting our website from http to https. We have a lot of links to web pages in our H&M projects.

The regular Find and Replace works when the text is the full URL (starting with http:), and the link is <%LINK_CAPTION%>. But it doesn't seem to work if the text is something else, such as "our home page", and the link target is the actual URL.

Am I right that there is nothing built-in that would allow the required search and replace on link targets to be done in an automated way? If not, my thought is to generate the WebHelp, then search in the output, then go back into H&M and fix the places I found.

Of course we will have our website set to automatically promote http: URLs to https:, but it would still be better if the Help file always referenced the new protocol for our web pages.

Thank you.
Dan Cooperstock info@Software4Nonprofits.com
User avatar
Tim Green
Site Admin
Posts: 23156
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Find and Replace Internet Link Targets?

Unread post by Tim Green »

Hi Dan,

You can't currently do this directly in Help & Manual itself. However, if you use an editor with multi-file search and replace capabilities you can do this quickly by searching in the XML topic files. What you need to do is make the change once manually in the HM editor and check the XML source code editor (tab on the left of the HM editor window) to see what the code you need to search and replace is. Then use this in your multi-file search editor on all the XML files in your project's /Topics folder (you need to save in uncompressed HMXP format for this and please make a backup first!).

If you don't have a suitable editor for this here's a list of ones you could use:

Notepad++ (free, also an excellent code editor):
http://notepad-plus-plus.org/

Notepad++ also supports multi-file regular expression searching, if you feel comfortable with that, but it is more limited than PowerGREP but its search and replace is fine for this kind of task. It is also one of the best code editors available, at any price. I use it for all my web programming.

PowerGREP:
http://www.powergrep.com/

If you feel comfortable with regular expressions PowerGREP is the best tool available, on any platform and at any price. It is a little pricey, but if you do a lot of complex searching in multiple files (also for programming work) it will pay for itself subjectively in a single afternoon. The RegexBuddy tool from the same company (http://www.regexbuddy.com/) is also the best interactive tool available for defining and testing regular expressions, and its documentation is quite literally the best tutorial and introduction to regular expressions available anywhere.

GrepWin (free, can only search plain text files)
https://tools.stefankueng.com/grepWin.html

IMPORTANT: Always make a backup before doing this! Automated global changes are always a little bit risky. ;-)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
DanCooperstock
Posts: 27
Joined: Fri Jan 28, 2005 2:12 pm
Location: Toronto Canada
Contact:

Re: Find and Replace Internet Link Targets?

Unread post by DanCooperstock »

Thanks, I had completely forgotten about the ability to edit in the XML directly! That will make it easy.
Dan Cooperstock info@Software4Nonprofits.com
User avatar
julio
Posts: 118
Joined: Wed May 28, 2008 12:06 am
Location: Porto Alegre, RS - Brasil
Contact:

Re: Find and Replace Internet Link Targets?

Unread post by julio »

You can also think about creating variables containing the base address, for example. We created a variable called <%ADDRESS_WEBSITE%> with the value "http://www.oursite.com.br" and then, when we moved to HTTPS, we changed that variable and all documents received that change at once.
DanCooperstock
Posts: 27
Joined: Fri Jan 28, 2005 2:12 pm
Location: Toronto Canada
Contact:

Re: Find and Replace Internet Link Targets?

Unread post by DanCooperstock »

Thanks, Julio, I'm aware of that option of using variables, and have used it for some other things. But since I didn't need a fast, immediate turnover for this change I preferred to do it more manually by editing the .xml files.
Dan Cooperstock info@Software4Nonprofits.com
Post Reply