So, in the course of trying to implement user signature processing in the PEGjs grammar (https://bugzilla.wikimedia.org/show_bug.cgi?id=35392), it occurred to me that this is in a whole new class of transformation function. "~~~~" is actually replaced in the wikitext during the round-trip of saving on the server. Ha ha, not the quaint little evening project I thought I was taking on!
Looking at includes/parser/Parser.php::pstPass2, in addition to user signatures, pre-save transformations can also insert the current timestamp, do a literal transclusion using the {{subst: tag, or complete the "context" of a wikilink.
Implementing this class of transformation in the VisualEditor gets tricky because the client wikitext must be kept in sync. Is there already a provision made for mutating wikitext after a round-trip?
Thanks, Adam Wight
On Thu, Mar 22, 2012 at 10:28 AM, Adam Wight spam@ludd.net wrote:
So, in the course of trying to implement user signature processing in the PEGjs grammar (https://bugzilla.wikimedia.org/show_bug.cgi?id=35392), it occurred to me that this is in a whole new class of transformation function. "~~~~" is actually replaced in the wikitext during the round-trip of saving on the server. Ha ha, not the quaint little evening project I thought I was taking on!
Looking at includes/parser/Parser.php::pstPass2, in addition to user signatures, pre-save transformations can also insert the current timestamp, do a literal transclusion using the {{subst: tag, or complete the "context" of a wikilink.
Implementing this class of transformation in the VisualEditor gets tricky because the client wikitext must be kept in sync. Is there already a provision made for mutating wikitext after a round-trip?
These sorts of things really should be happening *in* the editor, rather than in the parser. We only have to put ~~~~ in because the original editor was too primitive to have a nice "insert signature" live function. So I think it's worth really rethinking how these things get done for the new paradigm. :)
-- brion
bvibber@wikimedia.org:
On Thu, Mar 22, 2012 at 10:28 AM, Adam Wight spam@ludd.net wrote:
So, in the course of trying to implement user signature processing in the PEGjs grammar (https://bugzilla.wikimedia.org/show_bug.cgi?id=35392), it occurred to me that this is in a whole new class of transformation function. "~~~~" is actually replaced in the wikitext during the round-trip of saving on the server. Ha ha, not the quaint little evening project I thought I was taking on!
Looking at includes/parser/Parser.php::pstPass2, in addition to user signatures, pre-save transformations can also insert the current timestamp, do a literal transclusion using the {{subst: tag, or complete the "context" of a wikilink.
Implementing this class of transformation in the VisualEditor gets tricky because the client wikitext must be kept in sync. Is there already a provision made for mutating wikitext after a round-trip?
These sorts of things really should be happening *in* the editor, rather than in the parser. We only have to put ~~~~ in because the original editor was too primitive to have a nice "insert signature" live function. So I think it's worth really rethinking how these things get done for the new paradigm. :)
-- brion
+1.0
The {{subst: incantation would be easy to handle with the editor as well, if we care. Just make an api call to fetch template wikitext.
-adam
I agree that this is an excellent example of PST being used to supplement the primitive nature of the plain text editor.
What's going to be interesting is that in the editor when you add your signature, it will be treated as a discreet object, but once you save it will just be linked text like anything else. This is just how it works though, no getting around that.
- Trevor
On Thu, Mar 22, 2012 at 12:28 PM, Adam Wight spam@ludd.net wrote:
bvibber@wikimedia.org:
On Thu, Mar 22, 2012 at 10:28 AM, Adam Wight spam@ludd.net wrote:
So, in the course of trying to implement user signature processing in the PEGjs grammar (
https://bugzilla.wikimedia.org/show_bug.cgi?id=35392),
it occurred to me that this is in a whole new class of transformation function. "~~~~" is actually replaced in the wikitext during the round-trip of saving on the server. Ha ha, not the quaint little evening project I thought I was taking on!
Looking at includes/parser/Parser.php::pstPass2, in addition to user signatures, pre-save transformations can also insert the current timestamp, do a literal transclusion using the {{subst: tag, or complete the "context" of a wikilink.
Implementing this class of transformation in the VisualEditor gets tricky because the client wikitext must be kept in sync. Is there already a provision made for mutating wikitext after a round-trip?
These sorts of things really should be happening *in* the editor, rather than in the parser. We only have to put ~~~~ in because the original
editor
was too primitive to have a nice "insert signature" live function. So I think it's worth really rethinking how these things get done for the new paradigm. :)
-- brion
+1.0
The {{subst: incantation would be easy to handle with the editor as well, if we care. Just make an api call to fetch template wikitext.
-adam
Wikitext-l mailing list Wikitext-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitext-l
wikitext-l@lists.wikimedia.org