<?php
/*  Copyright 2017 Charles Goldstein. 
    This file is nestedmarkups.php; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published
    by the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
*/

# Version date
$RecipeInfo['NestedMarkups']['Version'] = '2017-10-25';

# declare $NestedMarkups for (:if enabled NestedMarkups:) recipe installation check
global $NestedMarkups; $NestedMarkups = 1;

Markup('markupend', '>markup',
  "/\\(:markup(\\d*)(\\s+([^\\n]*?))?:\\)[^\\S\\n]*\\n(.*?)\\(:markup\\1end:\\)/si",
  "NestedMarkupsMarkupMarkupEnd"
);

function NestedMarkupsMarkupMarkupEnd($m) {
  extract($GLOBALS["MarkupToHTML"]);
  return MarkupMarkup($pagename, $m[4], $m[2]);
}