summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2008-12-29 12:26:25 +0100
committerYorhel <git@yorhel.nl>2008-12-29 12:26:25 +0100
commited73cef37914303ca1790a37c6f5bec13b326b1f (patch)
tree01b121267ef56763361df3d4461563c929e60da2
parent412b3bb8baeef93869c92687956a007841d4492c (diff)
Added [quote] tag formatting, fixed URL parser, and updated d9
-rw-r--r--data/docs/912
-rw-r--r--data/skingen/style.css6
-rw-r--r--lib/ChangeLog2
-rw-r--r--lib/VNDB/Func.pm25
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
<p>
- <i>todo...</i>
+ 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.
</p>
@@ -53,6 +55,12 @@
</dd><dt>[spoiler]</dt><dd>
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.
+ </dd><dt>[quote]</dt><dd>
+ 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)
+ </dd><dt>[raw]</dt><dd>
+ 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.
</dd>
</dl>
<p>
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 .= '<b class="spoiler">'; next }
- elsif ($_ eq '[/spoiler]') {
+ elsif ($_ eq '[quote]') {
+ push @open, 'quote';
+ $result .= '<div class="quote">' if !$maxlength;
+ $rmnewline++;
+ next
+ } elsif ($_ eq '[/spoiler]') {
if($open[$#open] eq 'spoiler') {
$result .= '</b>';
pop @open;
}
next;
+ } elsif ($_ eq '[/quote]') {
+ if($open[$#open] eq 'quote') {
+ $result .= '</div>' if !$maxlength;
+ $rmnewline++;
+ pop @open;
+ }
+ next;
} elsif($_ eq '[/url]') {
if($open[$#open] eq 'url') {
$result .= '</a>';
@@ -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|<a href="$2://|.$e->($3, 1).'" rel="nofollow">'.$e->('link').'</a>'.$e->($4)}e) {
$length += 4;
last if $maxlength && $length > $maxlength;
@@ -155,7 +172,7 @@ sub bb2html {
$result .= $e->($_);
}
- $result .= '</a>'
+ $result .= $_ eq 'url' ? '</a>' : $_ eq 'quote' ? '</div>' : '</b>'
while((local $_ = pop @open) ne 'first');
$result .= '...' if $maxlength && $length > $maxlength;