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