HTMLEngine.cs 758 Bytes
Newer Older
Uwe Wienkop's avatar
Uwe Wienkop committed
1
namespace HTML
Uwe Wienkop's avatar
Uwe Wienkop committed
2 3
{
    // HTML engine for generation of a HTML string from an array of HTML tag elements:
Uwe Wienkop's avatar
Uwe Wienkop committed
4

Uwe Wienkop's avatar
Uwe Wienkop committed
5
    public interface ITagged { string TagId { get; } }  // Used to define HTML tag element
Uwe Wienkop's avatar
Uwe Wienkop committed
6

Uwe Wienkop's avatar
Uwe Wienkop committed
7 8 9 10 11 12 13
    public interface INested { object[] Elements { get; } }  // Used to "mark" a HTML tag element as nested
    class Body : ITagged, INested
    {
        public string TagId => "body";
        public Body(params object[] Elements) { this.Elements = Elements; }
        public object[] Elements { get; private set; }
    }
Uwe Wienkop's avatar
Uwe Wienkop committed
14

Uwe Wienkop's avatar
Uwe Wienkop committed
15
    public static class Engine
Uwe Wienkop's avatar
Uwe Wienkop committed
16
    {
Uwe Wienkop's avatar
Uwe Wienkop committed
17 18 19 20
        public static string Generate(params object[] elements)
        {
            // TODO: Your code for (recursive) generation of a HTML string from array "elements" here...
        }
Uwe Wienkop's avatar
Uwe Wienkop committed
21 22
    }
}