<?php if (!defined('PmWiki')) exit();
# vim: set ts=4 sw=4 et:
##
##        File: EditMX.php
##     Version: 2008-05-04B
##      Status: alpha
##      Author: Peter Bowers
## Create Date: May 4, 2008
##   Copyright: 2008, Peter Bowers
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License, Version 2, as
## published by the Free Software Foundation.
## http://www.gnu.org/copyleft/gpl.html
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##

SDV($ROSPatterns['/\\{ROS(\\(\\w+\\b.*?\\))\\}/e'], "EditMX(\$pagename, PSS('$1'))");
SDV($ROEPatterns['/\\{ROE(\\(\\w+\\b.*?\\))\\}/e'], "EditMX(\$pagename, PSS('$1'))");
Markup('{edit(', '<{$var}',
  '/\\{edit(\\(\\w+\\b.*?\\))\\}/e',
  "EditMX(\$pagename, PSS('$1'))");

# The setting of $MXWhileEditing is designed to help MX recipes that are
# sensitive to $action=='edit' to recognize that it's OK for them to execute.
# (particularly this is necessary for WikiSh compatability)
function EditMX($pagename, $args)
{
    global $MXWhileEditing;
    $MXWhileEditing = true;
    $rtn = MarkupExpression($pagename, $args);
    $MXWhileEditing = false;
    return($rtn);
}