mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-12-22 08:21:52 +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:
parent
b6c9dcefd7
commit
d00cb1e64d
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user