From e2149e3d8b87b382563a9def6f376a5f289754d3 Mon Sep 17 00:00:00 2001 From: xue <> Date: Fri, 12 May 2006 12:38:32 +0000 Subject: Merge from 3.0 branch till 1054. --- buildscripts/texbuilder/build.php | 116 +++---------------------------- buildscripts/texbuilder/create_index.php | 90 ------------------------ buildscripts/texbuilder/pages.php | 100 ++++++++++++++++++++++++++ 3 files changed, 111 insertions(+), 195 deletions(-) delete mode 100644 buildscripts/texbuilder/create_index.php create mode 100644 buildscripts/texbuilder/pages.php (limited to 'buildscripts/texbuilder') diff --git a/buildscripts/texbuilder/build.php b/buildscripts/texbuilder/build.php index f0556e3f..cbea9859 100644 --- a/buildscripts/texbuilder/build.php +++ b/buildscripts/texbuilder/build.php @@ -10,102 +10,9 @@ $mainTexFile = dirname(__FILE__).'/prado3_quick_start.tex'; //page root location $base = realpath(dirname(__FILE__).'/../../demos/quickstart/protected/pages/'); -//search index data directory -$index_dir = realpath(dirname(__FILE__).'/../../demos/quickstart/protected/index/data/'); - - -//list page into chapters -$pages['Getting Started'] = array( - 'GettingStarted/Introduction.page', - 'GettingStarted/AboutPrado.page', - 'GettingStarted/Installation.page', - 'GettingStarted/HelloWorld.page', - 'GettingStarted/Upgrading.page' - ); - -$pages['Fundamentals'] = array( - 'Fundamentals/Architecture.page', - 'Fundamentals/Components.page', - 'Fundamentals/Controls.page', - 'Fundamentals/Pages.page', - 'Fundamentals/Modules.page', - 'Fundamentals/Services.page', - 'Fundamentals/Applications.page', - 'Fundamentals/Hangman.page'); - -$pages['Configurations'] = array( - 'Configurations/Overview.page', - 'Configurations/Templates1.page', - 'Configurations/Templates2.page', - 'Configurations/Templates3.page', - 'Configurations/AppConfig.page', - 'Configurations/PageConfig.page'); - -$pages['Control Reference : Standard Controls'] = array( - 'Controls/Button.page', - 'Controls/CheckBox.page', - 'Controls/ColorPicker.page', - 'Controls/DatePicker.page', - 'Controls/Expression.page', - 'Controls/FileUpload.page', - 'Controls/Head.page', - 'Controls/HiddenField.page', - 'Controls/HtmlArea.page', - 'Controls/HyperLink.page', - 'Controls/ImageButton.page', - 'Controls/ImageMap.page', - 'Controls/Image.page', - 'Controls/InlineFrame.page', - 'Controls/JavascriptLogger.page', - 'Controls/Label.page', - 'Controls/LinkButton.page', - 'Controls/Literal.page', - 'Controls/MultiView.page', - 'Controls/Panel.page', - 'Controls/PlaceHolder.page', - 'Controls/RadioButton.page', - 'Controls/SafeHtml.page', - 'Controls/Statements.page', - 'Controls/Table.page', - 'Controls/TextBox.page', - 'Controls/TextHighlighter.page', - 'Controls/Wizard.page'); - -$pages['Control Reference : List Controls'] = array( - 'Controls/List.page'); - -$pages['Control Reference : Validation Controls'] = array( - 'Controls/Validation.page'); - -$pages['Control Reference : Data Controls'] = array( - 'Controls/Data.page', - 'Controls/DataList.page', - 'Controls/DataGrid.page', - 'Controls/Repeater.page'); - -$pages['Write New Controls'] = array( - 'Controls/NewControl.page'); - -$pages['Advanced Topics'] = array( - 'Advanced/Auth.page', - 'Advanced/Security.page', - 'Advanced/Assets.page', - 'Advanced/MasterContent.page', - 'Advanced/Themes.page', - 'Advanced/State.page', - 'Advanced/Logging.page', - 'Advanced/I18N.page', - 'Advanced/Error.page', - 'Advanced/Performance.page'); - -$pages['Client-side Scripting'] = array( - 'Advanced/Scripts.page', - 'Advanced/Scripts1.page', - 'Advanced/Scripts2.page', - 'Advanced/Scripts3.page'); - //-------------- END CONFIG ------------------ +$pages = include('pages.php'); function escape_verbatim($matches) { @@ -259,9 +166,9 @@ function parse_html($page,$html) $html = preg_replace('/<\/li>/', '', $html); //headings - $html = preg_replace('/

([^<]+)<\/h1>/', '\section{$1}', $html); - $html = preg_replace('/

([^<]+)<\/h2>/', '\subsection{$1}', $html); - $html = preg_replace('/

([^<]+)<\/h3>/', '\subsubsection{$1}', $html); + $html = preg_replace('/([^<]+)<\/h1>/', '\section{$1}', $html); + $html = preg_replace('/([^<]+)<\/h2>/', '\subsection{$1}', $html); + $html = preg_replace('/([^<]+)<\/h3>/', '\subsubsection{$1}', $html); @@ -318,8 +225,8 @@ $header_count = 0; //--------------- Indexer ------------------- -require_once('create_index.php'); -$indexer = new quickstart_index($index_dir); +//require_once('create_index.php'); +//$indexer = new quickstart_index($index_dir); // ---------------- Create the Tex files --------- $count = 1; @@ -339,14 +246,13 @@ foreach($pages as $chapter => $sections) $current_path = $page; //add id to

,

, <3> - $content = set_header_id(file_get_contents($page),$j++); - file_put_contents($page, $content); + $tmp_content = set_header_id(file_get_contents($page),$j++); + file_put_contents($page, $tmp_content); $content .= get_section_label($section); $file_content = file_get_contents($page); - $tex = parse_html($page,$file_content); - $content .= $tex; - $indexer->add($file_content,$section, filemtime($page)); + $tex = + $content .= parse_html($page,$file_content); } //var_dump($content); @@ -355,7 +261,7 @@ foreach($pages as $chapter => $sections) echo "\n"; } -$indexer->commit(); +//$indexer->commit(); if($argc <= 1 && $count > 1) { diff --git a/buildscripts/texbuilder/create_index.php b/buildscripts/texbuilder/create_index.php deleted file mode 100644 index b451473d..00000000 --- a/buildscripts/texbuilder/create_index.php +++ /dev/null @@ -1,90 +0,0 @@ -_index = new Zend_Search_Lucene($index_file, true); - $this->_dir = $index_file; - echo "Building search index...\n"; - } - - public function add($content, $section, $mtime) - { - foreach($this->split_headings($content) as $headers) - { - $doc = new Zend_Search_Lucene_Document(); - $link = "index.php?page=".preg_replace('/\/|\\\/', '.', $section); - $link = str_replace('.page', '', $link).'#'.$headers['section']; - - //unsearchable text - $doc->addField(Zend_Search_Lucene_Field::UnIndexed('link', $link)); - $doc->addField(Zend_Search_Lucene_Field::UnIndexed('mtime', $mtime)); - $doc->addField(Zend_Search_Lucene_Field::UnIndexed('title', $headers['title'])); - $doc->addField(Zend_Search_Lucene_Field::UnIndexed('text', $headers['content'])); - - //searchable text - $doc->addField(Zend_Search_Lucene_Field::Keyword('page', strtolower($headers['title']))); - $body = strtolower($this->sanitize($headers['content'])).' '.strtolower($headers['title']); - $doc->addField(Zend_Search_Lucene_Field::Unstored('contents',$body)); - $this->_index->addDocument($doc); - } - } - - function sanitize($input) - { - return htmlentities(strip_tags( $input )); - } - - public function index() - { - return $this->_index; - } - - protected function split_headings($html) - { - $html = preg_replace('/<\/?com:TContent[^<]*>/', '', $html); - - $html = preg_replace('/([^<]*)<\/b>/', '$1', $html); - $html = preg_replace('/([^<]*)<\/i>/', '$1', $html); - $html = preg_replace('/([^<]*)<\/tt>/', '$1', $html); - - $html = preg_replace('/]*)>([^<]*)<\/h1>/', '$2', $html); - $html = preg_replace('/]*)>([^<]*)<\/h2>/', '$2', $html); - $html = preg_replace('/]*)>([^<]*)<\/h3>/', '$2', $html); - - - $sections = preg_split('/]*>([^<]+)<\/hh>/', $html,-1); - $headers = array(); - preg_match_all('/]*)>([^<]+)<\/hh>/', $html, $headers); - $contents = array(); - for($i = 1, $t = count($sections); $i < $t; $i++) - { - $content['title'] = trim($this->sanitize($headers[2][$i-1])); - $sec = array(); - preg_match('/"([^"]*)"/', $headers[1][$i-1], $sec); - $content['section'] = str_replace('"', '',$sec[0]); - $content['content'] = trim($this->sanitize($sections[$i])); - $contents[] = $content; - } - - return $contents; - } - - public function commit() - { - $this->_index->commit(); - $count = $this->_index->count(); - echo "\nSaving search index ({$count}) to {$this->_dir}\n\n"; - } -} -?> \ No newline at end of file diff --git a/buildscripts/texbuilder/pages.php b/buildscripts/texbuilder/pages.php new file mode 100644 index 00000000..c55747c6 --- /dev/null +++ b/buildscripts/texbuilder/pages.php @@ -0,0 +1,100 @@ + \ No newline at end of file -- cgit v1.2.3