<?php if (!defined('PmWiki')) exit();

SDV($RecipeInfo['Licenses']['Version'], '2007-02-15');

SDVA($LicenseTypeFmt, array(
  'by' => '[[http://creativecommons.org/licenses/by/3.0/ | http://i.creativecommons.org/l/by/3.0/80x15.png"Creative Commons License"]]',
  'by-nd' => '[[http://creativecommons.org/licenses/by-nd/3.0/ | http://i.creativecommons.org/l/by-nd/3.0/80x15.png"Creative Commons License"]]',
  'by-nc-nd' => '[[http://creativecommons.org/licenses/by-nc-nd/3.0/ | http://i.creativecommons.org/l/by-nc-nd/3.0/80x15.png"Creative Commons License"]]',
  'by-nc' => '[[http://creativecommons.org/licenses/by-nc/3.0/ | http://i.creativecommons.org/l/by-nc/3.0/80x15.png"Creative Commons License"]]',
  'by-nc-sa' => '[[http://creativecommons.org/licenses/by-nc-sa/3.0/ | http://i.creativecommons.org/l/by-nc-sa/3.0/80x15.png"Creative Commons License"]]',
  'by-sa' => '[[http://creativecommons.org/licenses/by-sa/3.0/ | http://i.creativecommons.org/l/by-sa/3.0/80x15.png"Creative Commons License"]]',
  'pd' => '[[http://creativecommons.org/licenses/publicdomain/ | http://creativecommons.org/images/public/norights.gif"Public Domain Dedication"]]',
  ));

SDV($LicenseDefault, 'by-nc-nd');

Markup('license', 'directives',
  '/\\(:license(\\s.*?)?:\\)/e',
  "License(\$pagename, PSS('$1'))");

function License($pagename, $args) {
  global $LicenseTypeFmt, $LicenseDefault;
  $args = ParseArgs($args);
  $cc = $args[''][0];
  if ($cc == '') $cc = $LicenseDefault;
  $fmt = $LicenseTypeFmt[strtolower($cc)];
  if (!$fmt) return "unrecognized license $cc";
  return FmtPageName($fmt, $pagename);
}