From 7d65ce8c8e304dc8367f4492948514f2acc07a3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Fri, 17 Sep 2021 23:47:58 +0200 Subject: Whatever --- t/err.t | 4 +++- t/err.tc | 6 ++++-- t/front.t | 24 ++++++++++++++---------- t/front.tc | 34 +++++++++++++++++++++++----------- t/post.t | 13 ++++++++----- t/post.tc | 19 ++++++++++++++----- t/user.t | 4 +++- t/user.tc | 6 ++++-- 8 files changed, 73 insertions(+), 37 deletions(-) (limited to 't') diff --git a/t/err.t b/t/err.t index 437effc..9a4aa61 100644 --- a/t/err.t +++ b/t/err.t @@ -1,2 +1,4 @@ +<% #include "head.tc" %>

<%= title %>

-

<%= err %>

\ No newline at end of file +

<%= err %>

+<% #include "foot.tc" %> \ No newline at end of file diff --git a/t/err.tc b/t/err.tc index c4369a9..c066a5a 100644 --- a/t/err.tc +++ b/t/err.tc @@ -1,5 +1,7 @@ -printf("

"); +#include "head.tc" +printf("\n

"); printf("%s", title ); printf("

\n

"); printf("%s", err ); -printf("

"); +printf("

\n"); +#include "foot.tc" diff --git a/t/front.t b/t/front.t index a9badb0..86b8fb5 100644 --- a/t/front.t +++ b/t/front.t @@ -1,20 +1,24 @@ +<% #include "head.tc" %>

<%= site.name %>

Thanks for the <%= getenv("REQUEST_METHOD") %> request!

- - - - <% - char *p, *v; - while(p = nextparam(GET, 512)){ - v = split(p); + struct post *post; + struct user *user; + + while(post = getpost(stmt, 0)){ + user = getuser(byid("users", post->user), 1); %> - - + + <% } %> -
KeyValue
<%= p %><%= v %>user); %>"><%= + user->name + %>id); %>"><%= + post->subject + %>
\ No newline at end of file + +<% #include "foot.tc" %> \ No newline at end of file diff --git a/t/front.tc b/t/front.tc index d7afb7b..f95d8cb 100644 --- a/t/front.tc +++ b/t/front.tc @@ -1,17 +1,29 @@ -printf("

"); +#include "head.tc" +printf("\n

"); printf("%s", site.name ); printf("

\n

Thanks for the "); printf("%s", getenv("REQUEST_METHOD") ); -printf(" request!

\n\n \n \n \n \n "); - char *p, *v; - while(p = nextparam(GET, 512)){ - v = split(p); +printf(" request!

\n
KeyValue
\n "); + struct post *post; + struct user *user; -printf("\n \n \n \n \n "); + while(post = getpost(stmt, 0)){ + user = getuser(byid("users", post->user), 1); + +printf("\n \n \n \n \n "); } -printf("\n
"); -printf("%s", p ); -printf(""); -printf("%s", v ); -printf("
user); +printf("\">"); +printf("%s", + user->name + ); +printf("id); +printf("\">"); +printf("%s", + post->subject + ); +printf("
"); +printf("\n\n"); +#include "foot.tc" diff --git a/t/post.t b/t/post.t index 83529d7..b4d1e52 100644 --- a/t/post.t +++ b/t/post.t @@ -1,13 +1,16 @@ +<% #include "head.tc" %>

Post <% printf("%d", id); %>: <%= post->subject %>

-

From: <%= user->full? user->full: "" %> <% -if(user->full) printf("<"); -%>id); %>"><%= user->name %><% -if(user->full) printf(">"); %> +

From: <%= user->full? user->full: "" %> +<% if(user->full) printf("<"); %>id); %>"><%= user->name %><% if(user->full) printf(">"); %>
Date: <% printdate(post->created); %> <% if(post->edited){ printf("
Edited: "); printdate(post->edited); } %> +<% if(post->parent){ %> +
In Reply To: parent); %>"><% printf("%d", post->parent); %> +<% } %>

 <%= post->text %>
-
\ No newline at end of file + +<% #include "foot.tc" %> \ No newline at end of file diff --git a/t/post.tc b/t/post.tc index 732f0a7..9207de5 100644 --- a/t/post.tc +++ b/t/post.tc @@ -1,12 +1,12 @@ -printf("

Post "); +#include "head.tc" +printf("\n

Post "); printf("%d", id); printf(": "); printf("%s", post->subject ); printf("

\n

From: "); printf("%s", user->full? user->full: "" ); -printf(" "); -if(user->full) printf("<"); - +printf("\n"); +if(user->full) printf("<"); printf("id); printf("\">"); @@ -20,6 +20,15 @@ if(post->edited){ printf("
Edited: "); printdate(post->edited); } +printf("\n"); +if(post->parent){ +printf("\n
In Reply To:
parent); +printf("\">"); +printf("%d", post->parent); +printf("\n"); +} printf("\n

\n");
 printf("%s",  post->text );
-printf("\n
"); +printf("\n\n"); +#include "foot.tc" diff --git a/t/user.t b/t/user.t index 9a0fd49..af7c8cd 100644 --- a/t/user.t +++ b/t/user.t @@ -1 +1,3 @@ -

User <% printf("%d", id); %>: <%= user->name %>

\ No newline at end of file +<% #include "head.tc" %> +

User <% printf("%d", id); %>: <%= user->name %>

+<% #include "foot.tc" %> \ No newline at end of file diff --git a/t/user.tc b/t/user.tc index 3d92e16..3527acb 100644 --- a/t/user.tc +++ b/t/user.tc @@ -1,5 +1,7 @@ -printf("

User "); +#include "head.tc" +printf("\n

User "); printf("%d", id); printf(": "); printf("%s", user->name ); -printf("

"); +printf("\n"); +#include "foot.tc" -- cgit v1.2.3