HTMLWriter 1.3

This is another iteration of my HTMLWriter library. A few new methods  have been added and a whole lot of code comments added for those that like documentation 😉

A new constructor has been added for those that want to enable auto formatting from the beginning.

public HTMLWriter(string documentTitle, bool enableAutoFormatting) : base(documentTitle)
{

AutoFormatting = enableAutoFormatting;
AutoIndentation = enableAutoFormatting;

}

Two new variants of the AppendTagEnd method have been added to make life easier.

public HTMLWriter AppendTagEnd(int tagCountToClose)
{

for (int i = 0; i < tagCountToClose; i++)
{

AppendTagEnd();

}
return this;

}

public HTMLWriter AppendAllEndTagsUntil(string tagName)
{

while (tags.Count > 0)
{

string tagNameToPop = tags.Pop();
AppendTagEndInternal(tagNameToPop, false);
if (tagNameToPop == tagName)

break;

}
return this;

}

Additionally I added the EscapeText method to help format html text properly for characters that might need ‘escaping’.

Find version 1.3 here.

  1. Can’t wait to try this out

Leave a Reply

%d bloggers like this: