Skip to content

Commit

Permalink
update code
Browse files Browse the repository at this point in the history
  • Loading branch information
Maniceraf committed Jun 15, 2024
1 parent 07d57f4 commit e2d3420
Show file tree
Hide file tree
Showing 18 changed files with 191 additions and 128 deletions.
18 changes: 9 additions & 9 deletions EasyHtmlToolkit.Test/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,33 @@ public static void Example1()
{
var doc = new HtmlDocument();

var table = new HtmlTable();
var table = new TableTag();

var tableHeader = new HtmlTableHeader();
var tableHeader = new TheadTag();

var tr = new HtmlTr();
var tr = new TrTag();

var th = new HtmlTh("Month");
var th = new ThTag("Month");

tr.AddChildren(th);

th = new HtmlTh("Savings");
th = new ThTag("Savings");

tr.AddChildren(th);

tableHeader.AddChildren(tr);

var tableBody = new HtmlTableBody();
var tableBody = new TbodyTag();

tr = new HtmlTr();
tr = new TrTag();

tr.AddAttribute("style", "text-align:right");

var td = new HtmlTd("January");
var td = new TdTag("January");

tr.AddChildren(td);

td = new HtmlTd("$100");
td = new TdTag("$100");

tr.AddChildren(td);

Expand Down
21 changes: 21 additions & 0 deletions EasyHtmlToolkit/Enums/ETag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,26 @@ public enum ETag

[Description("span")]
span = 21,

[Description("table")]
table = 22,

[Description("thead")]
thead = 23,

[Description("tbody")]
tbody = 24,

[Description("tfoot")]
tfoot = 25,

[Description("tr")]
tr = 26,

[Description("th")]
th = 27,

[Description("td")]
td = 28,
}
}
9 changes: 0 additions & 9 deletions EasyHtmlToolkit/Models/Elements/HtmlCell.cs

This file was deleted.

14 changes: 0 additions & 14 deletions EasyHtmlToolkit/Models/Elements/HtmlRow.cs

This file was deleted.

28 changes: 0 additions & 28 deletions EasyHtmlToolkit/Models/Elements/HtmlTable.cs

This file was deleted.

11 changes: 0 additions & 11 deletions EasyHtmlToolkit/Models/Elements/HtmlTableBody.cs

This file was deleted.

11 changes: 0 additions & 11 deletions EasyHtmlToolkit/Models/Elements/HtmlTableFooter.cs

This file was deleted.

11 changes: 0 additions & 11 deletions EasyHtmlToolkit/Models/Elements/HtmlTableHeader.cs

This file was deleted.

12 changes: 0 additions & 12 deletions EasyHtmlToolkit/Models/Elements/HtmlTd.cs

This file was deleted.

12 changes: 0 additions & 12 deletions EasyHtmlToolkit/Models/Elements/HtmlTh.cs

This file was deleted.

11 changes: 0 additions & 11 deletions EasyHtmlToolkit/Models/Elements/HtmlTr.cs

This file was deleted.

24 changes: 24 additions & 0 deletions EasyHtmlToolkit/Models/Elements/TableTag.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using EasyHtmlToolkit.Enums;

namespace EasyHtmlToolkit.Models.Elements
{
/// <summary>
/// Represents an HTML <table> element.
/// </summary>
public class TableTag : HtmlElement
{
/// <summary>
/// Initializes a new instance of the <see cref="TableTag"/> class without any inner text.
/// </summary>
public TableTag() : base(ETag.table) { }

/// <summary>
/// Initializes a new instance of the <see cref="TableTag"/> class with the specified inner text.
/// </summary>
/// <param name="value">The inner text of the table.</param>
public TableTag(string value) : base(ETag.table)
{
InnerText = value;
}
}
}
25 changes: 25 additions & 0 deletions EasyHtmlToolkit/Models/Elements/TbodyTag.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using EasyHtmlToolkit.Enums;

namespace EasyHtmlToolkit.Models.Elements
{
/// <summary>
/// Represents an HTML <tbody> element.
/// </summary>
public class TbodyTag : HtmlElement
{
/// <summary>
/// Initializes a new instance of the <see cref="TbodyTag"/> class without any inner text.
/// </summary>
public TbodyTag() : base(ETag.tbody) { }

/// <summary>
/// Initializes a new instance of the <see cref="TbodyTag"/> class with the specified inner text.
/// </summary>
/// <param name="value">The inner text of the tbody.</param>
public TbodyTag(string value) : base(ETag.tbody)
{
InnerText = value;
}
}

}
19 changes: 19 additions & 0 deletions EasyHtmlToolkit/Models/Elements/TdTag.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using EasyHtmlToolkit.Enums;

namespace EasyHtmlToolkit.Models.Elements
{
/// <summary>
/// Represents an HTML <td> element.
/// </summary>
public class TdTag : HtmlElement
{
/// <summary>
/// Initializes a new instance of the <see cref="TdTag"/> class with the specified inner text.
/// </summary>
/// <param name="value">The inner text of the td element.</param>
public TdTag(string value) : base(ETag.td)
{
InnerText = value;
}
}
}
25 changes: 25 additions & 0 deletions EasyHtmlToolkit/Models/Elements/TfootTag.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using EasyHtmlToolkit.Enums;

namespace EasyHtmlToolkit.Models.Elements
{
/// <summary>
/// Represents an HTML <tfoot> element.
/// </summary>
public class TfootTag : HtmlElement
{
/// <summary>
/// Initializes a new instance of the <see cref="TfootTag"/> class without any inner text.
/// </summary>
public TfootTag() : base(ETag.tfoot) { }

/// <summary>
/// Initializes a new instance of the <see cref="TfootTag"/> class with the specified inner text.
/// </summary>
/// <param name="value">The inner text of the tfoot.</param>
public TfootTag(string value) : base(ETag.tfoot)
{
InnerText = value;
}
}

}
19 changes: 19 additions & 0 deletions EasyHtmlToolkit/Models/Elements/ThTag.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using EasyHtmlToolkit.Enums;

namespace EasyHtmlToolkit.Models.Elements
{
/// <summary>
/// Represents an HTML <th> element.
/// </summary>
public class ThTag : HtmlElement
{
/// <summary>
/// Initializes a new instance of the <see cref="ThTag"/> class with the specified inner text.
/// </summary>
/// <param name="value">The inner text of the th element.</param>
public ThTag(string value) : base(ETag.th)
{
InnerText = value;
}
}
}
25 changes: 25 additions & 0 deletions EasyHtmlToolkit/Models/Elements/TheadTag.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using EasyHtmlToolkit.Enums;

namespace EasyHtmlToolkit.Models.Elements
{
/// <summary>
/// Represents an HTML <thead> element.
/// </summary>
public class TheadTag : HtmlElement
{
/// <summary>
/// Initializes a new instance of the <see cref="TheadTag"/> class without any inner text.
/// </summary>
public TheadTag() : base(ETag.thead) { }

/// <summary>
/// Initializes a new instance of the <see cref="TheadTag"/> class with the specified inner text.
/// </summary>
/// <param name="value">The inner text of the thead.</param>
public TheadTag(string value) : base(ETag.thead)
{
InnerText = value;
}
}

}
24 changes: 24 additions & 0 deletions EasyHtmlToolkit/Models/Elements/TrTag.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using EasyHtmlToolkit.Enums;

namespace EasyHtmlToolkit.Models.Elements
{
/// <summary>
/// Represents an HTML <tr> element.
/// </summary>
public class TrTag : HtmlElement
{
/// <summary>
/// Initializes a new instance of the <see cref="TrTag"/> class without any inner text.
/// </summary>
public TrTag() : base(ETag.tr) { }

/// <summary>
/// Initializes a new instance of the <see cref="TrTag"/> class with the specified inner text.
/// </summary>
/// <param name="value">The inner text of the tr.</param>
public TrTag(string value) : base(ETag.tr)
{
InnerText = value;
}
}
}

0 comments on commit e2d3420

Please sign in to comment.