using ReportGeneration.Interface; namespace ReportGeneration.Generators; internal static class HtmlTools { public static string Wrap(string tag, string? content, string? @class = default) => $"<{tag} class={@class}>{content}"; public static string FormatImage(string path, string? @class = default, IBounds? bounds = default) { var style = bounds is null ? string.Empty : GetCssStyle(bounds); path += path.EndsWith(".png") ? string.Empty : ".png"; return $""; } private static string GetCssStyle(IBounds bounds) { var style = string.Empty; // Width if (bounds.Width.HasValue) { style += $"width:{bounds.Width}{bounds.Unit};"; } if (bounds.MinWidth.HasValue) { style += $"min-width:{bounds.MinWidth}{bounds.Unit};"; } if (bounds.MaxWidth.HasValue) { style += $"max-width:{bounds.MaxWidth}{bounds.Unit};"; } // Height if (bounds.Height.HasValue) { style += $"height:{bounds.Height}{bounds.Unit};"; } if (bounds.MinHeight.HasValue) { style += $"min-height:{bounds.MinHeight}{bounds.Unit};"; } if (bounds.MaxHeight.HasValue) { style += $"max-height:{bounds.MaxHeight}{bounds.Unit};"; } return style; } }