Skip to content
Snippets Groups Projects
Commit e161f370 authored by Jonathan Schöbel's avatar Jonathan Schöbel
Browse files

improved demo program

The demo program now uses some of the new functionality.
parent 75d83bf1
No related branches found
No related tags found
No related merge requests found
......@@ -28,12 +28,12 @@ long_line_behaviour=1
long_line_column=72
[files]
current_page=34
current_page=4
FILE_NAME_0=139;None;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2FREADME;0;8
FILE_NAME_1=134;None;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2F.gitignore;0;8
FILE_NAME_2=1751;Sh;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fconfigure.ac;0;8
FILE_NAME_3=73;Make;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2FMakefile.am;0;8
FILE_NAME_4=1143;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Fmain.c;0;8
FILE_NAME_4=5627;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Fmain.c;0;8
FILE_NAME_5=747;Make;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2FMakefile.am;0;8
FILE_NAME_6=1593;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fcms.c;0;8
FILE_NAME_7=901;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fcms.h;0;8
......
......@@ -27,42 +27,85 @@
#include <sefht/sefht.h>
int main(int argc, char **argv)
static inline
void
test_html_generation ()
{
page_t page;
/* startup */
SH_Cms * cms = SH_Cms_new (NULL);
/* startup */
page = SH_Cms_register_page (cms, "Startpage", NULL);
/* shutdown */
SH_Cms_free (cms);
/* shutdown */
(void) argc;
(void) argv;
(void) page;
SH_Data * data;
SH_Fragment * root;
SH_Fragment * child1;
SH_Fragment * child2;
SH_Fragment * child3;
SH_Text * text;
data = SH_Data_new (NULL);
root = SH_NodeFragment_new ("html", data, NULL);
SH_NodeFragment_append_attr_new ((struct SH_NodeFragment *)root, "lang", "de", NULL);
child1 = SH_NodeFragment_new ("head", data, NULL);
SH_NodeFragment_append_child ((struct SH_NodeFragment *) root,
child1, NULL);
child2 = SH_NodeFragment_new ("meta", data, NULL);
SH_NodeFragment_append_attr_new ((struct SH_NodeFragment *)child2, "charset", "utf-8", NULL);
SH_NodeFragment_append_child ((struct SH_NodeFragment *) child1,
child2, NULL);
child2 = SH_NodeFragment_new ("title", data, NULL);
SH_NodeFragment_append_child ((struct SH_NodeFragment *) child1,
child2, NULL);
child2 = SH_NodeFragment_new ("link", data, NULL);
SH_NodeFragment_append_attr_new ((struct SH_NodeFragment *)child2, "rel", "stylesheet", NULL);
SH_NodeFragment_append_attr_new ((struct SH_NodeFragment *)child2, "type", "text/css", NULL);
SH_NodeFragment_append_attr_new ((struct SH_NodeFragment *)child2, "href", "/global.css", NULL);
SH_NodeFragment_append_child ((struct SH_NodeFragment *) child1,
child2, NULL);
child2 = SH_NodeFragment_new ("link", data, NULL);
SH_NodeFragment_append_attr_new ((struct SH_NodeFragment *)child2, "rel", "stylesheet", NULL);
SH_NodeFragment_append_attr_new ((struct SH_NodeFragment *)child2, "type", "text/css", NULL);
SH_NodeFragment_append_attr_new ((struct SH_NodeFragment *)child2, "href", "index.css", NULL);
SH_NodeFragment_append_child ((struct SH_NodeFragment *) child1,
child2, NULL);
child2 = SH_NodeFragment_new ("meta", data, NULL);
SH_NodeFragment_append_attr_new ((struct SH_NodeFragment *)child2, "name", "author", NULL);
SH_NodeFragment_append_attr_new ((struct SH_NodeFragment *)child2, "content", "Jonathan Schöbel", NULL);
SH_NodeFragment_append_child ((struct SH_NodeFragment *) child1,
child2, NULL);
child2 = SH_NodeFragment_new ("meta", data, NULL);
SH_NodeFragment_append_attr_new ((struct SH_NodeFragment *)child2, "name", "date", NULL);
SH_NodeFragment_append_attr_new ((struct SH_NodeFragment *)child2, "content", "2020-05-16T01:15:49+0200", NULL);
SH_NodeFragment_append_child ((struct SH_NodeFragment *) child1,
child2, NULL);
child2 = SH_NodeFragment_new ("meta", data, NULL);
SH_NodeFragment_append_attr_new ((struct SH_NodeFragment *)child2, "name", "description", NULL);
SH_NodeFragment_append_attr_new ((struct SH_NodeFragment *)child2, "content", "Homepage of www2.xn--schbel-yxa.info", NULL);
SH_NodeFragment_append_child ((struct SH_NodeFragment *) child1,
child2, NULL);
child2 = SH_NodeFragment_new ("meta", data, NULL);
SH_NodeFragment_append_attr_new ((struct SH_NodeFragment *)child2, "name", "keywords", NULL);
SH_NodeFragment_append_attr_new ((struct SH_NodeFragment *)child2, "content", "", NULL);
SH_NodeFragment_append_child ((struct SH_NodeFragment *) child1,
child2, NULL);
child2 = SH_NodeFragment_new ("meta", data, NULL);
SH_NodeFragment_append_attr_new ((struct SH_NodeFragment *)child2, "name", "copyright", NULL);
SH_NodeFragment_append_attr_new ((struct SH_NodeFragment *)child2, "content", "Jonathan Sch&ouml;bel 2020", NULL);
SH_NodeFragment_append_child ((struct SH_NodeFragment *) child1,
child2, NULL);
child2 = SH_NodeFragment_new ("meta", data, NULL);
SH_NodeFragment_append_attr_new ((struct SH_NodeFragment *)child2, "name", "generator", NULL);
SH_NodeFragment_append_attr_new ((struct SH_NodeFragment *)child2, "content", "Bluefish 2.2.7", NULL);
SH_NodeFragment_append_child ((struct SH_NodeFragment *) child1,
child2, NULL);
child1 = SH_NodeFragment_new ("body", data, NULL);
SH_NodeFragment_append_child ((struct SH_NodeFragment *) root,
......@@ -72,6 +115,15 @@ int main(int argc, char **argv)
SH_NodeFragment_append_child ((struct SH_NodeFragment *) child1,
child2, NULL);
child3 = SH_NodeFragment_new ("h1", data, NULL);
SH_NodeFragment_append_child ((struct SH_NodeFragment *) child2,
child3, NULL);
child3 = SH_NodeFragment_new ("nav", data, NULL);
SH_NodeFragment_append_child ((struct SH_NodeFragment *) child2,
child3, NULL);
child2 = SH_NodeFragment_new ("main", data, NULL);
SH_NodeFragment_append_child ((struct SH_NodeFragment *) child1,
child2, NULL);
......@@ -91,11 +143,30 @@ int main(int argc, char **argv)
printf ("\n");
SH_Text_free (text);
SH_Fragment_free (root);
SH_Data_free (data);
return;
}
int main(int argc, char **argv)
{
page_t page;
/* startup */
SH_Cms * cms = SH_Cms_new (NULL);
/* startup */
page = SH_Cms_register_page (cms, "Startpage", NULL);
/* shutdown */
SH_Cms_free (cms);
/* shutdown */
(void) argc;
(void) argv;
(void) page;
test_html_generation ();
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment