Markup: Serendipity - what exactly does it do?

Creating and modifying plugins.
Post Reply
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Markup: Serendipity - what exactly does it do?

Post by Don Chambers »

Before I disable it completely, is there an explanation somewhere of what all this plugin does? There is definitely something it does that I do not want - which is marking text as bold with the asterisk.

In addition to wondering what all it "marks up", I'm also thinking it might be nice to provide a toggle for each of its features where, for instance, I could turn off the asterisk bolding (and not have it show up on the comment form) but leave everything else operational.
=Don=
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

It styles *bold*, /italic/, and _underlined_ text.

That's it. I believe those are mentioned somewhere around the editing box, but I can't remember.
Judebert
---
Website | Wishlist | PayPal
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

Well, here's the actual code from the plugin:

Code: Select all

    function _s9y_markup($text) {
        $text = str_replace('\_', chr(1), $text);
        $text = preg_replace('/#([[:alnum:]]+?)#/','&\1;',$text);
        $text = preg_replace('/\b_([\S ]+?)_\b/','<u>\1</u>',$text);
        $text = str_replace(chr(1), '\_', $text);

        // bold
        $text = str_replace('\*',chr(1),$text);
        $text = str_replace('**',chr(2),$text);
        $text = preg_replace('/(\S)\*(\S)/','\1' . chr(1) . '\2',$text);
        $text = preg_replace('/\B\*([^*]+)\*\B/','<strong>\1</strong>',$text);
        $text = str_replace(chr(2),'**',$text);
        $text = str_replace(chr(1),'\*',$text);

        // $text = preg_replace('/\|([0-9a-fA-F]+?)\|([\S ]+?)\|/','<font color="\1">\2</font>',$text);
        $text = preg_replace('/\^([[:alnum:]]+?)\^/','<sup>\1</sup>',$text);
        $text = preg_replace('/\@([[:alnum:]]+?)\@/','<sub>\1</sub>',$text);
        $text = preg_replace('/([\\\])([*#_|^@%])/', '\2', $text);

        return $text;
=Don=
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

Okay, that code shows it also allows:
# for HTML escape codes (#amp# becomes &, for example)
^text^ for superscripted text
@text@ for subscripted text

And escaped codes, so "\*char *c" doesn't get bolded when you don't want it to.
Judebert
---
Website | Wishlist | PayPal
Post Reply