even better style xD

This commit is contained in:
Sebastian Hugentobler 2015-05-18 16:36:47 +02:00
parent 07beadbfb9
commit d2a1812a38
6 changed files with 34 additions and 25 deletions

View File

@ -30,7 +30,7 @@ def tohtml(value):
value = re.sub(r'\[url=\/user\/(.*?)\](.*?)\[\/url\]', user_replacer, value) value = re.sub(r'\[url=\/user\/(.*?)\](.*?)\[\/url\]', user_replacer, value)
value = re.sub(r'\[url=(.*?)\](.*?)\[/url\]', r'<a href="\1">\2</a>', value) value = re.sub(r'\[url=(.*?)\](.*?)\[/url\]', r'<a href="\1">\2</a>', value)
value = re.sub(r'\[video\](.*?)\[/video\]', r'<a href="\1">\1</a>', value) value = re.sub(r'\[video\](.*?)\[/video\]', r'<a href="\1">\1</a>', value)
value = re.sub(r'\[color=(.*?)\](.*?)\[/color\]', r'<font color="\1">\2</font>', value) value = re.sub(r'\[colour=(.*?)\](.*?)\[/colour\]', r'<font color="\1">\2</font>', value)
value = re.sub(r'\[b\](.*?)\[/b\]', r'<b>\1</b>', value) value = re.sub(r'\[b\](.*?)\[/b\]', r'<b>\1</b>', value)
value = re.sub(r'\[i\](.*?)\[/i\]', r'<i>\1</i>', value) value = re.sub(r'\[i\](.*?)\[/i\]', r'<i>\1</i>', value)
value = re.sub(r'\[u\](.*?)\[/u\]', r'<u>\1</u>', value) value = re.sub(r'\[u\](.*?)\[/u\]', r'<u>\1</u>', value)
@ -77,7 +77,7 @@ def render_boards(boards, template_board, template_thread, outpath, title):
write_render(rendered_board, os.path.join('board', url_replacer(board['title']) + '.html'), outpath) write_render(rendered_board, os.path.join('board', url_replacer(board['title']) + '.html'), outpath)
for thread in board['threads']: for thread in board['threads']:
rendered_thread = template_thread.render(thread=thread, title=title + ' - ' + thread['title']) rendered_thread = template_thread.render(board=board, thread=thread, title=title + ' - ' + thread['title'])
write_render(rendered_thread, os.path.join('board', 'thread', url_replacer(thread['title']) + '.html'), outpath) write_render(rendered_thread, os.path.join('board', 'thread', url_replacer(thread['title']) + '.html'), outpath)
render_boards(board['boards'], template_board, template_thread, outpath, title) render_boards(board['boards'], template_board, template_thread, outpath, title)

View File

@ -7,6 +7,10 @@
<title>{{ title }}</title> <title>{{ title }}</title>
</head> </head>
<body> <body>
<ul>
<li><a href="../boards.html">Boards</a></li>
</ul>
<hr>
{% if board.boards |length > 0 %} {% if board.boards |length > 0 %}
<ul> <ul>
{% for board in board.boards %} {% for board in board.boards %}

View File

@ -14,7 +14,7 @@
<ul> <ul>
{% for board in boards %} {% for board in boards %}
<li> <li>
<b><a href={{ "board/" + board.title.replace('/', '_').replace(' ', '_').replace('?', '') + ".html" }}>{{ board.title }}</a></b> <a href={{ "board/" + board.title |url_replacer + ".html" }}>{{ board.title }}</a><br>
<i>{{ board.description }}</i> <i>{{ board.description }}</i>
</li> </li>
{% endfor %} {% endfor %}

View File

@ -7,10 +7,14 @@
<title>{{ title }}</title> <title>{{ title }}</title>
</head> </head>
<body> <body>
<ul>
<li><a href={{ "../" + board.title |url_replacer + ".html" }}>{{ board.title }}</a></li>
</ul>
<hr>
<h1>{{ thread.title }}</h1> <h1>{{ thread.title }}</h1>
{% for post in thread.posts %} {% for post in thread.posts %}
<a href="#{{ loop.index }}">{{ loop.index }} - </a> <a href="#{{ loop.index }}">{{ loop.index }} </a><i>by </i>
<b><a name="{{ loop.index }}" href={{ "../../user/" + post.user.name |url_replacer + ".html" }}>{{ post.user.name }}</a></b> <a name="{{ loop.index }}" href={{ "../../user/" + post.user.name |url_replacer + ".html" }}>{{ post.user.name }}</a>
<i>({{ post.timestamp | fromunixtime }})</i> <i>({{ post.timestamp | fromunixtime }})</i>
<p>{{ post.message | tohtml }}</p> <p>{{ post.message | tohtml }}</p>
{% for attachment in post.attachments %} {% for attachment in post.attachments %}

View File

@ -1,14 +1,16 @@
<!doctype html> <!doctype html>
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width"> <meta name="viewport" content="width=device-width">
<link href="../board/thread/static/styles.css" rel="stylesheet" type="text/css" /> <link href="../board/thread/static/styles.css" rel="stylesheet" type="text/css" />
<title>{{ title }}</title> <title>{{ title }}</title>
</head> </head>
<body> <body>
<ul>
<li><a href="../users.html">Users</a></li>
</ul>
<hr>
<h1>{{ user.name }}</h1> <h1>{{ user.name }}</h1>
<h3>{{ user.status }}</h3> <h3>{{ user.status }}</h3>
<p> <p>
@ -18,5 +20,4 @@
<hr> <hr>
<i>{{ user.signature | tohtml }}</i> {% endif %} <i>{{ user.signature | tohtml }}</i> {% endif %}
</body> </body>
</html> </html>

View File

@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width"> <meta name="viewport" content="width=device-width">
<link href="../../board/thread/static/styles.css" rel="stylesheet" type="text/css" /> <link href="board/thread/static/styles.css" rel="stylesheet" type="text/css" />
<title>{{ title }}</title> <title>{{ title }}</title>
</head> </head>
<body> <body>