Show Sitemap ..Help2HTMLHelpWinHelp

Migrating HTMLHelp for future use

Since XML is at the root of single-sourcing formats, you want to be using standard coding with no proprietary features. So, make "clean" HTML or XHTML code and avoid creative coding, which can cause trouble porting to any future platform like XML, other lanuages or XML subsets like DocBook, DITA or AML. You can check thsi by Tidy. Converting WinHelp (HLP) to HTMLHelp (CHM) by using a decompiler or old WinHelp projects I described separately before. Some examples below are related to this article.

Tidy and other tools like FAR (http://www.helpware.net/FAR) can be used to help move over to proper XHTML & CSS code.

Tidy - What's Tidy?

HTML TIDY is a free utility and works great on the atrociously hard to read markup generated by specialized HTML editors and conversion tools.Tidy is able to fix up a wide range of problems. Each item found is listed with the line number and column so that you can see where the problem lies in your markup. Tidy won't generate a cleaned up version when there are problems that it can't be sure of how to handle. These are logged as "errors" rather than "warnings".

Tidy - Update files using the command-line version

It's usually best to verify the HTML code suggested by HTML Tidy before updating the original file. However, if you're comfortable with updating the original files without verifying the HTML code, the following solution can be used with the command line version of HTML Tidy. This is a solution using Tidy for many HTML files from the command-line - but use at your own risk.

  1. Save some time by downloading the WinHelp - Conversion Project Example and unzip to "C:\_WinHelpToHH" to create subfolders and some example files.
    Optional download the command-line version of HTML Tidy and unzip it to a temporary folder such as C:\_WinHelpToHH\_tidy\. Make your own config file for Tidy.
  2. Copy your HTML files to c:\_winhelptohh\hh_updated\html\
  3. Make a backup of the files that you intend to update. If anything goes wrong during the automated update, you will have a copy of the original files.
  4. Double-click the C:\_WinHelpToHH\_tidy\tidy_batch.bat file.
    alternatively you can Open a Command Prompt (or a DOS box) inside Windows.
    Change to the folder where your HTML files are located. For example, to change the folder, type "cd c:\_winhelptohh\hh_updated\html\" and press "Enter".
  5. Paste the following line into the Command Prompt (right click for paste) and press "Enter"
    for %i in (*.htm) do c:\_WinHelptoHH\_tidy\tidy.exe -config c:\_WinHelptoHH\_tidy\tidy_config.txt -m "%i"
  6. HTML Tidy will process every file in the current folder (e.g. c:\_winhelptohh\hh_updated\html\) with the *.htm extension and automatically update the original files with the HTML code generated by it.
  7. Finally, examine the updated files. If it's not possible to examine each and every file, at least some of the more complex files should be manually inspected to make sure that the files were updated as you intended.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252">
<TITLE>First Topic</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<OBJECT TYPE="application/x-oleobject" CLASSID="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
<PARAM NAME="Keyword" VALUE="First Topic">
</OBJECT>
<H1><A NAME="first_topic"></A><IMG SRC="../images/riffel_helpinformation.gif" ALT="" BORDER=0> First Topic </H1>
<P><B>First Topic</B></P>
<P>This is the first topic for context-sensitive help.</P>
<P>This is s tree</P>
<P><IMG SRC="../images/eiche.gif" ALT="" BORDER=0></P>
<P>Having trees in your garden you must have:</P>
<P> 1.Numbered item one</P>
<P> 2.Numbered item two</P>
..

During this Tidy pass, the code was cleaned

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
  <head>
  <meta name="generator" content="HTML Tidy for Windows (vers 14 February 2006), see www.w3.org" />
  <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />

  <title>First Topic</title>
  <style type="text/css">
/*<![CDATA[*/
  body {
  background-color: #FFFFFF;
  color: #000000;
  }
  p.c1 {font-weight: bold}
  /*]]>*/
  </style>
</head>
<body>
  <object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
    <param name="Keyword" value="First Topic" />
  </object>
  <h1><a name="first_topic" id="first_topic"></a><img src="../images/riffel_helpinformation.gif" alt="" border="0" /> First Topic</h1>
  <p class="c1">First Topic</p>
  <p>This is the first topic for context-sensitive help.</p>
  <p>This is s tree</p>
  <p><img src="../images/eiche.gif" alt="" border="0" /></p>
  <p>Having trees in your garden you must have:</p>
  <p>1.Numbered item one</p>
  <p>2.Numbered item two</p>
..

 

CSS ..

 

<head>
<meta name="generator" content="HTML Tidy for Windows (vers 14 February 2006), see www.w3.org" />
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<link href="../hh_default.css" rel="stylesheet" type="text/css" />
<title>First Topic</title>
<style type="text/css">
/*<![CDATA[*/
body {
background-color: #FFFFFF;
color: #000000;
}
p.c1 {font-weight: bold}
/*]]>*/
</style>

</head>

Open your HTMLHelp project file e.g. winh_to_hh.hhp with Notepad and add the following line:

[FILES]
hh_default.css
html\winh4qgg.htm
html\winh7jzk.htm
html\winh052b.htm
html\winh8a3n.htm
html\winh57z7.htm

Compile your project again. As you can see there is a header derived from the stylesheet and universally valid for all HTML files.

 

Links

Download


Top ...