Description
While unifying of parser and macros is discussed I like to request to have the possibility to use a macro as pragma statement.
At the moment we can't add macros which change the behaviour of elements of the whole page. We can only do this for parts of the page by a parser.
#pragma section-numbers off will change the behaviour of the actual page, no numbers for sections.
This is implemented somewhere deep in the codebase. But it could be also a macro section-numbers.py with one argument. And then this macro is used to format the page by it's additional rules.
The request is about changing this behaviour of pragma to call macros.
Then users could add some additional rules for pages, e.g. alphabetical sort of items.
If each parser could be used then probably one could write a whole page in latex. -- ReimarBauer 2005-03-13 08:43:07
You may want to look at HelpOnProcessingInstructions and esp. #format.
Yes I thought I have tried it right, I don't know what I did wrong. Now it goes well! -- ReimarBauer 2005-03-13 18:13:22
Discussion
Its very easy to write a very simple macro which will change pragmas like #pragma section-numbers off, without changing moin code. Maybe something like [[SetPragma(pragma, value)]].
About "alphabetical sort of items", there is no pragma to do that. This is a new feature that need to be implemented deep in the code, or by a custom parser, that will sort list items before rendering:
For example, this markup:
{ { { #!sort * Zee should be last * Ah, the first line * Middle line } } }
Will render as:
- Ah, the first line
- Middle line
- Zee should be last
I don't see why moin core should support sorting of page text, this could be done by the author, and is supported by many editors. -- NirSoffer 2005-03-13 13:38:24
Nir, it's only an example. If Parsers, Macros and Pocessors are unified then we have PPM and pragma. I will rewrite my code to PPM syntax. From 1.2.4 to 1.3 there were much changes to do and I believe some for PPM too. I am missing at the moment the user written Gallery.py macro. All the others we need in our wikis were updated to 1.3 syntax. The feature request is to think about if the unifying process belongs only to Parsers, Macros and Pocessors. A pragma command works similiar to a macro or parser. If later on pragma will be exchanged to a macro then probably the syntax of PPM got changes again. I don't know if someone has done a request by unifying parser and processors to think on macros too. Now it is clear that it should be unified. At the moment I could easily install new wiki instances based on new Moin Versions on a new server but I can only migrate an existing wiki if a lot of the user scripts were migrated before. I fear a bit about that's the syntax is changed again before all user scripts were migrated to the actual syntax. That's a dilemma. But I know development needs changes too. -- ReimarBauer 2005-03-13 18:13:22
Before the move to this page, you wrote that you like to write #pragma latex and all stuff on the page should be read as latex. If I understood this correctly, perhaps you should look at #format latex which tells moin to use the latex parser to parse the page... -- OliverGraf 2005-03-13 19:49:28
- You may want to look above.
Oliver there was a mistyping myself so I missed this wonderful feature all the time and it was already there. I thought I give an example but in this case it was the wrong one. -- ReimarBauer 2005-03-13 21:52:06
- You may want to look above.
So you want to replace pragma with a macro call? This can be done, but require changing the way pragmas are parsed and cached. Using a macro/parser can be easier way to add custom key-values to a page, so maybe its a good idea. -- NirSoffer 2005-03-13 20:50:05
Probably yes, I believe it is better to look now at all kind of page extensions if they could be unified and if they fit into the new concept or if not to extend the concept now. The new concept gives then a great advantage to all the further PPMcode and the old PPMcode needs only one time changes. It's only my opinion to this part of enhancement. -- ReimarBauer 2005-03-13 21:52:06
The name PPM does describe the techniques are used to write the code but normally I use the words extension or plugin or module to describe someone who does like to use the wiki and it's PPMs. If the code is unified we should use in my eyes a common name like firefox and others are doing. Just tell it extension -- ReimarBauer 2005-11-19 07:25:54