Skip to content

A way to write html in code without using a template language

License

Notifications You must be signed in to change notification settings

rasberry/EasySgml

Repository files navigation

EasySgml

A way to write html in code without using a template language

Examples

Create a simple page

public class SimpleView : IView
{
	public void Render(TextWriter writer)
	{
		writer.Write("<!DOCTYPE html>");
		var html =
		Sgml.Tag("html").Add(
			Sgml.Tag("head").Add(
				Sgml.Tag("title").AddText("Test Page")
			),
			Sgml.Tag("body").Add(
				Sgml.Tag("div").AddText("Hello World!!")
			)
		);
		html.Write(writer);
	}
}

Create a tag with attributes

var tag = Sgml.Tag("tag","attr1","value1","attr2","value2");

Create a fragment

var pil = Sgml.Pile().Add(...);

Create some html encoded text

var txt = Sgml.Text("Some Text");

Create some raw html text

var htm = Sgml.Html("<span>Some Html</span>");

About

A way to write html in code without using a template language

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages