From 36a61db3144c111b722db89baf5a1d55c1c9a6b2 Mon Sep 17 00:00:00 2001 From: wei <> Date: Thu, 28 Sep 2006 00:11:36 +0000 Subject: Update TUrlMapping and THttpRequest --- buildscripts/texbuilder/Page2Tex.php | 111 +++++++++++++++++---------------- buildscripts/texbuilder/quickstart.tex | 10 +++ 2 files changed, 67 insertions(+), 54 deletions(-) (limited to 'buildscripts/texbuilder') diff --git a/buildscripts/texbuilder/Page2Tex.php b/buildscripts/texbuilder/Page2Tex.php index c8cad6c9..f225d973 100644 --- a/buildscripts/texbuilder/Page2Tex.php +++ b/buildscripts/texbuilder/Page2Tex.php @@ -1,14 +1,14 @@ _current_page = $current; $this->_dir = $dir; } - + function setCurrentPage($current) { $this->_current_page = $current; @@ -24,22 +24,24 @@ class Page2Tex function escape_verbatim($matches) { - return "\begin{verbatim}".str_replace($this->_verb_find, $this->_verb_replace, $matches[1])."\end{verbatim}\n"; + return "\begin{small}\begin{verbatim}". + str_replace($this->_verb_find, $this->_verb_replace, $matches[1]). + "\end{verbatim}\end{small}\n"; } - + function escape_verb($matches) { $text = str_replace($this->_verb_find, $this->_verb_replace, $matches[1]); - return '\verb<'.$text.'<'; + return '\begin{small}\verb<'.$text.'< \end{small}'; } - + function include_image($matches) { - + $current_path = $this->_current_page; - + $image = dirname($current_path).'/'.trim($matches[1]); - + $file = realpath($image); $info = getimagesize($file); switch($info[2]) @@ -51,7 +53,7 @@ class Page2Tex case 3: $im = imagecreatefrompng($file); break; } $base = $this->_base; - + if(isset($im)) { $prefix = strtolower(str_replace(realpath($base), '', $file)); @@ -64,7 +66,7 @@ class Page2Tex return $this->include_figure($info, $filename); } } - + function include_figure($info, $filename) { $width = sprintf('%0.2f', $info[0]/(135/2.54)); @@ -76,18 +78,18 @@ class Page2Tex \end{figure} '; } - + function anchor($matches) { $page = $this->get_current_path(); return '\hypertarget{'.$page.'/'.strtolower($matches[1]).'}{}'; } - + function texttt($matches) { - return '\texttt{'.str_replace(array('#','_'),array('\#','\_'), $matches[1]).'}'; + return '\texttt{'.str_replace(array('#','_','&'),array('\#','\_','\&'), $matches[1]).'}'; } - + function get_current_path() { $current_path = $this->_current_page; @@ -95,7 +97,7 @@ class Page2Tex $page = strtolower(substr(str_replace($base, '', $current_path),1)); return $page; } - + function make_link($matches) { if(is_int(strpos($matches[1], '#'))) @@ -120,62 +122,63 @@ class Page2Tex } return '\href{'.$matches[1].'}{'.$matches[2].'}'; } - + function parse_html($page,$html) { - - + + $html = preg_replace('/<\/?com:TContent[^>]*>/', '', $html); $html = preg_replace('/<\/?p [^>]*>/', '', $html); $html = preg_replace('/<\/?p>/', '', $html); - + $html = preg_replace('/(\s+|\(+|\[+)"/', '$1``', $html); - + $html = preg_replace('/(\s+|\(+|\[+)\'/', '$1`', $html); + //escape { and } $html = preg_replace('/([^\s]+){([^}]*)}([^\s]+)/', '$1\\\{$2\\\}$3', $html); - + $html = preg_replace_callback('/"?[^>]*\/>/', array($this, 'include_image'), $html); //escape % $html = str_replace('%', '\%', $html); - + //codes $html = str_replace('$', '\$', $html); - + $html = preg_replace_callback('/]*>((.|\n)*?)<\/com:TTextHighlighter>/', array($this,'escape_verbatim'), $html); // $html = preg_replace('/<\/com:TTextHighlighter>/', '`2`', $html); // $html = preg_replace_callback('/(`1`)([^`]*)(`2`)/m', array($this,'escape_verbatim'), $html); $html = preg_replace_callback('/(
)((.|\n)*?)(<\/div>)/', array($this,'escape_verbatim'), $html); $html = preg_replace_callback('/(
)([^<]*)(<\/pre>)/', array($this,'escape_verbatim'), $html);
-	
+
 		//
 		$html = preg_replace_callback('/([^<]*)<\/code>/', array($this,'escape_verb'), $html);
-	
+
 		//runbar
 		$html = preg_replace('//',
 				'\href{http://www.pradosoft.com/demos/quickstart/index.php?page=$1}{$1 Demo}', $html);
-	
+
 		//DocLink
 		$html = preg_replace('//',
 	                        '\href{http://www.pradosoft.com/docs/manual/$1/$2.html}{$1.$2 API Reference}', $html);
-	
+
 		//text modifiers
 		$html = preg_replace('/]*>([^<]*)<\/b>/', '\textbf{$1}', $html);
 		$html = preg_replace('/]*>([^<]*)<\/i>/', '\emph{$1}', $html);
 		$html = preg_replace_callback('/([^<]*)<\/tt>/', array($this,'texttt'), $html);
-	
+
 		//links
 		$html = preg_replace_callback('/]+href="([^"]*)"[^>]*>([^<]*)<\/a>/',
 								array($this,'make_link'), $html);
 		//anchor
 		$html = preg_replace_callback('/]+name="([^"]*)"[^>]*><\/a>/', array($this,'anchor'), $html);
-	
+
 		//description 
$html = preg_replace('/
([^<]*)<\/dt>/', '\item[$1]', $html); $html = preg_replace('/<\/?dd>/', '', $html); $html = preg_replace('/
/', '\begin{description}', $html); $html = preg_replace('/<\/dl>/', '\end{description}', $html); - + //item lists $html = preg_replace('/]*>/', '\begin{itemize}', $html); $html = preg_replace('/<\/ul>/', '\end{itemize}', $html); @@ -183,25 +186,25 @@ class Page2Tex $html = preg_replace('/<\/ol>/', '\end{enumerate}', $html); $html = preg_replace('/]*>/', '\item ', $html); $html = preg_replace('/<\/li>/', '', $html); - + //headings $html = preg_replace('/([^<]+)<\/h1>/', '\section{$2}', $html); $html = preg_replace('/([^<]+)<\/h2>/', '\subsection{$2}', $html); $html = preg_replace('/([^<]+)<\/h3>/', '\subsubsection{$2}', $html); - + //div box $html = preg_replace_callback('/
((.|\n)*?)<\/div>/', - array($this, 'mbox'), $html); - + array($this, 'mbox'), $html); + //tabular $html = preg_replace_callback('/\s*]*>((.|\n)*?)<\/table>/', array($this, 'tabular'), $html); - + $html = html_entity_decode($html); - + return $html; } - + function tabular($matches) { $options = array(); @@ -210,13 +213,13 @@ class Page2Tex $sub = explode('=', trim($string)); $options[trim($sub[0])] = trim($sub[1]); } - + $widths = explode(' ',preg_replace('/\(|\)/', '', $options['width'])); $this->_tabular_widths = $widths; - + $this->_tabular_total = count($widths); $this->_tabular_col = 0; - + $begin = "\begin{table}[!hpt]\centering \n \begin{tabular}{".$options['align']."}\\hline"; $end = "\end{tabular} \n \end{table}\n"; $table = preg_replace('/<\/tr>/', '\\\\\\\\ \hline', $matches[2]); @@ -224,11 +227,11 @@ class Page2Tex $table = preg_replace('/([^<]+)<\/th>/', '\textbf{$1} &', $table); $table = preg_replace_callback('/((.|\n)*?)<\/td>/', array($this, 'table_column'), $table); $table = preg_replace('/
/', ' \\\\\\\\', $table); - + $table = preg_replace('/&\s*\\\\\\\\/', '\\\\\\\\', $table); return $begin.$table.$end; } - + function table_column($matches) { $width = $this->_tabular_widths[$this->_tabular_col]; @@ -239,24 +242,24 @@ class Page2Tex return '\begin{minipage}{'.$width.'\textwidth}\vspace{3mm}'. $matches[1].'\vspace{3mm}\end{minipage} & '; } - + function mbox($matches) { return "\n\begin{mybox}\n".$matches[1]."\n\end{mybox}\n"; } - + function get_chapter_label($chapter) { return '\hypertarget{'.str_replace(' ', '', $chapter).'}{}'; } - + function get_section_label($section) { $section = str_replace('.page', '', $section); return '\hypertarget{'.str_replace('/', '.', $section).'}{}'; } - - + + function set_header_id($content, $count) { self::$header_count = $count*100; @@ -265,22 +268,22 @@ class Page2Tex $content = preg_replace_callback('/

/', array($this,"h3"), $content); return $content; } - + function h1($matches) { return "

"; } - + function h2($matches) { return "

"; } - + function h3($matches) { return "

"; } - + } ?> \ No newline at end of file diff --git a/buildscripts/texbuilder/quickstart.tex b/buildscripts/texbuilder/quickstart.tex index 8a7d017e..e5851268 100644 --- a/buildscripts/texbuilder/quickstart.tex +++ b/buildscripts/texbuilder/quickstart.tex @@ -42,6 +42,16 @@ \fancyhead[RE]{\nouppercase{\scshape\leftmark}} %----------------------------------------------------------------------- +% boxes + +\newsavebox{\fmboxb} +\newenvironment{mybox} + {\vspace{-2mm}\begin{center}\begin{lrbox}{\fmboxb}\hspace{2mm} + \begin{minipage}{0.85\textwidth} \vspace{2mm}\small} + { \vspace{2mm} \end{minipage} + \hspace{2mm}\end{lrbox}\fbox{\usebox{\fmboxb}}\end{center}} + + %----------------- TITLE -------------- \title{\Huge \bfseries PRADO v3.0.5 Quickstart Tutorial -- cgit v1.2.3