[pmwiki-users] Help With Custom Markup (I'll PayPal you...)

Dominique Faure dominique.faure at gmail.com
Wed Mar 12 06:00:46 CDT 2008


On Wed, Mar 12, 2008 at 3:51 AM, Andrew Standfield <andy at scruffyco.com> wrote:
>
> This pretty much works.
>
>
> The image and div vs. p solutions worked perfectly. I even figured out how to hyperlink the images. If anyone is wondering its:
>
>
> %img class=MyClass% [[http://www.yahoo.com/ | placehoder.jpg"alt and title text"]]%%

Eemeli Aro solution is working but require to alter core scripts.
Here's a way to prevent this. At the end of your config.php, add:

if (IsEnabled($EnableStdConfig,1)) {
  include_once("$FarmD/scripts/stdconfig.php");
  $MarkupTable['^img']['rep']
    = preg_replace('/<(\/)?div>/', '<$1p>',
                   $MarkupTable['^img']['rep']);
}


> For now, I'm okay with using (:div: class="MyClass":) rather than blockquotes, but I'd still *really* like to figure out how to code that. I try to be semantic as possible.

Here's a way to have a dedicated (:bq:)...(:bqend:) markup. It's
widely inspirated from the actual (:div:) markup and should provide
the same nesting features:

function HTMLBlock($block, $name, $attr) {
  global $MarkupFrame;
  $attr = PQA($attr);
  $name = strtolower($name);
  $key = preg_replace('/end$/', '', $name);
  $out = '<:block>'.MarkupClose($key);
  if (substr($name, -3) == 'end') return $out;
  $cf = & $MarkupFrame[0]['closeall'];
  $out .= "<$block $attr>";
  $cf[$key] = "</$block>";
  return $out;
}
Markup('blockquot', '<block',
  '/^\\(:(bq(?:end)?)(\\s.*?)?:\\)/ie',
  "HTMLBlock('blockquote','$1',PSS('$2'))");

> At any rate, I'll email you off list to see where to send your Money :)

If you also wish to reward this contribution, please send it to PM :)

-- 
Dominique



More information about the pmwiki-users mailing list