On 31 May 2010 23:37, David Gerard dgerard@gmail.com wrote:
On 31 May 2010 23:31, Aryeh Gregor Simetrical+wikilist@gmail.com wrote:
Wiki syntax is too complicated for this to be feasible. It also doesn't have a one-to-one mapping to HTML. It's been tried before, but what you end up with is that it doesn't round-trip: if you open in the WYSIWYG editor and save with no changes, it saves totally different wikicode, confusing anyone who's using actual wikitext. The only feasible solutions are to either drastically simplify wikitext, or switch to WYSIWYG only, and those would both be very disruptive.
The other solution is to use a proper MVC framework, and define everything in terms of modifications to the wikitext (and you can then constrain what those modifications are to avoid mangling) and run that through a parser to generate the html preview. Alternatively, if your wikitext modifications are constrained enough, it is possible to implement modifications as a pair of functions, one of which edits the wikitext and the other edits the HTML (this is the method used by English Wiktionary for the translation adding interface - and makes undo/redo really easy). Building such a thing is time-consuming - particularly if you have to ensure that the wikitext modification and the HTML modification are the same - as there's a pretty large number of things people would like to do with wikitext. That said, it's pretty possible to use a wysiwyg for editing the contents of a paragraph, so you could have one action for "change the content of" in addition to actions for inserting/deleting and moving things around (in a perfect world, a wysiwyg would trigger constrained actions based on user-interaction - that is the "hard" part of this - the rest is just complicated). As there's already a javascript thing for general template arguments modifications (based on xml somehow), so this would be extendable to work with templates too.
Conrad