ShortCutsMarkup

Summary:Gives easy access to creating some types of custom markup.
Version:1.0
Prerequisites:N/A
Status:Working
Maintainer:MikeShanley?
Users: +1 (View / Edit)

Questions answered by this recipe

  • How can I utilize Markup without knowing regex?
  • How can I make it easier to type out links?
  • How can I create a cross-reference list?
  • How can I redirect an entire group?

...and more!

Description

Makes creating your own markup, link-shortcuts, redirects and more WAY EASY!

It works like this:

  1. Upload this to your /cookbook directory: shortcuts.phpΔ
  2. Add this to local/config: include("$FarmD/cookbook/shortcuts.php");
  3. Create `Site.ShortCuts and make a definition list of :whatbecomes:what, eg:

:email:[[mailto:spam@upisup.com]]
:home:[[Main/Main]]
:floatad:(:include Site/GoogleFloatAd:)
:longword:flocinaucinihilipilification
:moviecatch:**Wikzilla**://Wikness the Page Variables!//

  1. Anywhere on your site, summon your ShortCuts like so:

#email#

Options:

Use these variables BEFORE the % to...

  • Change the ShortCuts page:

$ShortCutsPage = "Main.GroupShortening";

  • Change the Prefix and Suffix for to activate the shortcuts:

$ShortCutsPrefix = "[[";
$ShortCutsSuffix = "/";

NOTE

The above Prefix and Suffix combo is dangerous to most wiki setups, however, a careful Administrator can do some cool things with this...

For instance, if your ShortCuts page has a list of all your groups in the definition list, you then have the ability to shorten every single group's name as well as the option to redirect entire groups at once.

In a site that's about planning for upcoming holidays, for example, the definition list could look like this:

:C:[[Christmas/
:H:[[Halloween/
:E:[[Easter/
:L:[[Labor Day/

With a final line that says:

:Now:[[Christmas/

Thus, For all links that specifically link to a given holiday, you can write them in the regular fashion. HOWEVER, all of your main pages, your sidebar, your recipes list, and so on can all link to [[Now/whatever... Then all you need do is change one line of your ShortCuts page and your entire site is updated to the next holiday.

The canniest wikizens will see even more uses for this sort of thing.

Finally, if you want to have multiple markups that's REALLY easy... Just do something like the following:

//so that you can easily reference ANY link on your links page...
$ShortCutsRedux = "1";
$ShortCutsPage = "Main.Links";
$ShortCutsPrefix = '?';
$ShortCutsSuffix = '?';
include("$FarmD/cookbook/shortcuts.php");

//so that you can set your blog automatically show where you are on your rock tour of the world...
// Blog.GroupHeader: #2007-08-31#
// in Tour.CurrentInfo: :2007-08-31:August 31 - New York City!
$ShortCutsRedux = "2";
$ShortCutsPage = "Tour.CurrentInfo";
$ShortCutsPrefix = '#';
$ShortCutsSuffix = '#';
include("$FarmD/cookbook/shortcuts.php");

//so you can automatically turn code like this: >happy> into smiley faces. Get it?
$ShortCutsRedux = "3";
$ShortCutsPage = "Site.MakeSmiles";
$ShortCutsPrefix = '>';
$ShortCutsSuffix = '>';
include("$FarmD/cookbook/shortcuts.php");

The $ShortCutsRedux is required so that the different sets of markup rules don't overwrite one another.

Notes

Release Notes

2007-08-31
RELEASE TODAY!

Comments

See discussion at ShortCutsMarkup-Talk

Hi, Mike,

I already do things like the Now markup example you gave using pagetextvariables or conditional statements. For example: my sales page on Eclectic Tech is set up to change text monthly with an if date statement -- I wouldn't have to say "change my site for Halloween" -- it would just happen on the date I tell it to. If I wanted to, I could also use if conditionals with a pagetextvar (PTV) on a SiteAdmin page: content ThisHoliday:Halloween is then referred to as on other pages and I can use a conditional such as (:if equal {SiteAdmin/WhatHoliday$:ThisHoliday} "Halloween":)The Great Pumpkin is going to get you!....(:ifend:) to change content.
Just thought I'd give you that tip. Looks like an interesting recipe. Thanks! XES January 08, 2008, at 04:27 PM
That's a great idea XES! I've been away from PmWiki for a while, and now that I'm back, I was also questioning the same thing, after all, all ShortcutsMarkup really does is turn your #short# into references to and then into whatever $:short is defined as. PmWiki still does the rest.
That said, ShortcutsMarkup is still the easiest way for references that change often or that aren't planned. When I work on scripts or stories, I use shortcuts to easily link together my #plots#, #characters#, #objects#, and #chapters#, which subsequently turn into titled and complete links. I haven't written full any proper names is ages, because #tb# is enough to reference TaraBelland?

See Also

EnableHTML - So you can easily include GoogleAds and other stuff...

Contributors

MikeShanley?

User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.