<?php if (!defined('PmWiki')) exit();
# NAME:		quoteblock.php, implimenting a (:quoteblock:) ... (:quotend:) markup.
# AUTHOR:	Kimberly Kelly <sreny@srenyqernzf.pbz> (Rot13ed)
# VERSION:	0.1 -- Tue, 11  Apr  2006 19:05:16 PST
# ABOUT:	This is little more than a little script to impliment a markup to allow a small measure of nested 'wikistyles', similar to how a sourceblock will not murder your existing wikistyle; This is the same idea.
# USAGE:	(:quoteblock style=STYLE :) ... (:quotend:) where STYLE is one of the below, such as:
#
# (:quoteblock style=quote:)
# (:quotend:)
#
# (:quoteblock style=post:)
# (:quotend:)
#
# (:quoteblock style=email:)
# (:quotend:)
#
# etc.
# ! The reason...
# The reason for this is so you can nest wikistyles in effect, such as:
# >>bgcolor=black color=red<<
# This is red text on a black background.
# (:quoteblock style=post:)
# This text is using our div.post style which you can see below.
# (:quotend:)
# This is back to the red text on a black background, which is what the quote block style is all about;
# >><<
#
# !The Logic...
# This is because nesting wikistyle blocks does not work, so to get the equivalent to the above you must know what style you are in, such as:
# >>bgcolor=black color=red<<
# This is red text on a black background.
# >>post<<
# This text is using a 'post' wiki style which, seems to be using our div.post style, which is unexpected, however if you have a wikistyle defined it would seem to use that in preferance.
# >>bgcolor=black color=red<<
# This is back to the red text on a black background which is what the quote block style is all about;
# >><<
#
# There is nothing wrong with the base >><< style markup (save a touch cumbersome when you have a colorful document) until you no longer know what color your text will appear in and you still want it all colored, such as when you include a colorful page into a colorful page.
#
# NOTE: The quoteblock style is based on the method sourceblock uses since, well, it works (=
#
# NOTE: also that you cannot nest quoteblocks (in effect that is nesting <div> tags), which is most unfortunate.
#
# One last little NOTE: I am very much a neophyte in regards to PHP and it is quite possible I am doing something bad here...

SDV($HTMLStylesFmt['quoteblock'], "
div.quote {
	padding: 0.5em;
	border: 1px solid #808080;
	background-color: AntiqueWhite;
	color: Black;
	border: 2px solid lavender;
	padding: 2px;
	font-size: smaller;
	}

div.email {
	background-color: #faebd7;
	color: Black;
	border: 1px solid gray;
	padding: 5px;
	}

div.post {
	background-color: #faebff;
	color: Black;
	border: 1px solid gray;
	padding: 5px;
	font-size: smaller;
	}

div.storecomment {
	background-color: antiquewhite;
	color: black;
	border: 2px solid darkviolet;
	padding: 2px;
	font-style: italic;
	font-size: smaller;
	}

	"
);

function QuoteBlock($opt, $text)
{
	$defaults = array('style' => 'quote');
	$opt = array_merge($defaults, ParseArgs($opt));
	return "<div class='{$opt['style']}'>" . $text . "</div>";
}
Markup("quoteblock", '<split', "/\(:quote\\s*(.*?)\\s*:\)(.*?)[\n]?\\(:quotend:\\)/se", "QuoteBlock('$1',PSS('$2'))");

//
///EOF