changeset 153:dd892567f054

Fixes #174: HTML output can add empty tables for stat lines * Check if table has rows before outputting it
author IBBoard <dev@ibboard.co.uk>
date Sat, 26 Sep 2009 19:57:06 +0000
parents 0c0e14f03785
children 4a02c07278e7
files api/Exporters/WarFoundryHtmlExporter.cs
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/api/Exporters/WarFoundryHtmlExporter.cs	Sat Sep 26 19:51:11 2009 +0000
     1.2 +++ b/api/Exporters/WarFoundryHtmlExporter.cs	Sat Sep 26 19:57:06 2009 +0000
     1.3 @@ -56,8 +56,11 @@
     1.4  			body.AppendChild(header);
     1.5  			
     1.6  			foreach (XmlElement table in CreateTables(army, doc))
     1.7 -			{
     1.8 -				body.AppendChild(table);
     1.9 +			{
    1.10 +				if (!IsTableOnlyHeader(table))
    1.11 +				{
    1.12 +					body.AppendChild(table);
    1.13 +				}
    1.14  			}
    1.15  			
    1.16  			StreamWriter writer = new StreamWriter(path, false);
    1.17 @@ -70,6 +73,11 @@
    1.18  			{
    1.19  				writer.Close();
    1.20  			}
    1.21 +		}
    1.22 +
    1.23 +		private bool IsTableOnlyHeader(XmlElement table)
    1.24 +		{
    1.25 +			return table.ChildNodes.Count == 1;
    1.26  		}
    1.27  		
    1.28  		private XmlElement[] CreateTables(Army army, XmlDocument doc)