From 5f0198a4073cfab3b403fdbea2295511d772fcba Mon Sep 17 00:00:00 2001 From: jepso Date: Tue, 12 Jun 2007 22:18:21 +0000 Subject: [PATCH] New documentation tool. --- manual/new/.htaccess | 5 + manual/new/DocTool.php | 257 ++++++++ .../connection-component-binding.txt | 20 + .../dsn-the-data-source-name.txt | 106 ++++ .../lazy-connecting-to-database.txt | 17 + .../managing-connections.txt | 54 ++ .../opening-a-new-connection.txt | 44 ++ .../new/docs/en/getting-started/compiling.txt | 11 + .../en/getting-started/exporting-classes.txt | 18 + .../docs/en/getting-started/installation.txt | 38 ++ .../docs/en/getting-started/requirements.txt | 2 + .../getting-started/starting-new-project.txt | 27 + .../working-with-existing-databases.txt | 69 +++ .../en/object-relational-mapping/columns.txt | 5 + .../columns/column-aliases.txt | 15 + .../columns/column-naming.txt | 8 + .../columns/data-types.txt | 261 ++++++++ .../columns/default-values.txt | 14 + .../constraints-and-validators.txt | 117 ++++ .../introduction.txt | 41 ++ .../table-and-class-naming.txt | 12 + .../table-options.txt | 30 + .../en/real-world-examples/album-lister.txt | 1 + .../real-world-examples/forum-application.txt | 53 ++ .../user-management-system.txt | 91 +++ manual/new/docs/en/root.txt | 328 ++++++++++ manual/new/highlight.php | 568 ++++++++++++++++++ manual/new/images/quotation-mark.png | Bin 0 -> 502 bytes manual/new/index.php | 53 ++ manual/new/lang/en.php | 6 + manual/new/lang/fi.php | 9 + manual/new/scripts/tree.js | 248 ++++++++ manual/new/styles/basic.css | 217 +++++++ manual/new/styles/iefix.css | 6 + manual/new/styles/print.css | 63 ++ manual/new/styles/tree.css | 33 + manual/new/template.php | 56 ++ vendor/Sensei/Sensei.php | 136 +++++ vendor/Sensei/Sensei/Doc/Section.php | 384 ++++++++++++ vendor/Sensei/Sensei/Doc/Toc.php | 132 ++++ vendor/Text/Wiki/Render/Xhtml/Bold.php | 4 +- vendor/Text/Wiki/Render/Xhtml/Code.php | 41 +- vendor/Text/Wiki/Render/Xhtml/Italic.php | 4 +- vendor/Text/Wiki/Render/Xhtml/Underline.php | 4 +- vendor/Text/Wiki/Render/Xhtml/Url.php | 2 + 45 files changed, 3584 insertions(+), 26 deletions(-) create mode 100644 manual/new/.htaccess create mode 100644 manual/new/DocTool.php create mode 100644 manual/new/docs/en/connection-management/connection-component-binding.txt create mode 100644 manual/new/docs/en/connection-management/dsn-the-data-source-name.txt create mode 100644 manual/new/docs/en/connection-management/lazy-connecting-to-database.txt create mode 100644 manual/new/docs/en/connection-management/managing-connections.txt create mode 100644 manual/new/docs/en/connection-management/opening-a-new-connection.txt create mode 100644 manual/new/docs/en/getting-started/compiling.txt create mode 100644 manual/new/docs/en/getting-started/exporting-classes.txt create mode 100644 manual/new/docs/en/getting-started/installation.txt create mode 100644 manual/new/docs/en/getting-started/requirements.txt create mode 100644 manual/new/docs/en/getting-started/starting-new-project.txt create mode 100644 manual/new/docs/en/getting-started/working-with-existing-databases.txt create mode 100644 manual/new/docs/en/object-relational-mapping/columns.txt create mode 100644 manual/new/docs/en/object-relational-mapping/columns/column-aliases.txt create mode 100644 manual/new/docs/en/object-relational-mapping/columns/column-naming.txt create mode 100644 manual/new/docs/en/object-relational-mapping/columns/data-types.txt create mode 100644 manual/new/docs/en/object-relational-mapping/columns/default-values.txt create mode 100644 manual/new/docs/en/object-relational-mapping/constraints-and-validators.txt create mode 100644 manual/new/docs/en/object-relational-mapping/introduction.txt create mode 100644 manual/new/docs/en/object-relational-mapping/table-and-class-naming.txt create mode 100644 manual/new/docs/en/object-relational-mapping/table-options.txt create mode 100644 manual/new/docs/en/real-world-examples/album-lister.txt create mode 100644 manual/new/docs/en/real-world-examples/forum-application.txt create mode 100644 manual/new/docs/en/real-world-examples/user-management-system.txt create mode 100644 manual/new/docs/en/root.txt create mode 100644 manual/new/highlight.php create mode 100644 manual/new/images/quotation-mark.png create mode 100644 manual/new/index.php create mode 100644 manual/new/lang/en.php create mode 100644 manual/new/lang/fi.php create mode 100644 manual/new/scripts/tree.js create mode 100644 manual/new/styles/basic.css create mode 100644 manual/new/styles/iefix.css create mode 100644 manual/new/styles/print.css create mode 100644 manual/new/styles/tree.css create mode 100644 manual/new/template.php create mode 100644 vendor/Sensei/Sensei.php create mode 100644 vendor/Sensei/Sensei/Doc/Section.php create mode 100644 vendor/Sensei/Sensei/Doc/Toc.php diff --git a/manual/new/.htaccess b/manual/new/.htaccess new file mode 100644 index 000000000..6b6605260 --- /dev/null +++ b/manual/new/.htaccess @@ -0,0 +1,5 @@ +# RewriteEngine on + +# RewriteRule ^chapter/(.*)/(.*)$ index.php [r=404] +# RewriteRule ^chapter/(.*)$ index.php?chapter=$1 +# RewriteRule ^one-page$ index.php?one-page=1 diff --git a/manual/new/DocTool.php b/manual/new/DocTool.php new file mode 100644 index 000000000..bf77d41f0 --- /dev/null +++ b/manual/new/DocTool.php @@ -0,0 +1,257 @@ + 1, + 'lang' => 'en', + 'default-lang' => 'en', + 'one-page' => false, + 'section' => null, + 'clean-url' => false, + 'base-url' => ''); + private $_lang = array(); + + public function __construct($filename) + { + $this->_wiki = new Text_Wiki(); + $this->_wiki->disableRule('Wikilink'); + $this->_toc = new Sensei_Doc_Toc($filename); + } + + public function getOption($option) + { + return $this->_options[$option]; + } + + public function setOption($option, $value) + { + switch ($option) { + case 'max-level': + if (!is_int($value)) { + throw new Exception('Value must be an integer.'); + } + break; + + case 'one-page': + case 'clean-url': + if (!is_bool($value)) { + throw new Exception('Value must be a boolean.'); + } + break; + + case 'locale': + case 'base-url': + if (!is_string($value)) { + throw new Exception('Value must be a string.'); + } + break; + + case 'section': + if (! $value instanceof Sensei_Doc_Section) { + throw new Exception('Value must be an instance of Sensei_Doc_Section.'); + } + break; + + default: + throw new Exception('Unknown option.'); + } + + $this->_options[$option] = $value; + } + + public function addLanguage(array $translations, $lang) + { + $this->_lang[$lang] = $translations; + } + + public function translate($string) + { + $language = $this->getOption('lang'); + + if (array_key_exists($language, $this->_lang) + && array_key_exists($string, $this->_lang[language])) { + return $this->_lang[$language][$string]; + } else { + return $string; + } + } + + public function renderToc($toc = null) + { + if (!$toc) { + $toc = $this->_toc; + } + + $classes = array(); + + if ($toc instanceof Sensei_Doc_Toc) { + + $class = ''; + if ($this->getOption('one-page')) { + $class = ' class="one-page"'; + } + + echo '' . "\n"; + echo '

Table of Contents

' . "\n"; + + $classes[] = 'tree'; + + } else { + + $isParent = false; + $section = $this->getOption('section'); + + if ($section !== null) { + $current = $section; + do { + if ($current === $toc) { + $isParent = true; + break; + } + } while (($current = $current->getParent()) !== null); + } + + if (! $isParent) { + $classes[] = 'closed'; + } + } + + $classes = implode(' ', $classes); + + if ($classes === '') { + echo "