{"id":176,"date":"2011-05-09T22:10:49","date_gmt":"2011-05-09T20:10:49","guid":{"rendered":"http:\/\/hen.co.za\/blog\/?p=176"},"modified":"2011-05-09T22:10:49","modified_gmt":"2011-05-09T20:10:49","slug":"htmlwriter-1-3","status":"publish","type":"post","link":"https:\/\/hen.co.za\/blog\/2011\/05\/htmlwriter-1-3\/","title":{"rendered":"HTMLWriter 1.3"},"content":{"rendered":"<p>This is another iteration of my HTMLWriter library. A few new methods\u00a0 have been added and a whole lot of code comments added for those that like documentation \ud83d\ude09<\/p>\n<p>A new constructor has been added for those that want to enable auto formatting from the beginning.<\/p>\n<blockquote><p><span style=\"color: #0000ff;\">public <\/span>HTMLWriter(<span style=\"color: #0000ff;\">string <\/span>documentTitle, <span style=\"color: #0000ff;\">bool <\/span>enableAutoFormatting) : <span style=\"color: #0000ff;\">base<\/span>(documentTitle)<br \/>\n{<\/p>\n<p style=\"padding-left: 30px;\">AutoFormatting = enableAutoFormatting;<br \/>\nAutoIndentation = enableAutoFormatting;<\/p>\n<p>}<\/p><\/blockquote>\n<p>Two new variants of the AppendTagEnd method have been added to make life easier.<\/p>\n<blockquote><p><span style=\"color: #0000ff;\">public <\/span>HTMLWriter AppendTagEnd(<span style=\"color: #0000ff;\">int <\/span>tagCountToClose)<br \/>\n{<\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\">for <\/span>(<span style=\"color: #0000ff;\">int <\/span>i = 0; i &lt; tagCountToClose; i++)<br \/>\n{<\/p>\n<p style=\"padding-left: 60px;\">AppendTagEnd();<\/p>\n<p style=\"padding-left: 30px;\">}<br \/>\n<span style=\"color: #0000ff;\">return this<\/span>;<\/p>\n<p>}<\/p>\n<p><span style=\"color: #0000ff;\">public <\/span>HTMLWriter AppendAllEndTagsUntil(<span style=\"color: #0000ff;\">string <\/span>tagName)<br \/>\n{<\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\">while <\/span>(tags.Count &gt; 0)<br \/>\n{<\/p>\n<p style=\"padding-left: 60px;\"><span style=\"color: #0000ff;\">string <\/span>tagNameToPop = tags.Pop();<br \/>\nAppendTagEndInternal(tagNameToPop, <span style=\"color: #0000ff;\">false<\/span>);<br \/>\n<span style=\"color: #0000ff;\">if <\/span>(tagNameToPop == tagName)<\/p>\n<p style=\"padding-left: 90px;\">break;<\/p>\n<p style=\"padding-left: 30px;\">}<br \/>\n<span style=\"color: #0000ff;\">return this<\/span>;<\/p>\n<p>}<\/p><\/blockquote>\n<p>Additionally I added the <a title=\"Escape text\" href=\"https:\/\/hen.co.za\/blog\/2011\/05\/escaping-text-in-html\/\">EscapeText<\/a> method to help format html text properly for characters that might need &#8216;escaping&#8217;.<\/p>\n<p>Find version 1.3 <a title=\"HTMLWriter 1.3\" href=\"http:\/\/www.hen.co.za\/downloads\/HTMLWriter1.3.zip\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is another iteration of my HTMLWriter library. A few new methods\u00a0 have been added and a whole lot of code comments added for those that like documentation \ud83d\ude09 A new constructor has been added for those that want to &hellip;<\/p>\n<p class=\"read-more\"><a href=\"https:\/\/hen.co.za\/blog\/2011\/05\/htmlwriter-1-3\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[7,8,9,303],"class_list":["post-176","post","type-post","status-publish","format-standard","hentry","category-development","tag-net","tag-c","tag-code","tag-development"],"_links":{"self":[{"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/posts\/176","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/comments?post=176"}],"version-history":[{"count":5,"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/posts\/176\/revisions"}],"predecessor-version":[{"id":181,"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/posts\/176\/revisions\/181"}],"wp:attachment":[{"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/media?parent=176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/categories?post=176"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/tags?post=176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}