0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-09-18 18:25:18 +00:00

Add API for version extraction.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1535 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang 2008-02-10 00:49:31 +00:00
parent b6c9dcefd7
commit d00cb1e64d
2 changed files with 13 additions and 2 deletions

View File

@ -48,11 +48,14 @@ class ConfigSchema_StringHashReverseAdapter
$ret['ID'] = "$ns.$directive";
$ret['TYPE'] = $def->type;
$ret['DEFAULT'] = $this->export($this->schema->defaults[$ns][$directive]);
// Attempt to extract version information from description.
$description = $this->normalize($def->description);
list($description, $version) = $this->extractVersion($description);
$ret['DESCRIPTION'] = wordwrap($this->normalize($def->description), 75, "\n");
if ($version) $ret['VERSION'] = $version;
$ret['DEFAULT'] = $this->export($this->schema->defaults[$ns][$directive]);
$ret['DESCRIPTION'] = wordwrap($description, 75, "\n");
if ($def->allowed !== true) {
$ret['ALLOWED'] = $this->exportLookup($def->allowed);
@ -108,4 +111,8 @@ class ConfigSchema_StringHashReverseAdapter
return str_replace(array("\r\n", "\r"), "\n", $string);
}
public function extractVersion($description) {
return array($description, false);
}
}

View File

@ -83,4 +83,8 @@ class ConfigSchema_StringHashReverseAdapterTest extends UnitTestCase
$this->assertMethod('exportLookup', array('key' => true, 'key2' => true, 3 => true), "'key', 'key2', 3");
}
function assertExtraction($desc, $expect_desc, $expect_version) {
}
}