Revision [16740]
This is an old revision of MagicWords made by MrjSsk on 2007-05-31 10:43:23.
Magic Words for inserted content
DarTar suggested I open a discussion page regarding PseudoFormatters, which are potentially wonderful but can grow out of control.
The concept of the PseudoFormatters is excellent - a way to use the server to dynamically insert content into an entry on save. The content is substituted at the point in the syntax it is requested, and is limited only by what may be programmed. The example used is a signature markup to insert the user's WikiName, with a timestamp, or the timestamp alone.
The PseudoFormatters are specific magic words; they will magically be replaced by the appropriate content. However, as soon as you create the signature cantrip, I would personally be wanting to have:
- Current day of week (number, or name)
- Current day of month
- Current week of year
- Current month of year (number, or name)
- Current year
- Current time of day (without date)
- Name of page
- Name of pageowner
- Content of ThisOtherPage
Each of these can be very useful, but the idea of accreting dozens to hundreds of special magic words does not seem to be the best idea for the parser or the project's goal of a lightweight wiki.
Alternative schemes
There are routes around the feeping creaturism of the above model. Here are a couple of them.
- Provide access to the system variables in the parser.
- Provide an interface for defining variables.
One method brought up in IRC discussion was to provide an alternative markup which could be used to tell the parser to replace the content with the value of a system variable. Placing the variable name inside doubled greaterthan / lessthan symbols leaves it readily parsed and simply substituted. e.g.