From 8325a506d62629ffb23f99f9c3f000b808b8239a Mon Sep 17 00:00:00 2001 From: Relintai Date: Tue, 11 May 2021 18:18:45 +0200 Subject: [PATCH] More work on the readme. --- Readme.md | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/Readme.md b/Readme.md index 9617d5c..b379149 100644 --- a/Readme.md +++ b/Readme.md @@ -44,6 +44,72 @@ If you pass true to it's constructor like `FileCache(true);` that instance will You can evaluate a directory structure using `void wwwroot_evaluate_dir(const char *path, const bool should_exist = true);`. +### Form Validator + +It's a wip class. Doesn't work yet. + +### HTMLBuilder + +Helps with creating htmls. + +It has methods for all standard html tags, and has methods for all closing tags aswell. + +A little example: + +``` + HTMLBuilder b; + + //Add a div, with the class content:
+ b.div()->cls("content"); + + //header html tag:
+ b.header(); + + //just write the string "My webpage" + b.w("My webpage"); + + //Add a span tag, with the class header_link: + b.span()->cls("header_link"); + + //Add a [ into the html: [ + b.w(" [ "); + + //Add a link: + b.a()->href("https://github.com/Relintai"); + + //just write the Github string: Github + b.w("Github"); + + //Close the a tag: + b.ca(); + + //Add a ] into the html: ] + b.w(" ]"); + + //close the header tag
+ b.cheader(); + + //close the content div:
+ b.cdiv(); + + //Finish the currently open tag: + b.write_tag(); + + //print the resulting string + printf("%s\n", b.result.c_str()); +``` + +The resulting html should look like this: +(Note that the generated string doesn't actually have newlines!) + +``` +
+
+ My webpage [ Github ] +
+
+``` + ### Application Think about this class as a complete web application.