| View previous topic :: View next topic |
| Author |
Message |
joebeone Seasoned Poster

 Joined: 14 Jul 2004 Posts: 56
     votes: 1
|
|
| Back to top |
|
 |
EdB /bb|[^b]{2}/
Joined: 05 Jan 2004 Posts: 7123
  votes: 90
|
Posted: Fri Dec 17, 2004 21:46 Post subject: |
|
|
| Got a link that works? The link in your post gives me what looks like an open directory with info about the plugin, but there is no way to get the plugin from the link in the top portion. The link following [plugin] : in the text (a pobox link) tells me "Unable to Complete Request". Can you save it as a .txt file and link to that, or maybe zip it up and link to the zip? |
|
| Back to top |
|
 |
joebeone Seasoned Poster

 Joined: 14 Jul 2004 Posts: 56
     votes: 1
|
Posted: Fri Dec 17, 2004 23:05 Post subject: |
|
|
sorry... the link was broken as posted. Here's a direct link (don't access this directly, right-click save as):
http://www.sims.berkeley.edu/~...nderer.php
this should work too (beyond when I leave Berkeley):
http://pobox.com/~joehall/b2evo_markdown/
Here is the code:
| Code: |
<?php
/**
* This file implements John Gruber's Markdown language using Michel Fortin's PHP Markdown
*
* b2evolution - {@link http://b2evolution.net/}
* Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
* @copyright (c)2003-2004 by Francois PLANQUE - b2evolution - {@link http://fplanque.net/}
* @copyright (c)2004 by John Gruber - Markdown - {@link http://daringfireball.net/projects/markdown/}
* @copyright (c)2004 by Michel Fortin - PHP Markdown- {@link http://www.michelf.com/projects/php-markdown/}
* @copyright (c)2004 by Joseph Lorenzo Hall - b2evo renderer- {@link http://pobox.com/~joehall/}
*
* @package plugins
*/
if( !defined('DB_USER') ) die( 'Please, do not access this page directly.' );
/**
* Includes:
*/
require_once dirname(__FILE__).'/../renderer.class.php';
include_once "markdown.php";
/**
* @package plugins
*/
class markdown_Rendererplugin extends RendererPlugin
{
var $code = 'b2evMrkdwn';
var $name = 'Markdown';
var $priority = 60;
var $apply_when = 'opt-out';
var $apply_to_html = true;
var $apply_to_xml = false;
var $short_desc;
var $long_desc;
/**
* Constructor
*
* {@internal markdown_Rendererplugin::markdown_Rendererplugin(-)}}
*/
function markdown_Rendererplugin()
{
$this->short_desc = T_('Parse Markdown syntax and make HTML');
$this->long_desc = T_('No description available');
}
/**
* Perform rendering
*
* {@internal markdown_Rendererplugin::render(-)}}
*
* @param string content to render (by reference) / rendered content
* @param string Output format, see {@link format_to_output()}
* @return boolean true if we can render something for the required output format
*/
function render( & $content, $format )
{
if( ! parent::render( $content, $format ) )
{ // We cannot render the required format
return false;
}
$content = Markdown( $content );
return true;
}
}
// Register the plugin:
$this->register( new markdown_Rendererplugin() );
?> |
|
|
| Back to top |
|
 |
mattbta Seasoned Poster

 Joined: 20 Jun 2004 Posts: 87
   
|
Posted: Sat Dec 18, 2004 9:23 Post subject: |
|
|
Ok, two things on this.
1. Make a zip file for download with both your plugin and the markup.php file, and let the user know to extract both to their plugins/renderers dir for 'out of the box functionality'.
2. Since this creates paragraph tags automagically, you mighttell the users to disable auto-p plugin as I can't tell if this will have undesired side effects for posts. On my test with a single line there was no ill effects, but I'm not sure if things will be confused with many paragraph (EdB wordy) posts.
Other than that, looks like a good plugin. Nice job. |
|
| Back to top |
|
 |
joebeone Seasoned Poster

 Joined: 14 Jul 2004 Posts: 56
     votes: 1
|
Posted: Sat Dec 18, 2004 12:33 Post subject: slight changes |
|
|
| mattbta wrote: |
1. Make a zip file for download with both your plugin and the markup.php file, and let the user know to extract both to their plugins/renderers dir for 'out of the box functionality'.
2. Since this creates paragraph tags automagically, you mighttell the users to disable auto-p plugin as I can't tell if this will have undesired side effects for posts. On my test with a single line there was no ill effects, but I'm not sure if things will be confused with many paragraph (EdB wordy) posts.
|
Done and done. The Zip file is here:
http://pobox.com/~joehall/b2ev...rkdown.zip
And by looking at the parent directory you should see the README file which tells users to disable all default plugins save "_autolinks.renderer.php":
http://pobox.com/~joehall/b2evo_markdown/
Finally, here's a post that uses the exact same syntax as the README file, but parsed via the plugin into HTML:
http://pobox.com/~joehall/nqb2...o_markdown |
|
| Back to top |
|
 |
fumanchu New Poster

Joined: 26 Jan 2005 Posts: 6
  
|
Posted: Wed Jan 26, 2005 20:27 Post subject: |
|
|
| +1 putting this in default distro |
|
| Back to top |
|
 |
fumanchu New Poster

Joined: 26 Jan 2005 Posts: 6
  
|
Posted: Thu Jan 27, 2005 16:19 Post subject: Current CVS version |
|
|
Here's a version which works with the new plugin architecture in current CVS:
| Code: |
<?php
/**
* This file implements John Gruber's Markdown language using Michel Fortin's PHP Markdown
*
* b2evolution - {@link http://b2evolution.net/}
* Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
* @copyright (c)2003-2004 by Francois PLANQUE - b2evolution - {@link http://fplanque.net/}
* @copyright (c)2004 by John Gruber - Markdown - {@link http://daringfireball.net/projects/markdown/}
* @copyright (c)2004 by Michel Fortin - PHP Markdown- {@link http://www.michelf.com/projects/php-markdown/}
* @copyright (c)2004 by Joseph Lorenzo Hall - b2evo renderer- {@link http://pobox.com/~joehall/}
*
* @package plugins
*/
if( !defined('DB_USER') ) die( 'Please, do not access this page directly.' );
/**
* Includes:
*/
include_once "markdown.php";
/**
* @package plugins
*/
class markdown_plugin extends Plugin
{
var $code = 'b2evMrkdwn';
var $name = 'Markdown';
var $priority = 60;
var $apply_when = 'opt-out';
var $apply_to_html = true;
var $apply_to_xml = false;
var $short_desc;
var $long_desc;
/**
* Constructor
*
* {@internal markdown_plugin::markdown_plugin(-)}}
*/
function markdown_plugin()
{
$this->short_desc = T_('Parse Markdown syntax and make HTML');
$this->long_desc = T_('No description available');
}
/**
* Perform rendering
*
* {@internal markdown_plugin::Render(-)}}
*
* @param array Associative array of parameters
* (Output format, see {@link format_to_output()})
* @return boolean true if we can render something for the required output format
*/
function Render( & $params )
{
if( ! parent::Render( $params ) )
{ // We cannot render the required format
return false;
}
$content = & $params['data'];
$content = Markdown( $content );
return true;
}
}
?> |
|
|
| Back to top |
|
 |
subzane New Poster

Joined: 25 Jul 2006 Posts: 1  
|
Posted: Tue Jul 25, 2006 7:07 Post subject: |
|
|
| How do I make this work for summer beta 1.8? |
|
| Back to top |
|
 |
bjornbjorn New Poster

Joined: 10 Oct 2006 Posts: 8
 
|
Posted: Tue Oct 10, 2006 0:57 Post subject: |
|
|
I'd also like to know this :-)
Has anyone updated this plugin for 1.8 or can someone outline the steps needed to get this to work? |
|
| Back to top |
|
 |
bjornbjorn New Poster

Joined: 10 Oct 2006 Posts: 8
 
|
Posted: Tue Oct 10, 2006 13:50 Post subject: |
|
|
Hi, I've implemented the PHP Markdown Extra from Michel Fortin as a plugin for b2evo.
It works with the latest version (1.8.2) and can be downloaded here:
http://bie.no/blog/?p=57
I needed to do Apply rendering: 'always' to get it to work properly .. let me know if I did something wrong
- bjorn |
|
| Back to top |
|
 |
whoo Forum Admin

 Joined: 25 Dec 2004 Posts: 1293
  votes: 19
|
|
| Back to top |
|
 |
bjornbjorn New Poster

Joined: 10 Oct 2006 Posts: 8
 
|
Posted: Wed Oct 11, 2006 0:58 Post subject: |
|
|
haha, yeah I was wondering about that
for those of you who don't know what we're talking about I submitted the form about three times but got a message that I was spamming
- bjorn |
|
| Back to top |
|
 |
John the uncertain
Joined: 22 Jun 2004 Posts: 2147
     votes: 27
|
Posted: Wed Oct 11, 2006 1:13 Post subject: |
|
|
@ bjornbjorn
Thanks for this.... I assume it for posting and cannot be applied to "comments" ! _________________ See the Sites in in Venice |
|
| Back to top |
|
 |
bjornbjorn New Poster

Joined: 10 Oct 2006 Posts: 8
 
|
Posted: Wed Oct 11, 2006 1:57 Post subject: |
|
|
That's right, it currently only works for posts.
I guess that's because RenderItemAsHtml doesn't get called on comments.
Does comments call RenderItem()? - because then it would be pretty easy to make it work with comments as well... |
|
| Back to top |
|
 |
¥åßßå Blonde Bimbo
 Joined: 07 Jan 2005 Posts: 6579
    votes: 115
|
Posted: Wed Oct 11, 2006 2:41 Post subject: |
|
|
You want to use the FilterCommentContent hook
| Code: |
function FilterCommentContent( & $params )
{
return $this->RenderItemAsHtml( $params )
} |
¥ _________________ I may have opened the door but you entered of your own free will
| normal life wrote: |
yabba_hh: I think, I type, I read what I type, I think "fuck, what was I thinking when I typed that?!"
tuxnus: that's two more thoughts than I give you credit for |
|
|
| Back to top |
|
 |
|