Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird I can't figure out. #282

Closed
gamejerksnet opened this issue Feb 3, 2015 · 7 comments
Closed

Weird I can't figure out. #282

gamejerksnet opened this issue Feb 3, 2015 · 7 comments

Comments

@gamejerksnet
Copy link

Okay so I'm having an issue I can't figure out. Here is my extension:

<?php namespace App\Extensions;

use Parsedown;

class ParsedownExtension extends Parsedown {

    protected $InlineTypes, $inlineMarkerList;

    public function __construct()
    {
        $this->InlineTypes['@']     =   ['UserTag'];
        $this->inlineMarkerList     .=  '@';
    }

    public function inlineUserTag($Excerpt)
    {
        if (preg_match('/(?:@)([a-zA-Z0-9\_\-\.\=\@\[\]\{\}\(\)\<\>\,\\\*\&\^\%\#\@\!\/\:\;\|\~\`])+\b/', $Excerpt['text'], $matches))
        {
            return array(
                'extent' => strlen($matches[0]),
                'element' => array(
                    'name' => 'a',
                    'text' => '@' . $matches[0],
                    'attributes' => array(
                        'href' => 'http://www.gamejerks.net/members/testing',
                    ),
                ),
            );
        }
    }

}

And here is the exact bit that I'm calling it:

$parsedown = new \App\Extensions\ParsedownExtension();
$comment    =   $parsedown->text( $value );

I get error that no method Parsedown::text() exists, and when I die and dump $parsedown above and it only shows the child class ParsedownExtension and I have no clue why it isn't extending properly.

@erusev
Copy link
Owner

erusev commented Feb 3, 2015

The extension looks correct to me. Does it work outside of Laravel?

@gamejerksnet
Copy link
Author

No I am currently pulling it purely as you see. I mean I haven't tried loading in a clean PHP file but I don't see Laravel causing any issues..

@erusev
Copy link
Owner

erusev commented Feb 3, 2015

Could you try it, please?

@naNuke
Copy link
Contributor

naNuke commented Feb 3, 2015

Dont you overwrite all the types and markers with nulls by writing
protected $InlineTypes, $inlineMarkerList;?

@gamejerksnet
Copy link
Author

I'm not sure how I would go about pulling in autoloaded files outside of Laravel.

@erusev
Copy link
Owner

erusev commented Feb 7, 2015

@gamejerksnet

I asked not because I wanted to suggest that you use the extension outside of Laravel, but rather because it'd help us find the cause of the problem.

@aidantwoods
Copy link
Collaborator

Please reopen if there is some more info :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants