## defs provided: ## pager(page, numpages) - [Prev] [0] [1] [2] [3] [Next] ## singlepost(post, threadpage) - one post ## rules(board, thread=None) - the rules underneath the posting form (used internally here) ## postform(board, thread=None) - the posting form ## internal: ## post_name_label(post) - outputs a name (and link, if one is defined) ## post_timestamp_label(post, dateformat=None) - timestamp, with link if one is defined and no name is set. ## dateformat is passed to format_timestamp ## post_label(post, dateformat=None) - post subject, name, timestamp, and poster ID ## sticky_icon() - for a sticky icon ## post_message(post, threadpage=True) - message text of a post. if threadpage is False, long messages are ## abbreviated with a note to that effect. <%! import matsuba.templatetools as tt import extutil # True = index.html, 1.html, 2.html, etc. # False = only index.html THREADLIST_MULTIPAGE = True # True = Wakaba style: # Posts increment globally # Threads served via /board/res/threadid.html # Post id references link to #postid on the thread page # Threads are trimmed # False = Kareha style: # Each thread has a post #1 # Threads are served via /board/read/postrange # Post id references link to a single-post view # Multiple-post ranges are supported in post references # Threads are not trimmed POSTIDS_ABSOLUTE = True # True = a subject is required when posting a new thread # False = subject can be blank REQUIRE_SUBJECT = False # Other pages to generate (catalog, subback, ...) OTHER_PAGES = [('rssreplies', 'rss.xml'), ('catalog', 'catalog.html'), ('subback', 'subback.html')] %> ## ------------------------------------------------------------------------------------------------------------- ## Page list. <%def name="pager(page, numpages)">
% if page == 0: Previous % else:
% endif
## Google-style; trim to 20 pages at most, with current page in middle % for n in xrange(max(0, page - 10), min(numpages, page + 10)): % if n == page: [${n}] % else: [${n}] % endif % endfor % if page >= numpages - 1: Next % else:
% endif
## ------------------------------------------------------------------------------------------------------------- ## Single post. ## vars: ## post = Post object ## threadpage = boolean. Affects post abbreviation, [Reply] link, and amount of file info shown <%def name="singlepost(post, threadpage)"> % if post.id == post.thread.id: ## First post % if post.filename: File: ${post.short_basename|h} -(${(post.fileinfo if threadpage else post.sizeinfo)|h}) ## Thumbnail displayed, click image for full size.
% endif % if post.thumbnail: ${post.sizeinfo|h} % endif % if post.filename: % endif No.${post.id} ${(sticky_icon() if post.sticky else '')} % if not threadpage:   [Reply] % endif ${post_message(post, threadpage)} % else: ## Reply
## TODO: javascript, see above No.${post.id} % if post.filename or post.thumbnail:
% endif % if post.filename: File: ${post.short_basename|h} -(${(post.fileinfo if threadpage else post.sizeinfo)|h}) ## Thumbnail displayed, click image for full size.
% endif % if post.thumbnail: ${post.sizeinfo|h} % endif % if post.filename: % endif ${post_message(post, threadpage)}
% endif ## ------------------------------------------------------------------------------------------------------------- ## Rules. ## vars: ## board = Board object ## thread = Thread object (if applicable) <%def name="rules(board, thread=None)"> ## ------------------------------------------------------------------------------------------------------------- ## Posting form. ## vars: ## board = Board object ## thread = Thread object (if applicable) <%def name="postform(board, thread=None)">
Spam trap (don't touch):
% if board.forced_anon: % else: % endif % if board.all_filetypes(thread is not None): % endif % if caller and hasattr(caller, 'form_append'): ${caller.form_append(board, thread)} % endif
Name
Link
Subject
Comment
File
${rules(board, thread)}

## ------------------------------------------------------------------------------------------------------------- ## misc little stuff ## Just the name <%def name="post_name_label(post)"> ${tt.format_name_trip(post.name_trip, ['', ''], ['', ''], post.link)} ## Just the timestamp <%def name="post_timestamp_label(post, dateformat=None)"> % if post.link and not filter(None, post.name_trip): ${tt.timestamp(post, dateformat)} % else: ${tt.timestamp(post, dateformat)} % endif ## All together now! <%def name="post_label(post, dateformat=None)"> % if post.subject: ${post.subject|h} % endif ${post_name_label(post)} ${post_timestamp_label(post, dateformat)} % if post.idcode: ID:${post.idcode|h} % endif ## Sticky icon <%def name="sticky_icon()"> Sticky ## Post message, with abbreviation if not on a thread page <%def name="post_message(post, threadpage=True)"><% if threadpage: abbrev = None else: abbrev = extutil.abbreviate_html(post.message) %>
${abbrev or post.message} % if abbrev: ## Kareha: Post too long. Click to view the whole post or the thread page. ## Shiichan: (Post truncated.)

Comment too long. Click here to view the full text.

% endif