From 6c5f491ee0d3e5f1882547937870e92a49d3c3ce Mon Sep 17 00:00:00 2001 From: Zed Date: Mon, 24 Jun 2019 23:25:21 +0200 Subject: [PATCH] Rename templates --- src/nitter.nim | 4 ++- src/views/conversation.nim | 38 ----------------------- src/views/{general.nim => general.nimf} | 1 - src/views/{tweet.nim => tweet.nimf} | 0 src/views/{user.nim => user.nimf} | 40 +++++++++++++++++++++++-- 5 files changed, 41 insertions(+), 42 deletions(-) delete mode 100644 src/views/conversation.nim rename src/views/{general.nim => general.nimf} (98%) rename src/views/{tweet.nim => tweet.nimf} (100%) rename src/views/{user.nim => user.nimf} (77%) diff --git a/src/nitter.nim b/src/nitter.nim index d9200c9..2bed905 100644 --- a/src/nitter.nim +++ b/src/nitter.nim @@ -2,7 +2,9 @@ import asyncdispatch, asyncfile, httpclient, strutils, strformat, uri, os import jester import api, utils, types, cache, formatters -import views/[user, general, conversation] + +include views/"user.nimf" +include views/"general.nimf" const cacheDir {.strdefine.} = "/tmp/nitter" diff --git a/src/views/conversation.nim b/src/views/conversation.nim deleted file mode 100644 index aa4ec27..0000000 --- a/src/views/conversation.nim +++ /dev/null @@ -1,38 +0,0 @@ -#? stdtmpl(subsChar = '$', metaChar = '#') -#import xmltree, strutils, uri -#import ../types, ../formatters, ./tweet -# -#proc renderConversation*(conversation: Conversation): string = -
-
- #if conversation.before.len > 0: -
- #for tweet in conversation.before: - ${renderTweet(tweet)} - #end for -
- #end if -
- ${renderTweet(conversation.tweet)} -
- #if conversation.after.len > 0: -
- #for tweet in conversation.after: - ${renderTweet(tweet)} - #end for -
- #end if -
- #if conversation.replies.len > 0: -
- #for thread in conversation.replies: -
- #for tweet in thread: - ${renderTweet(tweet)} - #end for -
- #end for -
- #end if -
-#end proc diff --git a/src/views/general.nim b/src/views/general.nimf similarity index 98% rename from src/views/general.nim rename to src/views/general.nimf index 9ccf7f3..aeacda0 100644 --- a/src/views/general.nim +++ b/src/views/general.nimf @@ -1,5 +1,4 @@ #? stdtmpl(subsChar = '$', metaChar = '#') -#import user #import xmltree # #proc renderMain*(body: string; title="Nitter"): string = diff --git a/src/views/tweet.nim b/src/views/tweet.nimf similarity index 100% rename from src/views/tweet.nim rename to src/views/tweet.nimf diff --git a/src/views/user.nim b/src/views/user.nimf similarity index 77% rename from src/views/user.nim rename to src/views/user.nimf index e9b2699..480e113 100644 --- a/src/views/user.nim +++ b/src/views/user.nimf @@ -1,7 +1,7 @@ #? stdtmpl(subsChar = '$', metaChar = '#') -#import xmltree, strutils, uri, htmlgen +#import xmltree, strutils, uri #import ../types, ../formatters, ../utils -#import ./tweet +#include "tweet.nimf" # #proc renderProfileCard*(profile: Profile): string = #let pic = profile.getUserpic().getSigUrl("pic") @@ -103,3 +103,39 @@ #end proc +# +#proc renderConversation*(conversation: Conversation): string = +
+
+ #if conversation.before.len > 0: +
+ #for tweet in conversation.before: + ${renderTweet(tweet)} + #end for +
+ #end if +
+ ${renderTweet(conversation.tweet)} +
+ #if conversation.after.len > 0: +
+ #for tweet in conversation.after: + ${renderTweet(tweet)} + #end for +
+ #end if +
+ #if conversation.replies.len > 0: +
+ #for thread in conversation.replies: +
+ #for tweet in thread: + ${renderTweet(tweet)} + #end for +
+ #end for +
+ #end if +
+ +#end proc