Macros for a tricky html editing task- viable?

Post your questions and problem reports here

Moderator: kfury77

Forum rules
Please try to follow these guidelines. This will help to receive faster and more accurate response.

  • Check the Support section of the corresponding product first. Chances are you will find your answer there;
  • Do not create new topics for already reported problems. Add your comments to the existing topics instead;
  • Create separate topic for each problem request. Do NOT post a number of non-related problem reports in a single topic;
  • Give your topic a meaningful title. Titles such as "A question," "Bug report" and "Help!" provide others no clue what your message is about;
  • Include the version number of the software you are using;
  • This is not an official customer support helpdesk. If you need a prompt and official response, please contact our support team directly instead. It may take a while until you receive a reply in the forum;

Macros for a tricky html editing task- viable?

Postby DrGarry » Thu Aug 14, 2014 2:29 pm

Hi All:

I haven't used Webuilder's macro facilities yet. Before I launch into that and end up in big mess, I'd like to know if the following task is viable to encode as a macro. I'm not asking anyone to spend their time on detailed steps, but I would like to know if my proposed task is (a) easy, (b) not-so-easy, (c) difficult to implement with Webuilder's macros.

In short, I want to use the new HTML5 tag <main> in my pages, replacing all the <div id = "content"> tags with <main> and -- here is the tricky bit-- replacing the matching </div> tags with </main>. So the tasks would be:

For each page:
1. Locate tag <div id = "content">. Replace it with <main>. Easy using Search > Replace in Files!
2. Find matching </div> tag. Replace it with </main>.

Ok: that's the part I have no idea about. I find this bit tricky enough even with "Edit > Select Tag Block". (I could have sworn that there was an "Edit > Find Closing tag" in earlier vsns of Webuilder. I must not be looking hard enough at the menus.)

Any suggestions?

Garry
DrGarry
 
Posts: 15
Joined: Wed May 04, 2011 12:13 pm

Re: Macros for a tricky html editing task- viable?

Postby Aivars » Thu Aug 14, 2014 3:32 pm

You're better off writing a plugin for this. Look for the example "Calling actions": http://help.blumentals.net/webuilder/pl ... amples.htm and the script should do about this:

call action ActSelectContent
store Editor.SelText to variable
Editor.SelText = ''
call action ActFindClosingTag (despite the name, this is actually "Select tag block")
Editor.SelText = '<main>' + variable from earlier + '</main>'
Blumentals Software Programmer
User avatar
Aivars
Blumentals Software Developer
 
Posts: 2456
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia


Return to HTMLPad / Rapid CSS / Rapid PHP / WeBuilder Support

Who is online

Users browsing this forum: No registered users and 14 guests