Changes

Jump to navigation Jump to search
1,654 bytes added ,  18:18, 10 August 2020
should be ok for now
* The `content_models` mediawiki SQL database table needed an extra row with the values `4`,`contextxml`. Added manually as I could not figure out how to do this automatically at extension registration time.
* `WikitextContent` does not like being subclassed, so some functions from the `parent::` needed to be copied wholesale instead of just wrapping a bit of code around the parent implementation.
 
The `ConTeXtXMLContent` also runs a well-formedness check on the XML before allowing the user to save the page. In the future, this will be extended to do actual validation against a DTD or Schema (but we need to have some consensus on the definitive format before that can be implemented). For now, we trust that well-formed XML means that the content is ok.
== Building on `Article` ==
Prints a simple help message at the top of the edit field for `/Command` pages.
{{todo|more later == Generating the wikitext code for page views and previews == All the above is written in php. But since I am a complete noob in php and rather at home in Lua, I decided to write the conversion from XML to wiki format as an `mtxrun` script. The script is called `mtx-wikipage.lua`, and it converts our special XML format into wiki code. I call it an `mtxrun` script, but really it only takes an option for the input file (in the case of section editing, this is a temporary file generated by php) and an optional output file (useful for debugging). Besides that, it is almost pure lua. It uses an integrated tiny expat-[[User:Taco|Taco]] ([[User talk:Taco|talk]]style XML parser and a few handwritten xml tree processing functions to create wiki code. The penalty for calling an external program from php is relatively small, because 1) the processed page content is fairly small. 2) the internal caching of mediawiki makes it so that the code is only called when a page is actively being edited and 3) 19:48starting `luametatex` as a Lua interpreter only is surprisingly fast. The only unsolved problem with this subsystem is that it needs an intermediate two-line shell script that does nothing except adjust the PATH environment variable, 10 August 2020 just so that `mtxrun` can run without complaints about unfound paths and configuration files. (CESTmtxrun's warning messages would have to stripped off the `mtx-wikipage.lua` output otherwise)}}

Navigation menu