From ed73cef37914303ca1790a37c6f5bec13b326b1f Mon Sep 17 00:00:00 2001 From: Yorhel Date: Mon, 29 Dec 2008 12:26:25 +0100 Subject: Added [quote] tag formatting, fixed URL parser, and updated d9 --- data/docs/9 | 12 ++++++++++-- data/skingen/style.css | 6 ++++++ lib/ChangeLog | 2 ++ lib/VNDB/Func.pm | 25 +++++++++++++++++++++---- 4 files changed, 39 insertions(+), 6 deletions(-) diff --git a/data/docs/9 b/data/docs/9 index 6029ef1b..fd6da75e 100644 --- a/data/docs/9 +++ b/data/docs/9 @@ -1,11 +1,13 @@ :TITLE:Discussion board -:INC:notfinished :INC:index :SUB:Introduction

- todo... + VNDB has a nicely integrated discussion board which can be used for, well, + discussions. As we're not using any popular and freely available forum software + and have instead written something by ourselves, this discussion board has a + few slight differences with the popular boards you're used to.

@@ -53,6 +55,12 @@
[spoiler]
The [spoiler]-tag should be used to hide information that could spoil the enjoyment of playing the visual novel for people who haven't done so yet. +
[quote]
+ When quoting other people, put the quoted message inside a [quote] .. [/quote] block. Please + note that the popular [quote=source]-syntax doesn't work on VNDB. (yet) +
[raw]
+ Show off your formatting code skills by putting anything you don't want to have formatted in a [raw] + tag. Any of the formatting codes mentioned above are ignored within a [raw] .. [/raw] block.

diff --git a/data/skingen/style.css b/data/skingen/style.css index a9ddd10d..ecbba8a7 100644 --- a/data/skingen/style.css +++ b/data/skingen/style.css @@ -96,6 +96,12 @@ b.spoiler, b.spoiler a { font-weight: normal; } b.spoiler_shown { font-weight: normal } +div.quote { + padding: 1px 5px; + margin: 0px 10px; + color: $grayedout$; + border-left: 1px dotted $border$; +} diff --git a/lib/ChangeLog b/lib/ChangeLog index e0c76517..1f29a195 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -13,6 +13,8 @@ TODO: - [spoiler] tag produces mouseover-style spoilers instead of ROT13 - Fixed tiny timezone-related bug - Re-added release list dropdown on VN pages + - Added [quote] tag to bb2html + - fixed URL parser in bb2html 2.0 - 2008-12-20 - New layout diff --git a/lib/VNDB/Func.pm b/lib/VNDB/Func.pm index 1833be37..330dad7d 100644 --- a/lib/VNDB/Func.pm +++ b/lib/VNDB/Func.pm @@ -86,6 +86,7 @@ sub userstr { # [url=..] [/url] # [raw] .. [/raw] # [spoiler] .. [/spoiler] +# [quote] .. [/quote] # v+, v+.+ # http://../ sub bb2html { @@ -94,7 +95,7 @@ sub bb2html { $raw =~ s/\r//g; return '' if !$raw && $raw ne "0"; - my($result, $length, @open) = ('', 0, 'first'); + my($result, $length, $rmnewline, @open) = ('', 0, 0, 'first'); my $e = sub { local $_ = shift; @@ -108,17 +109,33 @@ sub bb2html { for (split /(\s|\n|\[[^\]]+\])/, $raw) { next if !defined $_; + next if $_ eq ''; + + $rmnewline = s/\n//g if $rmnewline; + next if $_ eq ''; my $lit = $_; if($open[$#open] ne 'raw') { if ($_ eq '[raw]') { push @open, 'raw'; next } elsif ($_ eq '[spoiler]') { push @open, 'spoiler'; $result .= ''; next } - elsif ($_ eq '[/spoiler]') { + elsif ($_ eq '[quote]') { + push @open, 'quote'; + $result .= '

' if !$maxlength; + $rmnewline++; + next + } elsif ($_ eq '[/spoiler]') { if($open[$#open] eq 'spoiler') { $result .= ''; pop @open; } next; + } elsif ($_ eq '[/quote]') { + if($open[$#open] eq 'quote') { + $result .= '
' if !$maxlength; + $rmnewline++; + pop @open; + } + next; } elsif($_ eq '[/url]') { if($open[$#open] eq 'url') { $result .= ''; @@ -130,7 +147,7 @@ sub bb2html { push @open, 'url'; next; } elsif(!grep(/url/, @open) && - s{(.*)(http|https)://(.+[0-9a-zA-Z=/])(.*)} + s{(.*)(http|https)://(.+[\d\w=/-])(.*)} {$e->($1).qq|'.$e->('link').''.$e->($4)}e) { $length += 4; last if $maxlength && $length > $maxlength; @@ -155,7 +172,7 @@ sub bb2html { $result .= $e->($_); } - $result .= '' + $result .= $_ eq 'url' ? '' : $_ eq 'quote' ? '' : '' while((local $_ = pop @open) ne 'first'); $result .= '...' if $maxlength && $length > $maxlength; -- cgit v1.2.3