Final changes for version 1.0

This commit is contained in:
Booklordofthedings 2024-12-06 18:48:54 +01:00
parent 31a36815f8
commit 59662f20e6
2 changed files with 33 additions and 9 deletions

View file

@ -6,15 +6,37 @@ class Index : Template
{ {
public this() public this()
{ {
Title = "An aven website"; Title = "An Aven website";
OutputFile = "\\Index.html"; OutputFile = "Index.html";
this.Styles = """
body {
background-color:#89c5bb;
font-family: sans-serif;
font-size: 1.2rem;
}
""";
}
public override void Head(System.String buffer)
{
buffer.Append("<link rel=\"icon\" href=\"favicon.ico\"/>");
} }
public override void Body(HTML body) public override void Body(HTML body)
{ {
body.Children.Add(Div(
H1("Aven Website"), body.Children.Add(Empty(
Div("adssadsadsadsadsad", "asidosadsadsd")..SetValue("Style", "color:red;") H1("Aven"),
)); Hr(),
"Build static websites dynamically using Aven",
Ul(
Li("Fast"),
Li("Easily extendable"),
Li("Leverage the power of a normal programming language instead of just templating")
),
Br(),
A("Aven Repository")..SetValue("href", "https://code.booklordofthe.dev/Booklordofthedings/Aven")
));
} }
} }

View file

@ -56,9 +56,11 @@ class Aven
..Append("<style>") ..Append("<style>")
..Append(page.Styles) ..Append(page.Styles)
..Append("</style>\n") ..Append("</style>\n");
..Append("</head>\n"); page.Head(toWrite);
toWrite.Append("</head>\n");
var body = page.Body(.. Custom("body"))..ToString(toWrite); var body = page.Body(.. Custom("body"))..ToString(toWrite);
delete body; delete body;
@ -76,7 +78,7 @@ class Aven
} }
Directory.CreateDirectory(outDir).IgnoreError(); Directory.CreateDirectory(outDir).IgnoreError();
if (File.WriteAllText(scope $"{outputDir}{page.OutputFile}", toWrite) case .Err) if (File.WriteAllText(scope $"{outputDir}/{page.OutputFile}", toWrite) case .Err)
{ {
Log.Error(scope $"Unable to write to file: {outputDir}{page.OutputFile}"); Log.Error(scope $"Unable to write to file: {outputDir}{page.OutputFile}");
continue; continue;