summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorwei <>2006-01-21 23:16:33 +0000
committerwei <>2006-01-21 23:16:33 +0000
commite8e20e87941ae992afd49f2d70198b0e7437d58e (patch)
treebeb52f266c42a9e570e926a5cb095879b8ccd2c1 /tools
parentf57725d738e0503c2238c9874761c70d2dd5b18d (diff)
Add quickstart PDF format.
Diffstat (limited to 'tools')
-rw-r--r--tools/texbuilder/build.php218
-rw-r--r--tools/texbuilder/prado3_quick_start.pdfbin0 -> 335038 bytes
-rw-r--r--tools/texbuilder/prado3_quick_start.tex83
3 files changed, 301 insertions, 0 deletions
diff --git a/tools/texbuilder/build.php b/tools/texbuilder/build.php
new file mode 100644
index 00000000..0cea6aee
--- /dev/null
+++ b/tools/texbuilder/build.php
@@ -0,0 +1,218 @@
+<?php
+//page root location
+$base = realpath(dirname(__FILE__).'/../../demos/quickstart/protected/pages/');
+
+//list page into chapters
+$pages['Getting Started'] = array(
+ 'GettingStarted/Introduction.page',
+ 'GettingStarted/AboutPrado.page',
+ 'GettingStarted/Installation.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/HelloWorld.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['Controls'] = array(
+ 'Controls/Overview.page',
+ 'Controls/Simple.page',
+ 'Controls/List.page',
+ 'Controls/Validation.page',
+ 'Controls/DataList.page',
+ 'Controls/DataGrid.page');
+
+
+//-------------- END CONFIG ------------------
+
+
+function escape_verbatim($matches)
+{
+ return "\begin{verbatim}".str_replace('\$', '$', $matches[2])."\end{verbatim}\n";
+}
+
+function include_image($matches)
+{
+ global $current_path;
+ $image = dirname($current_path).'/'.$matches[1];
+ $file = realpath($image);
+ $info = getimagesize($file);
+ switch($info[2])
+ {
+ case 1:
+ $im = imagecreatefromgif($file);
+ break;
+ case 2: $im = imagecreatefromjpeg($file); break;
+ case 3: $im = imagecreatefrompng($file); break;
+ }
+ global $base;
+
+ if(isset($im))
+ {
+ $prefix = strtolower(str_replace(realpath($base), '', $file));
+ $filename = preg_replace('/\\\|\//', '_', substr($prefix,1));
+ $filename = substr($filename, 0, strrpos($filename,'.')).'.png';
+ $newfile = dirname(__FILE__).'/'.$filename;
+ imagepng($im,$newfile);
+ imagedestroy($im);
+
+ return include_figure($info, $filename);
+ }
+}
+
+function include_figure($info, $filename)
+{
+ $width = sprintf('%0.2f', $info[0]/(135/2.54));
+ return '
+\begin{figure}[ht]
+ \centering
+ \includegraphics[width='.$width.'cm]{'.$filename.'}
+ \label{fig:'.$filename.'}
+\end{figure}
+';
+}
+
+function anchor($matches)
+{
+ $page = get_current_path();
+ return '\hypertarget{'.$page.'/'.$matches[1].'}{}';
+}
+
+function get_current_path()
+{
+ global $current_path, $base;
+ $page = strtolower(substr(str_replace($base, '', $current_path),1));
+ return $page;
+}
+
+function make_link($matches)
+{
+ if(is_int(strpos($matches[1], '#')))
+ {
+ if(strpos($matches[1],'?') ===false)
+ {
+ $target = get_current_path().'/'.substr($matches[1],1);
+ return '\hyperlink{'.$target.'}{'.$matches[2].'}';
+ }
+ else
+ {
+ $page = strtolower(str_replace('?page=', '', $matches[1]));
+ $page = str_replace('.','/',$page);
+ $page = str_replace('#','.page/',$page);
+ return '\hyperlink{'.$page.'}{'.$matches[2].'}';
+ }
+ }
+ else if(is_int(strpos($matches[1],'?')))
+ {
+ $page = str_replace('?page=','',$matches[1]);
+ return '\hyperlink{'.$page.'}{'.$matches[2].'}';
+ }
+ return '\href{'.$matches[1].'}{'.$matches[2].'}';
+}
+
+function parse_html($page,$html)
+{
+ $html = preg_replace('/<\/?com:TContent[^>]*>/', '', $html);
+ $html = preg_replace('/<\/?p>/m', '', $html);
+
+ //headings
+ $html = preg_replace('/<h1[^>]*>([^<]+)<\/h1>/', '\section{$1}', $html);
+ $html = preg_replace('/<h2[^>]*>([^<]+)<\/h2>/', '\subsection{$1}', $html);
+ $html = preg_replace('/<h3[^>]*>([^<]+)<\/h3>/', '\subsubsection{$1}', $html);
+
+ //codes
+ $html = str_replace('$', '\$', $html);
+ $html = preg_replace('/<com:TTextHighlighter[^>]*>/', '`1`', $html);
+ $html = preg_replace('/<\/com:TTextHighlighter>/', '`2`', $html);
+ $html = preg_replace_callback('/(`1`)([^`]*)(`2`)/m', 'escape_verbatim', $html);
+ $html = preg_replace_callback('/(<div class="source">)([^<]*)(<\/div>)/', 'escape_verbatim', $html);
+
+
+ $html = preg_replace_callback('/<img\s+src="<%~([^"]*)%>"[^\\/]*\/>/', 'include_image', $html);
+
+ //runbar
+ $html = preg_replace('/<com:RunBar\s+PagePath="([^"]*)"\s+\/>/',
+ 'Try, \texttt{http://../quickstart/index.php?page=$1}', $html);
+
+
+ //text modifiers
+ $html = preg_replace('/<b>([^>]*)<\/b>/', '\textbf{$1}', $html);
+ $html = preg_replace('/<i>([^>]*)<\/i>/', '\emph{$1}', $html);
+ $html = preg_replace('/<tt>([^>]*)<\/tt>/', '\texttt{$1}', $html);
+
+ //links
+ $html = preg_replace_callback('/<a[^>]+href="([^"]*)"[^>]*>([^<]*)<\/a>/',
+ 'make_link', $html);
+ //anchor
+ $html = preg_replace_callback('/<a[^>]+name="([^"]*)"[^>]*><\/a>/', 'anchor', $html);
+
+ //item lists
+ $html = preg_replace('/<ol>/', '\begin{itemize}', $html);
+ $html = preg_replace('/<\/ol>/', '\end{itemize}', $html);
+ $html = preg_replace('/<ul>/', '\begin{enumerate}', $html);
+ $html = preg_replace('/<\/ul>/', '\end{enumerate}', $html);
+ $html = preg_replace('/<li>/', '\item ', $html);
+ $html = preg_replace('/<\/li>/', '', $html);
+
+ $html = html_entity_decode($html);
+
+
+ return $html;
+}
+
+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).'}{}';
+}
+
+//--------------- BEGIN PROCESSING -------------------
+
+$count = 1;
+$current_path = '';
+echo "Compiling .page files to Latex files\n\n";
+foreach($pages as $chapter => $sections)
+{
+ $content = '\chapter{'.$chapter.'}'.get_chapter_label($chapter);
+ echo "Creating ch{$count}.txt => Chapter {$count}: {$chapter}\n";
+ echo str_repeat('-',60)."\n";
+ foreach($sections as $section)
+ {
+ echo " Adding $section\n";
+ $page = $base.'/'.$section;
+ $current_path = $page;
+ $content .= get_section_label($section);
+ $content .= parse_html($page,file_get_contents($page));
+ }
+
+ //var_dump($content);
+ file_put_contents("ch{$count}.tex", $content);
+ $count++;
+ echo "\n";
+}
+
+if($count > 1)
+{
+ echo "** Use Latex and pdfText to compile the main tex file. **\n";
+}
+
+
+?> \ No newline at end of file
diff --git a/tools/texbuilder/prado3_quick_start.pdf b/tools/texbuilder/prado3_quick_start.pdf
new file mode 100644
index 00000000..4f6ddbf1
--- /dev/null
+++ b/tools/texbuilder/prado3_quick_start.pdf
Binary files differ
diff --git a/tools/texbuilder/prado3_quick_start.tex b/tools/texbuilder/prado3_quick_start.tex
new file mode 100644
index 00000000..675ec357
--- /dev/null
+++ b/tools/texbuilder/prado3_quick_start.tex
@@ -0,0 +1,83 @@
+\documentclass{book}
+\usepackage[pdftex]{graphicx}
+\usepackage[pdftex]{hyperref}
+
+\usepackage{fancyhdr}
+
+%---------- fonts Type 1 -----------------
+%\usepackage{times}
+%\usepackage[T1]{fontenc}
+%\usepackage{textcomp}
+
+%------------------------Page set-up-----------------------------------------
+
+\renewcommand{\baselinestretch}{1.25}
+\setlength{\hoffset}{-1in}
+\setlength{\oddsidemargin}{3.5cm}
+\setlength{\evensidemargin}{3.5cm}
+\setlength{\topmargin}{0cm}
+\setlength{\footskip}{2cm}
+\setlength{\headheight}{14pt}
+\setlength{\marginparwidth}{0cm}
+\setlength{\marginparsep}{0cm}
+\setlength{\marginparpush}{0cm}
+\setlength{\textwidth}{15cm}
+\setlength{\parindent}{0cm}
+\setlength{\parskip}{0.75\baselineskip}
+
+%------------------------------------------------------------------------------
+
+
+%---- change link style ----
+\hypersetup{colorlinks, linkcolor=blue, pdfstartview={FitH}}
+
+
+% Pages and Fancyheadings stuff
+%-----------------------------------------------------------------------
+\cfoot{\thepage}
+\fancyhead[LE,RO]{}
+\fancyhead[LO]{\nouppercase{\scshape\rightmark}}
+\fancyhead[RE]{\nouppercase{\scshape\leftmark}}
+%-----------------------------------------------------------------------
+
+%----------------- TITLE --------------
+
+\title{\Huge \bfseries Prado Quick Start}
+\author{Qiang Xue \\[7mm] \today}
+\date{ Compiled by Wei Zhuo}
+
+
+%-------------- BEGIN DOCUMENT ------------------
+
+
+\begin{document}
+
+\maketitle
+
+\pagestyle{plain}
+\addcontentsline{toc}{chapter}{Contents}
+\pagenumbering{roman}
+\tableofcontents
+
+\newpage
+
+\chapter*{Preface}
+\addcontentsline{toc}{chapter}{Preface}
+Prado quick start doc
+
+\newpage
+
+\pagestyle{fancyplain}
+\pagenumbering{arabic}
+
+\include{ch1}
+\include{ch2}
+\include{ch3}
+\include{ch4}
+\include{ch5}
+\include{ch6}
+\include{ch7}
+\include{ch8}
+
+
+\end{document}