[Pmwiki-users] Idea: page fallbacks: example

John Rankin john.rankin at affinity.co.nz
Sun May 18 18:08:25 CDT 2003


--====50495352575050515357===1
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="iso-8859-1"

Attached is a script as an example of how this might work. << pageversion.=
php >>

To use it:
- include in your local.php
- remove the comment /* ... */ around the various pattern definitions -- =
be aware this may have side effects for your site, depending on what you =
already do with these

It introduces the following markups:

 ~Text creates a reference to a page with the current page's name plus a =
suffix

 SomePage~ looks on SomePage for a numbered or bulleted list of ~Text =
references and returns the last in the list (if there is no list, it =
returns a reference to SomePage

  {{SomePage~SomeVersion}} is a reference to a specified page

I hope most variations work correctly, such as WikiWord~ and {{free link}}~=
, [[WikiWord~ alt text]] and bulleted lists like * [[~Ver2 alt text]].

I haven't tried alternate languages, but I can see setting a variable that =
tells the script to look for a suffix ~de or ~fr, rather than the last in =
the list.

I also haven't tried doing nested versions (SomePage~Version~ markup) -- =
but I *think* {{SomePage~Version}}~ might work...

And it may be appropriate for some situations to modify the page header to =
insert a reference to SomePage on pages of the form SomePage~Text.

Suggestions and improvements welcome.
--=20
John Rankin

On Sunday, 18 May 2003 7:48 AM, Patrick R. Michaud <pmichaud at pobox.com> =
wrote:
Several people have commented about the desirability of a "page=20
fallback" feature, but I'm having trouble following the thread or=20
knowing where things are at the moment, and following PmWiki
Philosophy #3 I have a tendency not to implement anything until
I have a clear idea of exactly what it's supposed to do.

- is it better to have "fallback pages" or "fallback groups"?
- do we have a clear markup syntax?  John Rankin's proposal
  was using ~ for illustrative purposes--is that the markup we
  want to use?  What things are allowed to follow the ~?
- is there a more descriptive/better term than fallbacks?
- are there any other wiki engines that implement a similar concept that
  we might want to borrow from?

As with most features, if it can be implemented as a separate script
module outside of pmwiki.php or with minor changes, it can happen fairly
quickly. =20

Pm

_______________________________________________
Pmwiki-users mailing list
Pmwiki-users at pmichaud.com
http://pmichaud.com/mailman/listinfo/pmwiki-users_pmichaud.com

--====50495352575050515357===1
Content-Transfer-Encoding: base64
Content-Type: application/octet-stream; name="pageversion.php";
    x-mac-creator=646F7361;
    x-mac-type=54455854

PD9waHAKCi8qCiRBbnlMZXR0ZXIgPSAiW0EtWmEtejAtOV0iOwokU3VmZml4UGF0dGVybiA9ICJb
QS1aMC05XSgkQW55TGV0dGVyKikiOwokUGFnZVRpdGxlUGF0dGVybiA9IAogICAgIltBLVowLTld
KCRBbnlMZXR0ZXIqKSgtKCRBbnlMZXR0ZXIrKSkqKH4oJFN1ZmZpeFBhdHRlcm4pKT8iOwokRnJl
ZUxpbmtQYXR0ZXJuPSJ7eygkQW55TGV0dGVyKyg/Oig/OlxzKnxbLX5dKSRBbnlMZXR0ZXIrKSop
KD86XFx8KCg/Oig/OlxzKnxbLX5dKSRBbnlMZXR0ZXIpKikpP319KCgtPyRBbnlMZXR0ZXIpKiki
OwokTGlua1BhdHRlcm5zWzc1MF1bIlxcYiRHcm91cE5hbWVQYXR0ZXJuKFtcXC8uXSkkUGFnZVRp
dGxlUGF0dGVybiJdID0gCiAgJEZtdFdpa2lMaW5rOwoqLwokVmVyc2lvbkxpbmtQYXR0ZXJuID0g
CiAgIig/OigkR3JvdXBOYW1lUGF0dGVybikoW1xcLy5dKSk/KCgkV2lraVdvcmRQYXR0ZXJuKXwo
JEZyZWVMaW5rUGF0dGVybikpIjsKJERvdWJsZUJyYWNrZXRzWyIvXFxbXFxbfigkU3VmZml4UGF0
dGVybikvIl0gPSAiW1skcGFnZW5hbWV+JDEiOwokRG91YmxlQnJhY2tldHNbIi8oW15BLVphLXow
LTlcXC9dKX4oJFN1ZmZpeFBhdHRlcm4pLyJdID0gIiQxW1skcGFnZW5hbWV+JDIgfiQyXV0iOwok
RG91YmxlQnJhY2tldHNbIi9cXFtcXFsoJFZlcnNpb25MaW5rUGF0dGVybil+L2UiXSA9ICciW1si
LlJlYWRWZXJzaW9uKCIkMSIpOyc7CiREb3VibGVCcmFja2V0c1siLygkVmVyc2lvbkxpbmtQYXR0
ZXJuKX4vZSJdID0gJ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KihcXFtcXFspPyh+JFN1ZmZpeFBhdHRlcm4pLyIsJHgsJG1hdGNoKSkgewogICAgICAg
ICAgJHYgPSAiJHZlcnNpb25uYW1lJG1hdGNoWzNdIjsKICAgICAgfQogICAgfQogIH0KICByZXR1
cm4gJHY7Cn0KCj8+


--====50495352575050515357===1--







More information about the pmwiki-users mailing list