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

2008-03-12 Thread Dominique Faure
On Wed, Mar 12, 2008 at 3:51 AM, Andrew Standfield [EMAIL PROTECTED] 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.jpgalt 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

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


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

2008-03-12 Thread Eemeli Aro
On Wed, Mar 12, 2008 at 4:07 PM, Eemeli Aro [EMAIL PROTECTED] wrote:
  Actually, you probably should have the following, since there are
  quite a few dependencies between the script files:

Drat. Should've read better before posting. Apologies. Dominique's
solution does of course work, I was misreading stdconfig as stdmarkup.

eemeli

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


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

2008-03-12 Thread Patrick R. Michaud
On Tue, Mar 11, 2008 at 02:14:18PM -0700, Andrew Standfield wrote:
 First, three questions on formatting images:
 
 1) How can I make it so that when I place an image, the block of text it
 is in is a [p] rather than a [div]?

Several people have given solutions that modify the image markup
to produce p instead of div -- those are good, but if you
just want it to happen for a single image (instead of all), then
try putting [==] at the beginning of the line, as in:

[==] http://www.pmwiki.org/pub/pmwiki/pmwiki-32.gif

Having [==] at the beginning of a line forces whatever follows to
be part of a paragraph.

 3) Is there any way to use relative paths for images (this one isn't  
 all that important, but it would be nice)?

See http://www.pmwiki.org/wiki/Cookbook/RelativeLinks .  This
probably needs to go as a FAQ in the PmWiki.Images page.

Pm

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


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

2008-03-12 Thread Eemeli Aro
On Wed, Mar 12, 2008 at 1:00 PM, Dominique Faure
[EMAIL PROTECTED] wrote:
  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']);

 }

Actually, you probably should have the following, since there are
quite a few dependencies between the script files:

if (IsEnabled($EnablePrefs, 1))
  include_once($FarmD/scripts/prefs.php);
if (IsEnabled($EnableSimulEdit, 1))
  include_once($FarmD/scripts/simuledit.php);
if (IsEnabled($EnableDrafts, 0))
  include_once($FarmD/scripts/draft.php);# after simuledit + prefs
if (IsEnabled($EnableSkinLayout,1))
  include_once($FarmD/scripts/skins.php);# must come after prefs
if (@$Transition || IsEnabled($EnableTransitions, 0))
  include_once($FarmD/scripts/transition.php);   # must come after skins
if (@$LinkWikiWords || IsEnabled($EnableWikiWords, 0))
  include_once($FarmD/scripts/wikiwords.php);# must come before stdmarkup
if (IsEnabled($EnableStdConfig,1)) {
  include_once($FarmD/scripts/stdconfig.php);# must come after transition
  $MarkupTable['^img']['rep'] =
preg_replace('/(\/)?div/', '$1p', $MarkupTable['^img']['rep']);
}

Hence my suggestion to just make two very small edits directly to stdmarkup.php.

eemeli

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


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

2008-03-12 Thread Andrew Standfield
PM, Eemil, and Dominique,

Thank you so much for all of your help! Things are working just like  
I want now. And that's one of the (many) reasons I love PmWiki:  
Pretty much anything you want to do, you can; and tweaking it usually  
is not a difficult task. Plus, with such a great community, even if  
you don't have the coding chops to get some behavior you're looking  
for, someone out there will be able to help you.

All three of you have been a remarkable help. I'm saving all of the  
code snippets for future reference. It's so nice to look at my HTML  
source and see nice, semantic code.

I've sent $10 to PM. Not much, and far less than the program is  
worth, but it's as much as I can afford right now. There will  
probably be more in the future. I hope this small donation helps the  
best wiki engine out there to keep going.

Patrick (and all those cookbook authors, too), keep up the good work.  
Your program is an outstanding piece of work.

Thanks,

Andy





On Mar 12, 2008, at 4:00 AM, Dominique Faure wrote:

 On Wed, Mar 12, 2008 at 3:51 AM, Andrew Standfield  
 [EMAIL PROTECTED] 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.jpgalt  
 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


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


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

2008-03-11 Thread Andrew Standfield
Addendum:

Actually, my blockquote markup is *not* working the way I wanted, so  
scratch that. It will only put the tags around one block of text.  
What I need it to do is to be able to go around multiple blocks.  
Something like:

[blockquote class=MyStyle]

[p]blah blah blah[/p]

[p]blah blah blah[/p]

[/blockquote]


Thanks,

Andy



On Mar 11, 2008, at 2:14 PM, Andrew Standfield wrote:

 First person to answer these questions *correctly* can get $5.00  
 via PayPal. I'll also donate $5.00 to PmWiki. I know it's not much,  
 and obviously, it's worth *way* more, but I am seriously broke.  
 Tell me what to code and where to put that code.

 (Note: I've used square brackets rather than angle brackets in the  
 hopes that my formatting won't get messed up in this email. In my  
 actual code, all the square brackets are angles brackets)

 First, three questions on formatting images:

 1) How can I make it so that when I place an image, the block of  
 text it
 is in is a [p] rather than a [div]?

 2) How can I apply a class (and/or an id) to an image in the form of:

   [p][img src=http://ref.to.image.jpg; alt=Example  
 class=myClass /] Blah blah blah.[/p]


 3) Is there any way to use relative paths for images (this one  
 isn't all that important, but it would be nice)?

 Second part:

 I've managed to make a custom markup that generated blockquote  
 tags. It goes like this:

   Markup(blockquote, block, /\\(:bq:\\)(.*?)\\(:bqend:\\)/,  
 [blockquote]$1[/blockquote]);


 It works to generate the blockquote tag just fine, but I also need  
 to be able to pass a style to it. So, the output would looks  
 something like:

   [blockquote class=MyStyle]...[/blockquote]


 Being able to pass an id=blah would be handy, too.

 Ideally, I'd like to mark it up like this (in actually using the  
 wiki, that is):

   (:bq class=MyClass:)

   Blah blah blah blah.

   Yadda yadda.

   (:bqend:)



 HALP!

 Thanks,

 Andy


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


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

2008-03-11 Thread Eemeli Aro
Apologies if any of the following is in error, I don't have the time
to verify the code just now.

On Tue, Mar 11, 2008 at 11:14 PM, Andrew Standfield [EMAIL PROTECTED] wrote:
  1) How can I make it so that when I place an image, the block of text it
  is in is a [p] rather than a [div]?

I'm guessing that this happens only when the image is before any other
text on the line? If so, it's probably due to the '^img' markup rule.
I've found replacing default markup from a config file to be a bit
tricky given the way that the Markup function doesn't check if a rule
has been previously set. So, it's probably easiest for you to directly
edit the file scripts/stdmarkup.php  change the divs to ps on
line 324.

  2) How can I apply a class (and/or an id) to an image in the form of:
 [p][img src=http://ref.to.image.jpg; alt=Example class=myClass 
 /] Blah blah blah.[/p]

Add the following line to your config file:

$WikiStyle['img'] = array( 'apply' = 'img' );

This will let you surround the image with the markup %img
...%YourImage.jpg%% and have any valid WikiStyles apply to the image.
Example: %img class=logo id=pm%Attach:pmwiki.png%%

  3) Is there any way to use relative paths for images (this one isn't
  all that important, but it would be nice)?

Use the Path: intermap format, ie. write
Path:/path/to/your/image.jpg or even
Path:../relative/path/to/image.jpg

  Ideally, I'd like to mark it up like this (in actually using the
  wiki, that is):

 (:bq class=MyClass:)

 Blah blah blah blah.

 Yadda yadda.

 (:bqend:)

If you're ok with having the same effect with a different tag, try the
following:

indent MyClass id=bingle

Blah blah blah blah.

Yadda yadda.



That'll produce a div that's a member of two classes 'indent' and
'MyClass', and has the id 'bingle'. By default, PmWiki includes the
following CSS rule:

.indent { margin-left:40px; }

which makes it practically into a blockquote.

eemeli

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


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

2008-03-11 Thread Andrew Standfield

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.jpgalt and  
title text]]%%


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.


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

Thanks!

Andy



On Mar 11, 2008, at 4:14 PM, Eemeli Aro wrote:


Apologies if any of the following is in error, I don't have the time
to verify the code just now.

On Tue, Mar 11, 2008 at 11:14 PM, Andrew Standfield  
[EMAIL PROTECTED] wrote:
 1) How can I make it so that when I place an image, the block of  
text it

 is in is a [p] rather than a [div]?


I'm guessing that this happens only when the image is before any other
text on the line? If so, it's probably due to the '^img' markup rule.
I've found replacing default markup from a config file to be a bit
tricky given the way that the Markup function doesn't check if a rule
has been previously set. So, it's probably easiest for you to directly
edit the file scripts/stdmarkup.php  change the divs to ps on
line 324.

 2) How can I apply a class (and/or an id) to an image in the form  
of:
[p][img src=http://ref.to.image.jpg; alt=Example  
class=myClass /] Blah blah blah.[/p]


Add the following line to your config file:

$WikiStyle['img'] = array( 'apply' = 'img' );

This will let you surround the image with the markup %img
...%YourImage.jpg%% and have any valid WikiStyles apply to the image.
Example: %img class=logo id=pm%Attach:pmwiki.png%%


 3) Is there any way to use relative paths for images (this one isn't
 all that important, but it would be nice)?


Use the Path: intermap format, ie. write
Path:/path/to/your/image.jpg or even
Path:../relative/path/to/image.jpg


 Ideally, I'd like to mark it up like this (in actually using the
 wiki, that is):

(:bq class=MyClass:)

Blah blah blah blah.

Yadda yadda.

(:bqend:)


If you're ok with having the same effect with a different tag, try the
following:


indent MyClass id=bingle


Blah blah blah blah.

Yadda yadda.





That'll produce a div that's a member of two classes 'indent' and
'MyClass', and has the id 'bingle'. By default, PmWiki includes the
following CSS rule:

.indent { margin-left:40px; }

which makes it practically into a blockquote.

eemeli


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users