# Include Revision Information

The revision tracking feature in applications—such as Microsoft Word's Track Changes—marks changes to a document (typically, strikethrough for deleted text and underline for inserted text) and tracks each change by reviewer name and date.

If revision tracking was enabled when changes were made to a document, You can configure Export to convert the deleted text and graphics and include revision information in the HTML output. (The deleted content and revision information is excluded from the HTML output by default.)

Content that was added to the document is identified by `<ins>` tags and is underlined when displayed in a browser. Content that was deleted from the document is identified by `<del>` tags and is displayed with strikethrough formatting.

The `<ins>` and `<del>` tags include the following attributes:

`style` | This is an optional attribute that is not included by default. You can define a unique HTML style (such as `color: red; background: orange`) that is applied to each reviewer's edits. See Configure the Revision Style.
`title` | The `title` attribute can contain a prefix and revision information which is displayed in a browser. By default, the prefix is either the text string "`inserted:`" or "`deleted:`", and the revision information includes the reviewer name, and the date and time the revision was made. You can exclude the `title` attribute or define different text strings for the `title` attribute (see Configure the Revision Title).
`cite` | The `cite` attribute contains the name of the reviewer who made the revision.
`datetime` | The `datetime` attribute contains the date and time the revision was made. The date is in ISO-8601 format: `YYYY-MM-DDThh:mm:ss`.

For example, the following markup can be generated for inserted text:

    <ins style="color: red" title="Inserted: JohnD, 2006-04-24Tl4:47:00" cite="mailto:JohnD" datetime="2006-04-24T14:47:00">This text was added</ins> in a previous version.

This text is displayed in the browser as:

This text was added in a previous version.

When you hover the cursor over the underlined text in the browser, the text "Inserted: JohnD, 2006-04-24Tl4:47:00" is displayed as a ToolTip.

NOTE: Whether the text is displayed with strikethrough or underline depends on the configuration and capabilities of the browser.

To convert deleted text and graphics and include revision information

1. Call the `fpInit()` or `fpInitWithLicenseData()` function. See fpInit() or fpInitWithLicenseData().

2. Define the `KVRevisionMark` structure. See KVRevisionMark.

3. Call the `fpHTMLConfig()` function with the following arguments (see KVHTMLConfig()):

   Argument | Parameter
   `nType` | `KVCFG_INCLREVISIONMARK`
   `nValue` | `TRUE`
   `pData` | A pointer to the `KVRevisionMark` structure which defines the information that appears in the `title` attribute and the HTML styles applied to revised content. If you pass `NULL` to this function, defaults are used.

   For example:

       KVRevisionMark    RMark;
       memset(&RMark, 0, sizeof(KVRevisionMark));
       KVStructInit(&RMark);
       RMark...
       (*fpHTMLConfig)(pKVHTML, KVCFG_INCLREVISIONMARK, TRUE, &RMark))

   The `htmlini` sample program demonstrates this function. See htmlini.

4. Call the `fpConvertStream()` or `KVHTMLConvertFile()` function. See fpConvertStream() or KVHTMLConvertFile().

## Configure the Revision Title

The `title` attribute can contain a prefix and revision information which is displayed in a browser. By default, the prefix is either the text string "`inserted:`" or "`deleted:`" and the reviewer name and date/time are included in the title.

- To exclude the `title` attribute from the `<ins>` and `<del>` tags, set the `RM_TITLE_FLAG` in the `KV_RM_Title` structure to `RMT_Off`. See KV_RM_Title.

- To define a different text string for the prefix, specify a new text string in the `pPrefix` member and set the `nSize` and `eCharSet` members of the `KV_RM_Title` structure. See KV_RM_Title.

- To change the revision information included in the `title` attribute, set the `RM_TITLE_FLAG` in the `KV_RM_Title` structure. See RM_Title_Flag.

The following example sets the prefix as "`Added:`" and "`Removed:`" for inserted and deleted text respectively, and only includes the reviewer name in the `title` attribute:

    KVRevisionMark    RMark;
    char              RMInsPre[16] = "Added:";
    char              RMDelPre[16] = "Removed:";
        memset(&RMark, 0, sizeof(KVRevisionMark));
        KVStructInit(&RMark);
        RMark.InsTitle.eFlag = RMT_Author;
        RMark.InsTitle.pPrefix = (BYTE *)(&RMInsPre);
        RMark.InsTitle.nSize = strlen(RMInsPre);
        RMark.InsTitle.eCharSet = KVCS_UTF8;
        RMark.DelTitle.eFlag = RMT_Author;
        RMark.DelTitle.pPrefix = (BYTE *)(&RMDelPre);
        RMark.DelTitle.nSize = strlen(RMDelPre);
        RMark.DelTitle.eCharSet = KVCS_UTF8;
    (*fpHTMLConfig)(pKVHTML, KVCFG_INCLREVISIONMARK, TRUE, &RMark))

## Configure the Revision Style

You can define a unique HTML style (such as `color: red; background: orange`) that is applied to each reviewer's modifications. This allows you to easily differentiate between multiple reviewers' edits. For example, changes made by JSmith are highlighted in red, changes made by RBrown are highlighted in blue, and so on.

To define revision styles, set the number of revision styles in the `nAuthorStyles` member of the `KVRevisionMark` structure, and use the `ppAuthorStyles` member for each style to define the contents of the `style` attribute. See KVRevisionMark.

The following example defines two revision styles:

    KVRevisionMark    RMark;
    char    RMAuthorStyle0[60] = "color: red; background: yellow";
    char    RMAuthorStyle1[60] = "color: green; background: silver";
        memset(&RMark, 0, sizeof(KVRevisionMark));
        KVStructInit(&RMark);
        RMark.nAuthorStyles = 2;
        RMark.ppAuthorStyles = (char **)malloc(sizeof(char *)*2);
        if(!RMark.ppAuthorStyles) return(1);
        RMark.ppAuthorStyles[0] = RMAuthorStyle0;
        RMark.ppAuthorStyles[1] = RMAuthorStyle1;
    (*fpHTMLConfig)(pKVHTML, KVCFG_INCLREVISIONMARK, TRUE, &RMark))

If there are more reviewers than defined styles, KeyView applies all available styles to the reviewers in the order in which they are encountered in the document, and then applies styles starting from the beginning of the list to the remaining reviewers. This process is repeated until all reviewers' edits are highlighted.

NOTE: KeyView does not validate styles. They are written directly to the HTML output.

## Generate a Revision Summary

You can configure Export to summarize the changes made to a document in a revision summary file that is generated during the HTML conversion. The summary file is created in the directory where the HTML output is generated. The default file name is `output_filename``.revsum.htm` . You can customize this file name by using the `fpGetAnchor` callback function. See GetAnchor().

To create a revision summary file, set the `bCreateSummary` flag to `TRUE` in the `KVRevisionMark` structure, and use the `pszRevSumStartBlock` and `pszRevSumEndBlock` members to define the markup and tokens inserted at the beginning and end of the revision summary file.

For example:

    KVRevisionMark    RMark;
    char              RMStartBlock[500] = "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> <html> <body>";
    char              RMEndBlock[30] = "</body> </html>";
        memset(&RMark, 0, sizeof(KVRevisionMark));
        KVStructInit(&RMark);
        RMark.pszRevSumStartBlock = RMStartBlock;
        RMark.pszRevSumEndBlock = RMEndBlock;
        RMark.bCreateSummary = TRUE;
    (*fpHTMLConfig)(pKVHTML, KVCFG_INCLREVISIONMARK, TRUE, &RMark))

_FT_HTML5_bannerTitle.htm