You are here: start » Snippets » dokuwiki » Blockquote Plugin

Blockquote Plugin

I no longer actively maintain this plugin, it therefore is only provided “as is”.

Description

The blockquote plugin provides an environment for (semantically correct by using the blockquote XHTML tag) quotes. In contrast to the default wiki markup for quoting, the content of the quote can contain any wiki markup which then gets interpreted as it would outside of the quote environment. Thus, also nested quotes are possible.

The Git repository of the plugin can be found at Github.

Updates

Last updated: 2008/05/04

  • 2008/05/04:
  • 2008/04/06:
    • Now produces valid XHTML again (blockquote output was placed inside paragraphs, those are now closed and reopened properly)
  • 2008/02/13:
    • :!: Security fix, please update ASAP :!:
    • Fixed XSS vulnerabilities in both cite and blockquote commands, big thanks to the Oracle Corporation's Ethical Hacking Team for discovering this and giving me a heads up
  • 2008/01/26:
    • :!: When updating, please first delete the old installation of the plugin, otherwise not all components might be registered properly.
    • Added a toolbar icon as proposed by Tobias Deutsch.
    • Added syntax for adding a citation source (extension of the blockquote command as well as addition of a new cite command).
  • 2007/10/27:
    • Initial release

Syntax

The plugin provides two additional pairs of markup tags, the blockquote and the cite markup. The blockquote allows an additional citation source to be given after the blockquote keyword in the opening tag. The cite markup was mainly created to allow the addition of more complex citation sources (including links, text formatting etc) inside the blockquote environment, although it can also be used standalone. See the examples below.

If blockquotes you insert only look like the usual quotes as available from DokuWiki core, this will most probably be due to a caching issue. Please try Shift-Reloading in your browser, and if this doesn't help take a look at "Purging the Cache" in the DokuWiki documentation before asking for help here. Thanks!

Examples

Loads of markup

The following code

<blockquote>
Test with loads of markup...

Another paragraph with a little [[http://nowhere|link]] to nowhere. Oh, and while we are at it, what about some **bold**, some //italic// and some __underlined__ text? And finally, an itemization:

  * item 1
    * item 1.1
    * item 1.2
  * item 2
    - ordered item 2.1
    - ordered item 2.2
      - ordered item 2.2.1
  * item 3

Works :-)
</blockquote>

results in

Test with loads of markup…

Another paragraph with a little link to nowhere. Oh, and while we are at it, what about some bold, some italic and some underlined text? And finally, an itemization:

  • item 1
    • item 1.1
    • item 1.2
  • item 2
    1. ordered item 2.1
    2. ordered item 2.2
      1. ordered item 2.2.1
  • item 3

Works :-)

The cite attribute

The following code

<blockquote J. Random Hacker>Test with a cite attribute...</blockquote>

results in

Test with a cite attribute…

The cite command

The following code

<blockquote>Test with a cite command...<cite>J. Random Hacker, [[http://localhost/~jrhacker]]</cite></blockquote>

results in

Test with a cite command…

J. Random Hacker, http://localhost/~jrhacker

Installation

When updating from 2007/10/27, please first delete the old installation of the plugin, otherwise not all components might be registered properly.

With plugin manager

Let the manager do the dirty work, just give him this link to eat: plugin-blockquote.tar.gz

Without plugin manager

  1. Download the plugin: plugin-blockquote.tar.gz
  2. Extract it into your dokuwiki plugin folder (eg lib/plugins)

Discussion

FredFred, 2007/11/23 22:13

Nice plugin

ioio, 2007/12/06 23:48

Thanks for your work!

You should include:

blockquote.blockquote-plugin p {

margin: 0 !important;

}

in the CSS file. It makes the blockquote look more convenient.

RederReder, 2008/03/24 07:00

Strange but this plugin will make the page not Valid XHTML 1.0 Transitional.

The validator said,

document type does not allow element "blockquote" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag.

<blockquote class="blockquote-plugin">

I am a beginner to XHTML, so I paste the information here to look up for more help.;-)

fooselfoosel, 2008/04/06 23:15

The problem should be resolved with the current release :-)

RederReder, 2008/04/08 16:08

Wow, really nice. Thanks a lot for this nice plugin. I use it frequently. :-)

DavidDavid, 2008/04/09 07:11

After installing this using Plugin Manager, all the commands get me is the standard quote line not to desired box.

What should I check in order to make this work?

RaymondRaymond, 2008/05/06 21:56

nice plugin! is it also resizable? cause it doesn't seem to consider left or right aligned images

fooselfoosel, 2008/05/12 22:25

Could you give an example as a test case?

webwesenwebwesen, 2008/05/12 22:15

installed the plugin - the resulting html code looks fine:

<p> aaa </p> <cite class=“blockquote-plugin”>aaa</cite>

but it sems that style.css in the plugin folder is not picked up by my template(wiki engine?). any pointers? thanks!

fooselfoosel, 2008/05/12 22:26

Probably a caching issue. Try Shift-Reloading, appending purge=1 to your URL or – if all else fails – touching conf/local.php

DaveDave, 2008/09/11 23:00

As far as I can see, on the 2008-05-05 version, Cite isn't very effective. These two lines produce the same result, for me.

Test with a cite attribute…

this is an old quote

Using a Cite tag within a Blockquote tag does add a line break, though, which is kind of nice.

DaveDave, 2008/09/11 23:04

Interesting. It behaves differently, here. I don't get the gigantic quotes on my wiki, or the box and shading, either. It behaves exactly like the old quotes, using a ”>”.

Oh, and my first attempt at saving a comment on this page failed, saying I hadn't correctly entered the captcha. There isn't any captcha, that I can see.

fooselfoosel, 2008/09/11 23:09

Hm… the same behaviour might be a css caching issue. Take a look at this part of the wiki documentation, especially the note about touching conf/local.php.

About the captcha, I set it up so that it's prefilled and hidden using javascript if available, maybe something hiccuped there.

DaveDave, 2008/09/11 23:25

Well, touching the local.php and refreshing the page caused it to look different, but not the same as here. It indents both Blockquotes and Cites, but still no boxes or shading.

The Cite no longer looks like the ”>” quote, but the inline version doesn't display the citee's name. It just makes the “quote line” (the vertical blue bar) 4 lines tall, with the text on the second line. The nested Cite now right-justifies the citation, with a 5 line high quote line.

I couldn't find a way to make

http://www.example.com/namespace/page?purge=true

work with my URL. I tried lots of variations, but I'm not sure if I never got the syntax right, or if it doesn't work with the new release. Can you tell me what the correct syntax would be, if I start with this?

http://<my IP>:8080/dokuwiki/doku.php?id=playground:playground
fooselfoosel, 2008/09/11 23:32

Hm… sounds like a tough one.

The correct URL in your case would be

http://<my IP>:8080/dokuwiki/doku.php?id=playground:playground&purge=true

But I don't think it will help if touch local.php did not. Could you verify that the correct HTML is inserted by the plugin? It should be

<blockquote cite="J. Random Hacker" class="blockquote-plugin">
<p>
Test with a cite attribute…
</p>
 
</blockquote>

for above's “J. Random Hacker” quote with citation.

fooselfoosel, 2008/09/11 23:36

Also, if you have a Firefox with Firebug available, that might help to determine if the CSS used for styling up blockquote.blockquote-plugin indeed is loaded correctly. Additionally, it might be a browser issue, the CSS is doing some CSS2-only mojo for the cite stuff.

DaveDave, 2008/09/11 23:55

It looks slightly better in FireFox than in IE6, but not much. FF does show the citations that aren't visible in the first two cases in IE. But that's the only visible difference.

The source captured from IE is not quite the same as you quoted, above, so I'm including the whole page, in case there's a clue elsewhere in it.

	<!-- wikipage start -->
 
		<h1>
 
			<a name="playground" id="playground">PlayGround</a>
 
		</h1>
 
		<div class="level1">
 
			<pre class="code">does this work?</pre>
 
			<pre class="code">
 
This is a code block
 
</pre>
 
			<blockquote cite="J. Random Hacker" class="blockquote-plugin">
 
				<p>
 
Test with loads of markup…
 
</p>
 
				<p>
 
Another paragraph with a little <a href="http://nowhere" class="urlextern" title="http://nowhere" rel="nofollow">link</a> to nowhere. Oh, and while we are at it, what about some <strong>bold</strong>, some <em>italic</em> and some <em class="u">underlined</em> text? And finally, an itemization:
 
 
 
</p>
 
				<ul>
 
					<li class="level1">
 
						<div class="li"> item 1</div>
 
						<ul>
 
							<li class="level2">
 
								<div class="li"> item 1.1</div>
 
							</li>
 
							<li class="level2">
 
								<div class="li"> item 1.2</div>
 
							</li>
 
						</ul>
 
					</li>
 
					<li class="level1">
 
						<div class="li"> item 2</div>
 
						<ol>
 
							<li class="level2">
 
								<div class="li"> ordered item 2.1</div>
 
							</li>
 
							<li class="level2">
 
								<div class="li"> ordered item 2.2</div>
 
								<ol>
 
									<li class="level3">
 
										<div class="li"> ordered item 2.2.1</div>
 
									</li>
 
								</ol>
 
							</li>
 
						</ol>
 
					</li>
 
					<li class="level1">
 
						<div class="li"> item 3</div>
 
					</li>
 
				</ul>
 
				<p>
 
 
 
Works <img src="/dokuwiki/lib/images/smileys/icon_smile.gif" class="middle" alt=":-)"></img>
 
				</p>
 
			</blockquote>
 
			<blockquote cite="J. Random Hacker" class="blockquote-plugin">
 
				<p>
 
Test with a cite attribute…
 
</p>
 
			</blockquote>
 
			<blockquote>
 
				<div class="no">
 
this is an old quote</div>
 
			</blockquote>
 
			<blockquote class="blockquote-plugin">
 
				<p>
 
 Test with a cite command…
 
</p>
 
				<cite class="blockquote-plugin">J. Random Hacker, <a href="http://localhost/~jrhacker" class="urlextern" title="http://localhost/~jrhacker" rel="nofollow">http://localhost/~jrhacker</a>
 
				</cite>
 
			</blockquote>
 
		</div>
 
		<!-- wikipage stop -->

This thing adds a lot of blank lines for some reason. And the captcha thing never works the first time.

DaveDave, 2008/09/11 23:56

I guess I should have used ”<code>” tags, instead of ”<nowiki>” tags? It was nicely formatted before I saved it.

fooselfoosel, 2008/09/12 08:56

Yes, <code> or even better <code html> :)

The HTML looks perfectly fine for me, so the culprit is probably CSS. IE6 is naturally somewhat broken as it does not support the CSS2 features the CSS uses for displaying the cite attribute of the blockquote tag, so you won't get a display there (IE6 is broken beyond comprehension anyway, so it might definitely be about time to upgrade to IE7). Firefox on the other hand does support those tags, and as you can see the citations there, the CSS seems to be applied alright.

If it would be possible, I'd really love to see a screenshot of your issue (e.g. send it to my email address as supplied here), and if you also could try to install Firebug and take a look at the styles that are applied to a blockquote tag, that would be awesome.

DaveDave, 2008/09/15 23:40

Here is what Firebug gave me.

<blockquote class="blockquote-plugin" cite="J. Random Hacker">
<p> Test with a cite attribute… </p>
</blockquote>
<blockquote>
<div class="no"> this is an old quote</div>
</blockquote>
<blockquote class="blockquote-plugin">
<p> Test with a cite command… </p>
<cite class="blockquote-plugin">
J. Random Hacker,
<a class="urlextern" rel="nofollow" title="http://localhost/~jrhacker" href="http://localhost/~jrhacker">http://localhost/~jrhacker</a>
</cite>
</blockquote>

Here's the corresponding markup in DokuWiki

<blockquote J. Random Hacker>Test with a cite attribute...</blockquote>
>this is an old quote
<blockquote> Test with a cite command...<cite>J. Random Hacker, [[http://localhost/~jrhacker]]</cite></blockquote>

There is no reference to Cite in the Style window in Firebug when Inspecting these elements, only <b>div.dokuwiki blockquote</b> and <b>blockquote.blockquote-plugin</b>.

I'm starting to question my humanity, too. Even when I can see it, and enter the Captcha value manually, it doesn't accept me as human the first couple times.

Aaron BaugherAaron Baugher, 2008/12/03 22:18

It works fine for me, but it doesn't pass the W3C XHTML validator, because it ends up with a blockquote inside paragraph tags. I'm new to dokuwiki, but I looked at the blockquote-plugin code, and it doesn't look like that's where the p tags are coming from. Is there something the plugin can do to stop the parser from wrapping p tags around its output?

fooselfoosel, 2008/12/03 22:55

This should not happen, as it closes any paragraphs prior to inserting the blockquote markup into the HTML output. Are you sure you have the current version?

Aaron BaugherAaron Baugher, 2008/12/05 16:27

Oops, you're right, that was caused by something else in my theme. Sorry for the false alarm.

ChristofChristof, 2009/01/17 00:19

Hi foosel, really nice plugin. I would like to modify the way the blockquote is displayed in my wiki. I would like to remove the box, remove the background, keep the indentation, reduze text size. Things like that. I am having trouble finding the right places to do so. Is there a place apart from the style.css file? Maybe this is contrary to the plugin's spirit, or there is a better way to do this. Any suggestions are much appreciated!

ChristofChristof, 2009/01/18 11:21

Well, I've come up with a much simpler solution, I use the normal dokuwiki quote tag and customize it in the design.css.

fooselfoosel, 2009/01/18 11:44

That one doesn't allow you to use anything besides simply text formatting though, e.g. no tables, lists, images…

Regarding your former question, if you modified the style.css file in the plugin directory and your changes didn't show up, you probably just ran into a caching issue – purging the cache might help here (see the box above on how to do that). Your changes would be overwritten though once you update the plugin. A much better place to modify style definitions in general is the userstyle.css in the conf directory of your wiki (if it doesn't exist already just create it). Changes made there are included in the generated CSS and not overwritten on any update.

DoogieDoogie, 2009/01/31 13:19

Great plugin! I wast just starting to write exactly this on my own. But luckily I thought about searching first. Good job!

ByronByron, 2009/07/15 15:09

Hi

Any idea why any === headings === do not render?

All other formatting renders perfectly except headings which just stay as text?

Regards Byron

BertehBerteh, 2009/08/26 17:11

Hello,

Thanks for this nice plugin.

I would like to have additional output in ODT mode (renderer for OpenOffice)… but can't figure the way your “render” function works. any help/pointer is welcome.

What I did is

add to render() in blockquote/syntax/quote.php, after “xhtml” mode

        elseif ($mode == 'odt'){
            list ($state, $data) = $indata;
            switch ($state) {
                case DOKU_LEXER_ENTER :
                    $renderer->p_close();
                    $renderer->p_open();
                    if ($data && strlen($data) > 0){
                        $renderer->cdata($data);
                        $renderer->p_close();
                        $renderer->p_open();
                    }                   
                    break;
                case DOKU_LEXER_UNMATCHED :
                    $renderer->cdata($data);
                    break;
                case DOKU_LEXER_EXIT :
                    $renderer->p_close();
                    $renderer->p_open();
                    break;
            }
            return true;            
        }

add to render() in blockquote/syntax/cite.php, after “xhtml” mode

        elseif ($mode == 'odt'){
            list ($state, $data) = $indata;
            switch ($state) {
                case DOKU_LEXER_ENTER :
                    $renderer->p_close();
                    $renderer->p_open();
                    break;
                case DOKU_LEXER_UNMATCHED :
                    $renderer->cdata($data);
                    break;
                case DOKU_LEXER_EXIT :
                    $renderer->p_close();
                    $renderer->p_open();
                    break;
            }
            return true;            
        }

The “cite” part seems to work, as the source of the citation gets written in my export (both using attribute and element types of citation), but the content of the quote is not detected (seems to me like the quote.php “case DDOKU_LEXER_UNMATCHED” is never activated.

Any idea how to get the content of your blockquote rendered in the “render” function of quote.php?

Thanks. Berteh.

Horst JENSHorst JENS, 2011/06/04 11:36

i love this plugin. works very well with dokuwiki 2011-05 “Rincewind”

You could leave a comment if you were logged in.
snippets/dokuwiki/blockquote.txt · Last modified: 2013/02/04 19:23 by foosel