How to Convert to WebHub Syntax Stage 2.14  ("0214")

These instructions are for WebHub customers who have projects dating from 1995 to 2005.  Updated 08-Jun-2010.

Preparation

Please BACKUP your files FIRST !

---

EMail "customerservice at href dot com" for a free 60-day evaluation code for FuzRegex or make yourself a free 30-day unlock at http://www.href.com/unlock

Download a copy of FuzRegex from http://www.fuzregex.com

Download the TedNPad editor from http://jsimlo.sk/notepad/  and make sure it runs

Download the fuz script files, especially the latest revisions of Stage0211_Rev?.fzs and Stage0213_Curvey_Rev?.fzs
	from http://www.fuzregex.com/download/share/2006WebHub/

	Let's say you save those files to c:\fuzscripts\

	If you want to use a different search and replace tool, that is okay.  You should still download the fuz scripts so that you can see all the search and replace steps to take.

---

Copy each whtml file (e.g. *.txt, *.whtml, *.htm  but NOT *.ini)  to a file with the same name and an extension of .whteko
Example:  contact.txt copied to contact.whteko

Edit your application INI file.  In the [TWebApp.Files] section, change the file extensions to .whteko.  The list of files should correspond exactly to the list you are about to clean with FuzRegex.

(( To convert your INI to XML, use the WHZMConverter.exe which is available to all customers via FTP on webhub.com. ))

Converting to Syntax Stage 2.14

Promise that you have backed up your files.

Run FuzRegex.  Go into the menu: File > Preferences.  Make sure that

	case sensitive matching -- should be OFF

	replace in-situ -- should be ON  (otherwise you end up with the changed files in a subfolder and have to move them later yourself -- which is okay but is an extra step and you did say that you have a backup)

	editor -- should be D:\Apps\Utilities\TedNPad\TedNPad.exe

	editor command line -- should be /c%CursorAt% /s%StartSel%,%EndSel% %Filename%

Go into script mode via the menu: Mode > Scripts

Open the first script: Scripts > Open > Stage0211_Rev?.fzs

Set your root folder to the path containing your *.whteko files.  End the path with a trailing delimiter.  Example: c:\projectfiles\
	If you have *.whteko files in subfolders and want to convert all at once, end the path with a trailing delimiter plus <+> which means "include subfolders".   Example: c:\projectfiles\<+>

This is the moment to say your prayers.

Click [Run Script]

When the script is done, you will either see (a) almost nothing because no matching files were found in the folder; or (b) a list of the strings that were FOUND, as they looked prior to replacement.   

--

Some editing to be done manually

HINT: As of 28-May-2010, there is a utility for doing steps 1, 2, 4, 5 and 6 for all *.whteko files in a single folder. Contact tech support and ask for a copy of the TekoAssistant.exe from support ticket #00379, optionally with source to be compiled in Delphi 2009+.  Remember to do step 3 yourself regardless.

If converting manually, open each *.whteko file in an editor.  We recommend the use of Dreamweaver 8 with the WebHub Designer extension, because it includes syntax highlighting for .whteko files, includes syntax validation, has dialog boxes to help your enter WebHub syntax, and still has the best ability (of all editors we have tested) to display your page content "live" while allowing you to edit.  Generally speaking, these are great reasons to do day-to-day page design with Dreamweaver.  For the specific purpose of converting files to a new syntax level, you may use any editor.

1. Insert this at the top of each WHTEKO file.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE whteko PUBLIC "-//HREF//DTD whteko stage 2.14//Strict//EN//" "http://webhub.com/dtd/0214/whteko.dtd">
<whteko designmode="code">

2. Insert this at the end of each WHTEKO file

</whteko>

3. Search for 
	<h1>-Page:
and see whether there are any pages that the FuzScript missed.  This can happen when the original document used some of the extended syntax for a page declaration.

Example:
<h1>-Page:pgwelcome,,,Start page for my site</h1>

Manually convert to:

<whpage pageid="pgwelcome" desc="Start page for my site">

4. Search for every <whpage> tag and close it with a corresponding </whpage> tag

5. Same for <whdroplet> tags

6. Same for <whmacros> tags

7. Search for 

<hr /><!-- *********************************************************************** -->

and delete if found.  (That was the old way of marking the end of a page, chunk or macro section.)

Extra care regarding the MATCH macro

Go back to FuzRegex and go into Find mode.

Search for MATCH\|([^(%~=!\[\$]+)
	(that will look for in all places where you call MATCH or NOMATCH and have syntax that worked previously due to implicit expansion but will now fail due to MATCH using explicit expansion.  WebHub v2.039+ requires explicit macro affixes around expressions.)

HINT: Read all the way to the end of this section on MATCH before you decide what to do.

HINT: If you find any of these cases, you could FIRST convert from %= =% to parentils (below) and then come back and fix the MATCH expressions.  The ambiguity in this particular situation is one of the main reasons that we decide to switch to parentils.   By converting to parentils first, and then fixing the MATCH syntax, you will have much less manual editing to do.

Make sure that in all cases, if your expression intends to reference an expression, that your expression is contained in macro affixes.  For example, given a string variable named x which you want to match, this old syntax

MATCH|x=3|hello			// OLD BAD WILL NOT WORK

should be changed to

MATCH|(~x~)=3|hello		// NEW GOOD CLEAR WILL WORK

because the MATCH macro now only expands when you tell it to.

HINT: If ALL of your MATCH expressions are like the example above, where x is a variable of some kind, you can use the script Stage0214_Match to convert those automatically.

Converting to Parentils

Close all *.whteko files so changes are saved to disk and the files are not open in your editor.

Backup your *.whteko files

--------------------

If you are using a version of the WebHub components earlier than v2.076, make sure you put these lines into the Delphi code of your WebHub application BEFORE the app is refreshed:

uses whMacroAffixes;

MacroStart := '(~';
MacroEnd := '~)';

The rule on macro affixes is that they can be (~ ~)  or %= =% but no other pairs of characters.

Here is an example (in the project DPR file or in the event of TtpProject) of how you can continue to use the old affixes:

uses
  webApp, whMacroAffixes;

MacroStart := '%=';  
MacroStop := '=%';
pWebApp.AppID := 'myappid';
pWebApp.Refresh;

--------------------

Go back to FuzRegEx.  

Go into scripts mode: Mode > Scripts		(if that option is greyed out, go into Mode > Find and then come back to Mode > Scripts)

--

Open the second script: Scripts > Open > Stage0213_Curvey_Step1_Rev?.fzs

Set the root folder as before.

If you need to fix up the macro affixes in mailmerge files (*.txt), change the Files so that it includes the correct extensions. To do that, click [Change] then enter the filespec you want (example *.whteko|*.txt   where you put a vertical bar between the extensions) and then click [Accept].

Click [Run Script]

--

Go into Find mode: Mode > Find

Search for the following ambiguous phrase and if you find it, convert it manually to parentils.  If you double-click on any found-line, you will launch the TedNPad editor.

	=%=

--

Go back into script mode.  Scripts > Open > Stage0213_Curvey_Step2_Rev?.fzs

Modify the file specification to include *.txt if needed.

Click [Run Script]

### end ###