/Library/Templates/HTML_Compress/HTML_Compress_5/MLAB.hce
0,0 → 1,339
<hcax version="1">
<file ID="HTML" Name="MS Word HTML (*.htm;*.html)" Wildcard="*.htm;*.html" RemoveComments="0" IgnoreUnknownTags="1" cssc="breakstyle:None" PostOptimizeHandler="WordOnPostOptimize" PreFileHandler="WordOnPreFile">
<tag Name="__default" DeleteTag="0" RemoveQuote="1" PackString="1" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="0" />
<tag Name=style DeleteTag="1" RemoveQuote="0" PackString="2" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="0" OnParseContent="RemoveStyleContent" />
<tag Name=/style DeleteTag="1" RemoveQuote="0" PackString="0" Container="0" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1" />
<tag Name=body DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1">
<attrs Name=link DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1" />
<attrs Name=vlink DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1" />
</tag>
<tag Name=div DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1">
<attrs Name=class DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1" ReplaceWith="div class=&quot;Text&quot;">
<attr Name=Class MatchName=0 Value=Section MatchValue=mvContains />
</attrs>
</tag>
<tag Name=h1 DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1">
<attrs Name=style DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1" />
<attrs Name=align DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1" />
</tag>
<tag Name=h2 DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1">
<attrs Name=style DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1" />
<attrs Name=align DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1" />
</tag>
<tag Name=h3 DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1">
<attrs Name=style DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1" />
<attrs Name=align DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1" />
</tag>
<tag Name=h4 DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1">
<attrs Name=style DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1" />
<attrs Name=align DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1" />
</tag>
<tag Name=img DeleteTag="0" RemoveQuote="0" PackString="1" Container="0" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1">
<attrs Name=align DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="1" Container="0" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1" />
<attrs Name=hspace DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="1" Container="0" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1" />
<attrs Name=style DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="1" Container="0" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1" />
</tag>
<tag Name=td DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1">
<attrs Name=width DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1" />
<attrs Name=valign DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1" />
<attrs Name=style DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1" />
</tag>
<tag Name=table DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1">
<attrs Name=class DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1">
<attr Name=class MatchName=1 Value=Mso MatchValue=mvContains />
</attrs>
<attrs Name=style DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1" />
<attrs Name=border DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1" />
<attrs Name=cellspacing DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1" />
<attrs Name=cellpadding DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1" />
</tag>
<tag Name=tr DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1">
<attrs Name=style DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1" />
</tag>
<tag Name=ul DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1">
<attrs Name=style DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1" />
<attrs Name=type DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1" />
</tag>
<tag Name=li DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1">
<attrs Name=class DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1">
<attr Name=class MatchName=0 Value=MsoNormal MatchValue=mvEqual />
</attrs>
</tag>
<tag Name=p DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1">
<attrs Name=class DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="0" ReplaceWith="p class=&quot;Subtitle&quot;" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1">
<attr MatchName=0 Value=MsoSubtitle MatchValue=mvEqual />
</attrs>
<attrs Name=class DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1">
<attr Name=class MatchName=0 Value=MsoNormal MatchValue=mvEqual />
</attrs>
<attrs Name=class DeleteAttr="1" DeleteTag="0" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1">
<attr Name=class MatchName=0 Value=MsoHeader MatchValue=mvEqual />
</attrs>
<attrs Name=style DeleteAttr="0" DeleteTag="1" RemoveQuote="0" PackString="0" Container="1" RemovePrecedingWhitespace="2" DeleteEmptyAttr="1" />
</tag>
</file>
<script version="0">const
Indent = ' ';//#32#32;
Format = True;
RemoveStyleWidth = False;
RemoveEmptyTags = True;
var
blocktags: TStringList;
inlinetags: TStringList;
Level: Integer;
procedure Initialize;
begin
blocktags := TStringList.Create;
blocktags.Add('html');
blocktags.Add('body');
blocktags.Add('head');
blocktags.Add('td');
blocktags.Add('table');
blocktags.Add('tbody');
 
inlinetags := TStringList.Create;
inlinetags.Add('a');
inlinetags.Add('b');
inlinetags.Add('i');
inlinetags.Add('img');
inlinetags.Add('span');
inlinetags.Add('sup');
inlinetags.Add('big');
inlinetags.Add('small');
end;
 
procedure Finalize;
begin
blocktags.Clear;
blocktags.Free;
inlinetags.Clear;
inlinetags.Free;
end;
 
function GetIndentStr: String;
var
i: Integer;
begin
Result := '';
for i := 0 to Level - 1 do
Result := Result + Indent;
end;
 
function InLineTag: Boolean;
begin
result := inlinetags.IndexOf(NodeClass.Name) &gt;= 0;
end;
 
function BlockEndTag: Boolean;
begin
result := blocktags.IndexOf(Copy(NodeClass.Name, 2, Length(NodeClass.Name) -1)) &gt;= 0;
end;
 
function BlockTag: Boolean;
begin
result := blocktags.IndexOf(NodeClass.Name) &gt;= 0;
end;
 
function EndTag: Boolean;
begin
result := Copy(NodeClass.Name, 1, 1) = '/';
end;
 
procedure GoToBeginning;
begin
// go to beginning
while NodeClass.PreviousNode do
;
end;
 
procedure NewIndentedLine;
var
i: Integer;
begin
NodeClass.PreviousNode;
if NodeClass.NodeType = ntText then
begin
i := Length(NodeClass.Name);
while (i &gt; 0) and (NodeClass.Name = #32) do
begin
i := i - 1;
end;
if (i = 0) then
NodeClass.Delete
else
NodeClass.Name := Copy(NodeClass.Name, 1, i);
end;
NodeClass.Add;
Nodeclass.NextNode;
NodeClass.NodeType := ntCustom;
NodeClass.Name := #13#10 + GetIndentStr;
NodeClass.NextNode;
end;
 
procedure DoFormat;
begin
GoToBeginning;
// new line per item
while NodeClass.NextNode do
begin
if (NodeClass.NodeType = ntTag) then
begin
if EndTag then
begin
if BlockEndTag then
begin
Level := Level - 1;
NewIndentedLine;
end;
end
else
begin
if not InLineTag then
begin
NewIndentedLine;
end;
if BlockTag then Level := Level + 1;
end;
end;
end;
end;
 
procedure WordOnPreFile(var S: String; var Pos: Integer);
var
i: Integer;
c: Integer;
begin
Level := 0;
i := Length(S);
while i &gt; 0 do
begin
if S[i] = #$A0 then s[i] := #32
else if SameTextLi(S, '&amp;nbsp;', i, 1, 6) then
begin
for c := i to i + 5 do
s[c] := ' ';
end;
i := i - 1;
end;
end;
 
procedure WordOnPostOptimize;
var
starttag, endtagname: String;
begin
// remove empty paragraphs with &amp;nbsp;
while NodeClass.NextNode do
begin
if NodeClass.NodeType = ntText then
begin
if (NodeClass.Name = '&amp;nbsp;') or (NodeClass.Name = ' ') then
begin
if NodeClass.NextNode and // check next node is an end node
(NodeClass.NodeType = ntTag) and EndTag then
begin
endtagname := NodeClass.Name;
// go back find start node
if NodeClass.PreviousNode then // text (&amp;nbsp;) node
begin
if NodeClass.PreviousNode then // NodeClass.NodeType = ntTag
begin
while NodeClass.NodeType = ntAttribute do
begin
NodeClass.PreviousNode;
end;
starttag := NodeClass.Name;
if (NodeClass.NodeType = ntTag)
and ('/' + starttag = endtagname) then
begin
// delete start tag
NodeClass.Delete;
NodeClass.NextNode;
// delete any attributes
while NodeClass.NodeType = ntAttribute do
begin
NodeClass.Delete;
NodeClass.NextNode;
end;
// delete text
NodeClass.Delete;
// delete end tag
NodeClass.NextNode;
NodeClass.Delete;
NodeClass.NextNode;
end
else
begin
NodeClass.NextNode; // node
// attributes
while NodeClass.NodeType = ntAttribute do
begin
// NodeClass.Delete; // by default it goes backwards first
NodeClass.NextNode;
end;
NodeClass.NextNode; // text
end;
end
else
begin
NodeClass.NextNode;
end;
end
end;
end;
end;
end; { while }
 
GoToBeginning;
 
if RemoveStyleWidth then
while NodeClass.NextNode do
begin
if (NodeClass.NodeType = ntAttribute) and
(SameText(NodeClass.Name, 'style') or
SameText(NodeClass.Name, 'width')) then
begin
NodeClass.Delete;
end;
end; { while }
 
GoToBeginning;
 
// remove empty tags
if RemoveEmptyTags then
while NodeClass.NextNode do
begin
if NodeClass.NodeType = ntTag then
begin
starttag := NodeClass.Name;
if NodeClass.NextNode and EndTag and (NodeClass.name = '/' + Starttag)
then
begin
NodeClass.Delete;
NodeClass.Delete;
end;
end;
end;
 
if Format then DoFormat;
end;
 
procedure RemoveStyleContent(S: String; var Pos: Integer);
begin
while Pos &lt; Length(S) do
begin
if (SameTextLi(s, '&lt;/style&gt;', pos, 1, 8)) then
begin
Break;
end
Pos := Pos + 1;
end;
end;
 
begin
Level := 0;
Initialize;
end.</script>
</hcax>