Rename templates

This commit is contained in:
Zed 2019-06-24 23:25:21 +02:00
parent 2ee79e7970
commit 6c5f491ee0
5 changed files with 41 additions and 42 deletions

View file

@ -2,7 +2,9 @@ import asyncdispatch, asyncfile, httpclient, strutils, strformat, uri, os
import jester import jester
import api, utils, types, cache, formatters import api, utils, types, cache, formatters
import views/[user, general, conversation]
include views/"user.nimf"
include views/"general.nimf"
const cacheDir {.strdefine.} = "/tmp/nitter" const cacheDir {.strdefine.} = "/tmp/nitter"

View file

@ -1,38 +0,0 @@
#? stdtmpl(subsChar = '$', metaChar = '#')
#import xmltree, strutils, uri
#import ../types, ../formatters, ./tweet
#
#proc renderConversation*(conversation: Conversation): string =
<div class="conversation" id="tweets">
<div class="main-thread">
#if conversation.before.len > 0:
<div class="before-tweet">
#for tweet in conversation.before:
${renderTweet(tweet)}
#end for
</div>
#end if
<div class="main-tweet">
${renderTweet(conversation.tweet)}
</div>
#if conversation.after.len > 0:
<div class="after-tweet">
#for tweet in conversation.after:
${renderTweet(tweet)}
#end for
</div>
#end if
</div>
#if conversation.replies.len > 0:
<div class="replies">
#for thread in conversation.replies:
<div class="thread">
#for tweet in thread:
${renderTweet(tweet)}
#end for
</div>
#end for
</div>
#end if
</div>
#end proc

View file

@ -1,5 +1,4 @@
#? stdtmpl(subsChar = '$', metaChar = '#') #? stdtmpl(subsChar = '$', metaChar = '#')
#import user
#import xmltree #import xmltree
# #
#proc renderMain*(body: string; title="Nitter"): string = #proc renderMain*(body: string; title="Nitter"): string =

View file

@ -1,7 +1,7 @@
#? stdtmpl(subsChar = '$', metaChar = '#') #? stdtmpl(subsChar = '$', metaChar = '#')
#import xmltree, strutils, uri, htmlgen #import xmltree, strutils, uri
#import ../types, ../formatters, ../utils #import ../types, ../formatters, ../utils
#import ./tweet #include "tweet.nimf"
# #
#proc renderProfileCard*(profile: Profile): string = #proc renderProfileCard*(profile: Profile): string =
#let pic = profile.getUserpic().getSigUrl("pic") #let pic = profile.getUserpic().getSigUrl("pic")
@ -103,3 +103,39 @@
</div> </div>
</div> </div>
#end proc #end proc
#
#proc renderConversation*(conversation: Conversation): string =
<div class="conversation" id="tweets">
<div class="main-thread">
#if conversation.before.len > 0:
<div class="before-tweet">
#for tweet in conversation.before:
${renderTweet(tweet)}
#end for
</div>
#end if
<div class="main-tweet">
${renderTweet(conversation.tweet)}
</div>
#if conversation.after.len > 0:
<div class="after-tweet">
#for tweet in conversation.after:
${renderTweet(tweet)}
#end for
</div>
#end if
</div>
#if conversation.replies.len > 0:
<div class="replies">
#for thread in conversation.replies:
<div class="thread">
#for tweet in thread:
${renderTweet(tweet)}
#end for
</div>
#end for
</div>
#end if
</div>
</div>
#end proc