diff --git a/configdoc/generate.php b/configdoc/generate.php index 2597777d..54b40ede 100644 --- a/configdoc/generate.php +++ b/configdoc/generate.php @@ -28,6 +28,20 @@ $definition = HTMLPurifier_ConfigDef::instance(); $purifier = new HTMLPurifier(); +// generate type XML document +$types_document = new DOMDocument('1.0', 'UTF-8'); +$types_root = $types_document->createElement('types'); +$types_document->appendChild($types_root); +$types_document->formatOutput = true; +foreach ($definition->types as $name => $expanded_name) { + $types_type = $types_document->createElement('type', $expanded_name); + $types_type->setAttribute('id', $name); + $types_root->appendChild($types_type); +} +$types_document->save('types.xml'); + +// generate directive XML document + $dom_document = new DOMDocument('1.0', 'UTF-8'); $dom_root = $dom_document->createElement('configdoc'); $dom_document->appendChild($dom_root); @@ -63,7 +77,10 @@ foreach($definition->info as $namespace_name => $namespace_info) { $dom_directive->appendChild( $dom_document->createElement('name', $name) ); - $dom_directive->appendChild( + + $dom_constraints = $dom_document->createElement('constraints'); + $dom_directive->appendChild($dom_constraints); + $dom_constraints->appendChild( $dom_document->createElement('type', $info->type) ); @@ -113,6 +130,20 @@ $html_output = $xsl_processor->transformToXML($dom_document); // some slight fudges to preserve backwards compatibility $html_output = str_replace('/>', ' />', $html_output); //
not
+$html_output = str_replace(' xmlns=""', '', $html_output); // rm unnecessary xmlns + +if (class_exists('Tidy')) { + // cleanup output + $config = array( + 'indent' => true, + 'output-xhtml' => true, + 'wrap' => 80 + ); + $tidy = new Tidy; + $tidy->parseString($html_output, $config, 'utf8'); + $tidy->cleanRepair(); + $html_output = (string) $tidy; +} // write it to a file (todo: parse into seperate pages) file_put_contents("$xsl_stylesheet_name.html", $html_output); diff --git a/configdoc/styles/plain.css b/configdoc/styles/plain.css new file mode 100644 index 00000000..f9c29fe9 --- /dev/null +++ b/configdoc/styles/plain.css @@ -0,0 +1,6 @@ +table {border-collapse:collapse;} +table td, table th {padding:0.2em;} + +table.constraints {margin:0 0 1em;} +table.constraints th {text-align:left;padding-left:0.4em;} +table.constraints td {padding-right:0.4em;} diff --git a/configdoc/styles/plain.xsl b/configdoc/styles/plain.xsl index c3bbc050..c33f78a1 100644 --- a/configdoc/styles/plain.xsl +++ b/configdoc/styles/plain.xsl @@ -9,21 +9,18 @@ encoding = "UTF-8" doctype-public = "-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system = "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" - indent = "yes" + indent = "no" media-type = "text/html" /> - + <xsl:value-of select="/configdoc/title" /> Configuration Documentation + @@ -51,8 +48,26 @@

- -
+ + + +
+
+ +
+ +
+
+ + + + Type: + + + type type- + + + \ No newline at end of file diff --git a/library/HTMLPurifier/ConfigDef.php b/library/HTMLPurifier/ConfigDef.php index 7f80cc5f..dabe554a 100644 --- a/library/HTMLPurifier/ConfigDef.php +++ b/library/HTMLPurifier/ConfigDef.php @@ -39,17 +39,18 @@ class HTMLPurifier_ConfigDef { /** * Lookup table of allowed types. + * @todo Add descriptions */ var $types = array( - 'string' => true, - 'istring' => true, - 'int' => true, - 'float' => true, - 'bool' => true, - 'lookup' => true, - 'list' => true, - 'hash' => true, - 'mixed' => true + 'string' => 'String', + 'istring' => 'Case-insensitive string', + 'int' => 'Integer', + 'float' => 'Float', + 'bool' => 'Boolean', + 'lookup' => 'Lookup array', + 'list' => 'Array list', + 'hash' => 'Associative array', + 'mixed' => 'Mixed' ); /**