Changeset 1047 for trunk/buildscripts

Show
Ignore:
Timestamp:
05/09/2006 07:11:38 AM (3 years ago)
Author:
xue
Message:

merge from 3.0 branch till 1046.

Location:
trunk/buildscripts/texbuilder
Files:
2 modified
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/buildscripts/texbuilder/build.php

    r972 r1047  
    1010//page root location 
    1111$base = realpath(dirname(__FILE__).'/../../demos/quickstart/protected/pages/'); 
     12 
     13//search index data directory 
     14$index_dir = realpath(dirname(__FILE__).'/../../demos/quickstart/protected/index/data/'); 
     15 
    1216 
    1317//list page into chapters 
     
    9599        'Advanced/Performance.page'); 
    96100 
     101$pages['Client-side Scripting'] = array( 
     102        'Advanced/Scripts.page', 
     103        'Advanced/Scripts1.page', 
     104        'Advanced/Scripts2.page', 
     105        'Advanced/Scripts3.page'); 
    97106 
    98107//-------------- END CONFIG ------------------ 
     
    274283} 
    275284 
     285 
     286function set_header_id($content, $count) 
     287{ 
     288        global $header_count; 
     289        $header_count = $count*100; 
     290        $content = preg_replace_callback('/<h1>/', "h1", $content); 
     291        $content = preg_replace_callback('/<h2>/', "h2", $content); 
     292        $content = preg_replace_callback('/<h3>/', "h3", $content); 
     293        return $content; 
     294} 
     295 
     296function h1($matches) 
     297{ 
     298        global $header_count; 
     299        return "<h1 id=\"".(++$header_count)."\">"; 
     300} 
     301 
     302function h2($matches) 
     303{ 
     304        global $header_count; 
     305        return "<h2 id=\"".(++$header_count)."\">"; 
     306} 
     307 
     308function h3($matches) 
     309{ 
     310        global $header_count; 
     311        return "<h3 id=\"".(++$header_count)."\">"; 
     312} 
     313 
     314$header_count = 0; 
     315 
    276316//--------------- BEGIN PROCESSING ------------------- 
     317 
     318 
     319//--------------- Indexer ------------------- 
     320 
     321require_once('create_index.php'); 
     322$indexer = new quickstart_index($index_dir); 
    277323 
    278324// ---------------- Create the Tex files --------- 
    279325$count = 1; 
     326$j = 1; 
    280327$current_path = ''; 
    281328echo "Compiling .page files to Latex files\n\n"; 
     329 
    282330foreach($pages as $chapter => $sections) 
    283331{ 
     
    290338                $page = $base.'/'.$section; 
    291339                $current_path = $page; 
     340                 
     341                //add id to <h1>, <h2>, <3> 
     342                $content = set_header_id(file_get_contents($page),$j++); 
     343                file_put_contents($page, $content); 
     344                 
    292345                $content .= get_section_label($section); 
    293                 $content .= parse_html($page,file_get_contents($page)); 
     346                $file_content = file_get_contents($page); 
     347                $tex = parse_html($page,$file_content); 
     348                $content .= $tex; 
     349                $indexer->add($file_content,$section, filemtime($page)); 
    294350        } 
    295351 
     
    300356} 
    301357 
     358$indexer->commit(); 
    302359 
    303360if($argc <= 1 && $count > 1) 
  • trunk/buildscripts/texbuilder/prado3_quick_start.tex

    r844 r1047  
    115115\include{ch8} 
    116116\include{ch9} 
     117\include{ch10} 
     118\include{ch11} 
     119\include{ch12} 
     120\include{ch13} 
    117121 
    118122\end{document}