The html template is compiled into the application as a resource. fragment of the HTML template looks like this:
<A href="%PANELLINK%" target="_blank">
<IMG border="0" src="%PANELIMAGE%" style="%IMAGESTYLE%">
</A><BR>
%CAPTIONTEXT%
I like this because the larger HTML resource file contains style, absence-quirks mode, etc.
But, as always, they now want the Anchor tag to be skipped if there is no link. In addition, if there is no header, then the BR tag should be omitted.
Technology in question Nº1
Given that I don't want to create whole HTML snippets in C # code, I looked at something like:
%ANCHORSTARTTAGPREFIX%<A href="%PANELLINK%" target="_blank">%ANCHORSTARTTAGPOSTFIX%
<IMG border="0" src="%PANELIMAGE%" style="%IMAGESTYLE%">
%ANCHORENDTAGPREFIX%</A>%ANCHORENDTAGPOSTFIX%CAPTIONPREFIX%<BR>
%CAPTIONTEXT%%CAPTIONPOSTFIX%
with the thought that I can use pre and postfixes to turn the HTML into:
<IMG border="0" src="%PANELIMAGE%" style="%IMAGESTYLE%">
But this is just ridiculous, plus one responder reminds us that it takes up bandwidth and may be a mistake.
Technology in question Nº2
Wholesale Tag Replacement:
%AnchorStartTag%
<IMG border="0" src="%PANELIMAGE%" style="%IMAGESTYLE%">
%AnchorEndTag%%CaptionStuff%
and running find-replace to change
%AnchorStartTag%
from
"<A href=\"foo\" target=\"blank\""
Nº3
HTML:
<A id="anchor" href="%PANELLINK%" target="_blank">
<IMG border="0" src="%PANELIMAGE%" style="%IMAGESTYLE%">
</A><BR id="captionBreak">
%CAPTIONTEXT%
HTML DOM . HTML DOM. HTML xhtml, / XML- DOM.
Nº4
:
private const String htmlEmptyTemplate =
@"<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.01//EN\"""+Environment.NewLine+
@" ""http://www.w3.org/TR/html4/strict.dtd"">"+Environment.NewLine+
@"<HTML>"+Environment.NewLine+
@"<HEAD>"+Environment.NewLine+
@" <TITLE>New Document</TITLE>"+Environment.NewLine+
@" <META http-equiv=""X-UA-Compatible"" content=""IE=edge"">"""+Environment.NewLine+
@" <META http-equiv=""Content-Type"" content=""text/html; charset=UTF-8"">"+Environment.NewLine+
@"</HEAD>"+Environment.NewLine+
@""+Environment.NewLine+
@"<BODY style=""margin: 0 auto"">"+Environment.NewLine+
@" <DIV style=""text-align:center;"">"+Environment.NewLine+
@" %ContentArea%"+Environment.NewLine+
@" </DIV>" + Environment.NewLine +
@"</BODY>" + Environment.NewLine +
@"</HTML>";
private const String htmlAnchorStartTag =
@"<A href=""%PANELLINK%"" target=""_blank"">";
private const String htmlImageTag =
@"<IMG border=""0"" src=""%PANELIMAGE%"" style=""%IMAGESTYLE%"">";
private const String htmlCaptionArea =
@"<BR>%CAPTIONTEXT%";
. HTML - . , , - . - am .