diff options
Diffstat (limited to 'buildscripts/texbuilder')
| -rw-r--r-- | buildscripts/texbuilder/Page2Tex.php | 694 | ||||
| -rw-r--r-- | buildscripts/texbuilder/quickstart/build.php | 162 | ||||
| -rw-r--r-- | buildscripts/texbuilder/quickstart/pages.php | 356 | ||||
| -rw-r--r-- | buildscripts/texbuilder/sqlmap/build.php | 162 | ||||
| -rw-r--r-- | buildscripts/texbuilder/sqlmap/pages.php | 122 | ||||
| -rw-r--r-- | buildscripts/texbuilder/time-tracker/pages.php | 34 | 
6 files changed, 765 insertions, 765 deletions
diff --git a/buildscripts/texbuilder/Page2Tex.php b/buildscripts/texbuilder/Page2Tex.php index 008b30fa..eea0ab7e 100644 --- a/buildscripts/texbuilder/Page2Tex.php +++ b/buildscripts/texbuilder/Page2Tex.php @@ -1,347 +1,347 @@ -<?php
 -
 -class Page2Tex
 -{
 -	private $_current_page;
 -	private static $header_count = 0;
 -	private static $p_count=0;
 -	private static $hil_count=0;
 -	private $page_count=0;
 -	private $_base;
 -	private $_dir;
 -
 -	private $_verb_find = array('\$','\%', '\{', '\}', "\t",'``','`');
 -	private $_verb_replace = array('$', '%', '{','}', "     ",'"','\'');
 -
 -	function __construct($base, $dir, $current='')
 -	{
 -		$this->_base = $base;
 -		$this->_current_page = $current;
 -		$this->_dir = $dir;
 -	}
 -
 -	function setCurrentPage($current)
 -	{
 -		self::$header_count = self::$header_count+1000;
 -		$this->_current_page = $current;
 -	}
 -
 -	function escape_verbatim($matches)
 -	{
 -		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 '\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])
 -		{
 -			case 1:
 -				$im = imagecreatefromgif($file);
 -				break;
 -			case 2: $im = imagecreatefromjpeg($file); break;
 -			case 3: $im = imagecreatefrompng($file); break;
 -		}
 -		$base = $this->_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 = $this->_dir.'/'.$filename;
 -			imagepng($im,$newfile);
 -			imagedestroy($im);
 -
 -			return $this->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 = $this->get_current_path();
 -		return '\hypertarget{'.$page.'/'.strtolower($matches[1]).'}{}';
 -	}
 -
 -	function texttt($matches)
 -	{
 -		$text ='\texttt{'.str_replace(array('#','_','&'),array('\#','\_','\&'), $matches[1]).'}';
 -		//$text = preg_replace('/([^\\\\])&([^;]+)/', '$1\&$2', $text);
 -		return $text;
 -	}
 -
 -	function get_current_path()
 -	{
 -		$current_path = $this->_current_page;
 -		$base = $this->_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)
 -			{
 -				if(strpos($matches[1],'http://')===false)
 -				{
 -					$target = $this->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{'.str_replace('#','\\#',$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('/<img\s+src="?<%~([^"]*)%>"?[^>]*\/>/', array($this, 'include_image'), $html);
 -
 -		//escape %
 -		$html = str_replace('%', '\%', $html);
 -
 -		//codes
 -		$html = str_replace('$', '\$', $html);
 -
 -		$html = preg_replace_callback('/<com:TTextHighlighter[^>]*>((.|\n)*?)<\/com:TTextHighlighter\s*>/', 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('/(<div class="source">)((.|\n)*?)(<\/div>)/', array($this,'escape_verbatim'), $html);
 -		$html = preg_replace_callback('/(<pre>)([^<]*)(<\/pre>)/', array($this,'escape_verbatim'), $html);
 -
 -		//<code>
 -		$html = preg_replace_callback('/<code>([^<]*)<\/code>/', array($this,'escape_verb'), $html);
 -
 -		//runbar
 -		$html = preg_replace('/<com:RunBar\s+PagePath="([^"]*)"\s+\/>/',
 -				'\href{http://www.pradosoft.com/demos/quickstart/index.php?page=$1}{$1 Demo}', $html);
 -
 -		//DocLink
 -		$html = preg_replace('/<com:DocLink\s+ClassPath="([^"]*)[.]([^."]*)"\s+Text="([^"]+)"\s*\/>/',
 -	                        '\href{http://www.pradosoft.com/docs/manual/$1/$2.html}{$3}', $html);
 -
 -		$html = preg_replace('/<com:DocLink\s+ClassPath="([^"]*)[.]([^.]*)"\s+\/>/',
 -	                        '\href{http://www.pradosoft.com/docs/manual/$1/$2.html}{$1.$2 API Reference}', $html);
 -
 -		//text modifiers
 -		$html = preg_replace('/<(b|strong)[^>]*>([^<]*)<\/(b|strong)>/', '\textbf{$2}', $html);
 -		$html = preg_replace('/<i [^>]*>([^<]*)+?<\/i>/', '\emph{$1}', $html);
 -		$html = preg_replace_callback('/<tt>([^<]*)<\/tt>/', array($this,'texttt'), $html);
 -
 -		//links
 -		$html = preg_replace_callback('/<a[^>]+href="([^"]*)"[^>]*>([^<]*)<\/a>/',
 -								array($this,'make_link'), $html);
 -		//anchor
 -		$html = preg_replace_callback('/<a[^>]+name="([^"]*)"[^>]*><\/a>/', array($this,'anchor'), $html);
 -
 -		//description <dl>
 -		$html = preg_replace('/<dt>([^<]*)<\/dt>/', '\item[$1]', $html);
 -		$html = preg_replace('/<\/?dd>/', '', $html);
 -		$html = preg_replace('/<dl>/', '\begin{description}', $html);
 -		$html = preg_replace('/<\/dl>/', '\end{description}', $html);
 -
 -		//item lists
 -		$html = preg_replace('/<ul[^>]*>/', '\begin{itemize}', $html);
 -		$html = preg_replace('/<\/ul>/', '\end{itemize}', $html);
 -		$html = preg_replace('/<ol[^>]*>/', '\begin{enumerate}', $html);
 -		$html = preg_replace('/<\/ol>/', '\end{enumerate}', $html);
 -		$html = preg_replace('/<li[^>]*>/', '\item ', $html);
 -		$html = preg_replace('/<\/li>/', '', $html);
 -
 -		//headings
 -		$html = preg_replace('/<h1(\s+id="[^"]+")?>([^<]+)<\/h1>/', '\section{$2}', $html);
 -		$html = preg_replace('/<h2(\s+id="[^"]+")?>([^<]+)<\/h2>/', '\subsection{$2}', $html);
 -		$html = preg_replace('/<h3(\s+id="[^"]+")?>([^<]+)<\/h3>/', '\subsubsection{$2}', $html);
 -
 -		//div box
 -		$html = preg_replace_callback('/<div class="[tipnofe]*?">((.|\n)*?)<\/div>/',
 -						array($this, 'mbox'), $html);
 -
 -		//tabular
 -		$html = preg_replace_callback('/<!--\s*tabular:([^-]*)-->\s*<table[^>]*>((.|\n)*?)<\/table>/',
 -						array($this, 'tabular'), $html);
 -
 -		$html = preg_replace('/<!--((.|\n)*?)-->/', '', $html);
 -		$html = preg_replace('/<div class="last-modified">((.|\n)*?)<\/div>/', '', $html);
 -
 -		//useless divs
 -		$html = preg_replace('/<div [^>]*">((.|\n)*?)<\/div>/', '$1', $html);
 -
 -		//since
 -		$html = preg_replace('/<com:SinceVersion[^>]+>/', '', $html);
 -
 -		//requiresversion
 -		$html = preg_replace('/<com:RequiresVersion[^>]+>/', '', $html);
 -
 -		$html = html_entity_decode($html);
 -
 -		return $html;
 -	}
 -
 -	function tabular($matches)
 -	{
 -		$options = array();
 -		foreach(explode(',', $matches[1]) as $string)
 -		{
 -			$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]);
 -		$table = preg_replace('/<tr>/', '', $table);
 -		$table = preg_replace('/<th>([^<]+)<\/th>/', '\textbf{$1} &', $table);
 -		$table = preg_replace_callback('/<td>((.|\n)*?)<\/td>/', array($this, 'table_column'), $table);
 -		$table = preg_replace('/<br \/>/', ' \\\\\\\\', $table);
 -
 -		$table = preg_replace('/&\s*\\\\\\\\/', '\\\\\\\\', $table);
 -		return $begin.$table.$end;
 -	}
 -
 -	function table_column($matches)
 -	{
 -		$width = $this->_tabular_widths[$this->_tabular_col];
 -		if($this->_tabular_col >= $this->_tabular_total-1)
 -			$this->_tabular_col = 0;
 -		else
 -			$this->_tabular_col++;
 -		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, $j)
 -	{
 -		$this->page_count=$j;
 -		$content = preg_replace_callback('/<h1>/', array($this,"h1"), $content);
 -		$content = preg_replace_callback('/<h2>/', array($this,"h2"), $content);
 -		$content = preg_replace_callback('/<h3>/', array($this,"h3"), $content);
 -		$content = $this->set_block_content_id($content);
 -		return $content;
 -	}
 -
 -	function h1($matches)
 -	{
 -		$page = $this->page_count*1000;
 -		return "<h1 id=\"".($page + (++self::$header_count))."\">";
 -	}
 -
 -	function h2($matches)
 -	{
 -		$page = $this->page_count*1000;
 -		return "<h2 id=\"".($page + (++self::$header_count))."\">";
 -	}
 -
 -	function h3($matches)
 -	{
 -		$page = $this->page_count*1000;
 -		return "<h3 id=\"".($page + (++self::$header_count))."\">";
 -	}
 -
 -	function set_block_content_id($content)
 -	{
 -		$content = preg_replace_callback('/<p>/',  array($this, 'add_p'), $content);
 -		$content = preg_replace_callback('/<com:TTextHighlighter([^>]+)>/', array($this, 'hil'), $content);
 -		return $content;
 -	}
 -
 -	function hil($matches)
 -	{
 -		$id = ($this->page_count*10000) + (++self::$hil_count);
 -		if(preg_match('/id="code-\d+"/i', $matches[1]))
 -		{
 -			$code = preg_replace('/id="code-(\d+)"/', 'id="code_$1"', $matches[0]);
 -			//var_dump($code);
 -			return $code;
 -		}
 -		else if(preg_match('/id="[^"]+"/i', $matches[1]))
 -		{
 -			return $matches[0];
 -		}
 -		else
 -		{
 -			$changes = str_replace('"source"', '"source block-content" id="code-'.$id.'"', $matches[0]);
 -			return $changes;
 -		}
 -	}
 -
 -	function add_p($matches)
 -	{
 -		 $page = $this->page_count*10000;
 -		 return "<p id=\"".($page + (++self::$p_count))."\" class=\"block-content\">";
 -	}
 -}
 -
 -?>
 +<?php + +class Page2Tex +{ +	private $_current_page; +	private static $header_count = 0; +	private static $p_count=0; +	private static $hil_count=0; +	private $page_count=0; +	private $_base; +	private $_dir; + +	private $_verb_find = array('\$','\%', '\{', '\}', "\t",'``','`'); +	private $_verb_replace = array('$', '%', '{','}', "     ",'"','\''); + +	function __construct($base, $dir, $current='') +	{ +		$this->_base = $base; +		$this->_current_page = $current; +		$this->_dir = $dir; +	} + +	function setCurrentPage($current) +	{ +		self::$header_count = self::$header_count+1000; +		$this->_current_page = $current; +	} + +	function escape_verbatim($matches) +	{ +		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 '\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]) +		{ +			case 1: +				$im = imagecreatefromgif($file); +				break; +			case 2: $im = imagecreatefromjpeg($file); break; +			case 3: $im = imagecreatefrompng($file); break; +		} +		$base = $this->_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 = $this->_dir.'/'.$filename; +			imagepng($im,$newfile); +			imagedestroy($im); + +			return $this->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 = $this->get_current_path(); +		return '\hypertarget{'.$page.'/'.strtolower($matches[1]).'}{}'; +	} + +	function texttt($matches) +	{ +		$text ='\texttt{'.str_replace(array('#','_','&'),array('\#','\_','\&'), $matches[1]).'}'; +		//$text = preg_replace('/([^\\\\])&([^;]+)/', '$1\&$2', $text); +		return $text; +	} + +	function get_current_path() +	{ +		$current_path = $this->_current_page; +		$base = $this->_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) +			{ +				if(strpos($matches[1],'http://')===false) +				{ +					$target = $this->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{'.str_replace('#','\\#',$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('/<img\s+src="?<%~([^"]*)%>"?[^>]*\/>/', array($this, 'include_image'), $html); + +		//escape % +		$html = str_replace('%', '\%', $html); + +		//codes +		$html = str_replace('$', '\$', $html); + +		$html = preg_replace_callback('/<com:TTextHighlighter[^>]*>((.|\n)*?)<\/com:TTextHighlighter\s*>/', 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('/(<div class="source">)((.|\n)*?)(<\/div>)/', array($this,'escape_verbatim'), $html); +		$html = preg_replace_callback('/(<pre>)([^<]*)(<\/pre>)/', array($this,'escape_verbatim'), $html); + +		//<code> +		$html = preg_replace_callback('/<code>([^<]*)<\/code>/', array($this,'escape_verb'), $html); + +		//runbar +		$html = preg_replace('/<com:RunBar\s+PagePath="([^"]*)"\s+\/>/', +				'\href{http://www.pradosoft.com/demos/quickstart/index.php?page=$1}{$1 Demo}', $html); + +		//DocLink +		$html = preg_replace('/<com:DocLink\s+ClassPath="([^"]*)[.]([^."]*)"\s+Text="([^"]+)"\s*\/>/', +	                        '\href{http://www.pradosoft.com/docs/manual/$1/$2.html}{$3}', $html); + +		$html = preg_replace('/<com:DocLink\s+ClassPath="([^"]*)[.]([^.]*)"\s+\/>/', +	                        '\href{http://www.pradosoft.com/docs/manual/$1/$2.html}{$1.$2 API Reference}', $html); + +		//text modifiers +		$html = preg_replace('/<(b|strong)[^>]*>([^<]*)<\/(b|strong)>/', '\textbf{$2}', $html); +		$html = preg_replace('/<i [^>]*>([^<]*)+?<\/i>/', '\emph{$1}', $html); +		$html = preg_replace_callback('/<tt>([^<]*)<\/tt>/', array($this,'texttt'), $html); + +		//links +		$html = preg_replace_callback('/<a[^>]+href="([^"]*)"[^>]*>([^<]*)<\/a>/', +								array($this,'make_link'), $html); +		//anchor +		$html = preg_replace_callback('/<a[^>]+name="([^"]*)"[^>]*><\/a>/', array($this,'anchor'), $html); + +		//description <dl> +		$html = preg_replace('/<dt>([^<]*)<\/dt>/', '\item[$1]', $html); +		$html = preg_replace('/<\/?dd>/', '', $html); +		$html = preg_replace('/<dl>/', '\begin{description}', $html); +		$html = preg_replace('/<\/dl>/', '\end{description}', $html); + +		//item lists +		$html = preg_replace('/<ul[^>]*>/', '\begin{itemize}', $html); +		$html = preg_replace('/<\/ul>/', '\end{itemize}', $html); +		$html = preg_replace('/<ol[^>]*>/', '\begin{enumerate}', $html); +		$html = preg_replace('/<\/ol>/', '\end{enumerate}', $html); +		$html = preg_replace('/<li[^>]*>/', '\item ', $html); +		$html = preg_replace('/<\/li>/', '', $html); + +		//headings +		$html = preg_replace('/<h1(\s+id="[^"]+")?>([^<]+)<\/h1>/', '\section{$2}', $html); +		$html = preg_replace('/<h2(\s+id="[^"]+")?>([^<]+)<\/h2>/', '\subsection{$2}', $html); +		$html = preg_replace('/<h3(\s+id="[^"]+")?>([^<]+)<\/h3>/', '\subsubsection{$2}', $html); + +		//div box +		$html = preg_replace_callback('/<div class="[tipnofe]*?">((.|\n)*?)<\/div>/', +						array($this, 'mbox'), $html); + +		//tabular +		$html = preg_replace_callback('/<!--\s*tabular:([^-]*)-->\s*<table[^>]*>((.|\n)*?)<\/table>/', +						array($this, 'tabular'), $html); + +		$html = preg_replace('/<!--((.|\n)*?)-->/', '', $html); +		$html = preg_replace('/<div class="last-modified">((.|\n)*?)<\/div>/', '', $html); + +		//useless divs +		$html = preg_replace('/<div [^>]*">((.|\n)*?)<\/div>/', '$1', $html); + +		//since +		$html = preg_replace('/<com:SinceVersion[^>]+>/', '', $html); + +		//requiresversion +		$html = preg_replace('/<com:RequiresVersion[^>]+>/', '', $html); + +		$html = html_entity_decode($html); + +		return $html; +	} + +	function tabular($matches) +	{ +		$options = array(); +		foreach(explode(',', $matches[1]) as $string) +		{ +			$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]); +		$table = preg_replace('/<tr>/', '', $table); +		$table = preg_replace('/<th>([^<]+)<\/th>/', '\textbf{$1} &', $table); +		$table = preg_replace_callback('/<td>((.|\n)*?)<\/td>/', array($this, 'table_column'), $table); +		$table = preg_replace('/<br \/>/', ' \\\\\\\\', $table); + +		$table = preg_replace('/&\s*\\\\\\\\/', '\\\\\\\\', $table); +		return $begin.$table.$end; +	} + +	function table_column($matches) +	{ +		$width = $this->_tabular_widths[$this->_tabular_col]; +		if($this->_tabular_col >= $this->_tabular_total-1) +			$this->_tabular_col = 0; +		else +			$this->_tabular_col++; +		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, $j) +	{ +		$this->page_count=$j; +		$content = preg_replace_callback('/<h1>/', array($this,"h1"), $content); +		$content = preg_replace_callback('/<h2>/', array($this,"h2"), $content); +		$content = preg_replace_callback('/<h3>/', array($this,"h3"), $content); +		$content = $this->set_block_content_id($content); +		return $content; +	} + +	function h1($matches) +	{ +		$page = $this->page_count*1000; +		return "<h1 id=\"".($page + (++self::$header_count))."\">"; +	} + +	function h2($matches) +	{ +		$page = $this->page_count*1000; +		return "<h2 id=\"".($page + (++self::$header_count))."\">"; +	} + +	function h3($matches) +	{ +		$page = $this->page_count*1000; +		return "<h3 id=\"".($page + (++self::$header_count))."\">"; +	} + +	function set_block_content_id($content) +	{ +		$content = preg_replace_callback('/<p>/',  array($this, 'add_p'), $content); +		$content = preg_replace_callback('/<com:TTextHighlighter([^>]+)>/', array($this, 'hil'), $content); +		return $content; +	} + +	function hil($matches) +	{ +		$id = ($this->page_count*10000) + (++self::$hil_count); +		if(preg_match('/id="code-\d+"/i', $matches[1])) +		{ +			$code = preg_replace('/id="code-(\d+)"/', 'id="code_$1"', $matches[0]); +			//var_dump($code); +			return $code; +		} +		else if(preg_match('/id="[^"]+"/i', $matches[1])) +		{ +			return $matches[0]; +		} +		else +		{ +			$changes = str_replace('"source"', '"source block-content" id="code-'.$id.'"', $matches[0]); +			return $changes; +		} +	} + +	function add_p($matches) +	{ +		 $page = $this->page_count*10000; +		 return "<p id=\"".($page + (++self::$p_count))."\" class=\"block-content\">"; +	} +} + +?> diff --git a/buildscripts/texbuilder/quickstart/build.php b/buildscripts/texbuilder/quickstart/build.php index 81a12d4c..a42d6be3 100644 --- a/buildscripts/texbuilder/quickstart/build.php +++ b/buildscripts/texbuilder/quickstart/build.php @@ -1,81 +1,81 @@ -<?php
 -
 -// TBD: subsections in Control Reference
 -
 -$pdflatexExec = "C:/Wei/miktex/texmf/MiKTeX/bin/pdflatex.exe";
 -$pdfTex = "$pdflatexExec -interaction=nonstopmode -max-print-line=120 %s";
 -
 -$mainTexFile = dirname(__FILE__).'/quickstart.tex';
 -
 -//page root location
 -$base = realpath(dirname(__FILE__).'/../../../demos/quickstart/protected/pages/');
 -
 -$pages = include('pages.php');
 -
 -//-------------- END CONFIG ------------------
 -
 -include(dirname(__FILE__).'.../../../texbuilder/Page2Tex.php');
 -
 -// ---------------- Create the Tex files ---------
 -$count = 1;
 -$j = 1;
 -$current_path = '';
 -echo "Compiling .page files to Latex files\n\n";
 -
 -$parser = new Page2Tex($base, dirname(__FILE__));
 -
 -foreach($pages as $chapter => $sections)
 -{
 -	$content = '\chapter{'.$chapter.'}'.$parser->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;
 -		$parser->setCurrentPage($current_path);
 -
 -		//add id to <h1>, <h2>, <h3> and <p>
 -		$tmp_content = $parser->set_header_id(file_get_contents($page),$j++);
 -		file_put_contents($page, $tmp_content);
 -
 -		$content .= $parser->get_section_label($section);
 -		$file_content = file_get_contents($page);
 -		//$tex =
 -		$content .= $parser->parse_html($page,$file_content);
 -	}
 -
 -	//var_dump($content);
 -	file_put_contents("ch{$count}.tex", $content);
 -	$count++;
 -	echo "\n";
 -}
 -
 -//$indexer->commit();
 -
 -if($argc <= 1 && $count > 1)
 -{
 -	echo "** Use pdflatex to compile quickstart.tex to obtain PDF version of quickstart tutorial. **\n";
 -	exit;
 -}
 -if($argv[1] == 'pdf')
 -{
 -	if(is_file($pdflatexExec))
 -	{
 -		//build pdfTex
 -		$command=sprintf($pdfTex,$mainTexFile);
 -		system($command);
 -		system($command); //run it twice
 -
 -		echo "\n\n** PDF file quickstart.pdf created **\n\n";
 -
 -	}
 -	else
 -	{
 -		echo " Unable to find pdfLatex executable $pdflatexExec";
 -	}
 -}
 -
 -
 -?>
 +<?php + +// TBD: subsections in Control Reference + +$pdflatexExec = "C:/Wei/miktex/texmf/MiKTeX/bin/pdflatex.exe"; +$pdfTex = "$pdflatexExec -interaction=nonstopmode -max-print-line=120 %s"; + +$mainTexFile = dirname(__FILE__).'/quickstart.tex'; + +//page root location +$base = realpath(dirname(__FILE__).'/../../../demos/quickstart/protected/pages/'); + +$pages = include('pages.php'); + +//-------------- END CONFIG ------------------ + +include(dirname(__FILE__).'.../../../texbuilder/Page2Tex.php'); + +// ---------------- Create the Tex files --------- +$count = 1; +$j = 1; +$current_path = ''; +echo "Compiling .page files to Latex files\n\n"; + +$parser = new Page2Tex($base, dirname(__FILE__)); + +foreach($pages as $chapter => $sections) +{ +	$content = '\chapter{'.$chapter.'}'.$parser->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; +		$parser->setCurrentPage($current_path); + +		//add id to <h1>, <h2>, <h3> and <p> +		$tmp_content = $parser->set_header_id(file_get_contents($page),$j++); +		file_put_contents($page, $tmp_content); + +		$content .= $parser->get_section_label($section); +		$file_content = file_get_contents($page); +		//$tex = +		$content .= $parser->parse_html($page,$file_content); +	} + +	//var_dump($content); +	file_put_contents("ch{$count}.tex", $content); +	$count++; +	echo "\n"; +} + +//$indexer->commit(); + +if($argc <= 1 && $count > 1) +{ +	echo "** Use pdflatex to compile quickstart.tex to obtain PDF version of quickstart tutorial. **\n"; +	exit; +} +if($argv[1] == 'pdf') +{ +	if(is_file($pdflatexExec)) +	{ +		//build pdfTex +		$command=sprintf($pdfTex,$mainTexFile); +		system($command); +		system($command); //run it twice + +		echo "\n\n** PDF file quickstart.pdf created **\n\n"; + +	} +	else +	{ +		echo " Unable to find pdfLatex executable $pdflatexExec"; +	} +} + + +?> diff --git a/buildscripts/texbuilder/quickstart/pages.php b/buildscripts/texbuilder/quickstart/pages.php index a99a2a35..8bb34625 100644 --- a/buildscripts/texbuilder/quickstart/pages.php +++ b/buildscripts/texbuilder/quickstart/pages.php @@ -1,179 +1,179 @@ -<?php
 -/*
 - * $Id$
 - */
 -
 -//list page into chapters
 -$pages['Getting Started'] = array(
 -	'GettingStarted/Introduction.page',
 -	'GettingStarted/AboutPrado.page',
 -	'GettingStarted/Installation.page',
 -	'GettingStarted/NewFeatures.page',
 -	'GettingStarted/Upgrading.page'
 -	);
 -
 -$pages['Tutorials'] = array(
 -	'GettingStarted/HelloWorld.page',
 -	'Fundamentals/Hangman.page',
 -	'GettingStarted/CommandLine.page'
 -	);
 -
 -$pages['Tutorial: Currency Converter'] = array(
 -	'Tutorial/CurrencyConverter.page'
 -	);
 -
 -$pages['Tutorial: Building an AJAX Chat Application'] = array(
 -	'Tutorial/AjaxChat.page'
 -	);
 -
 -$pages['Tutorial: Addressbook'] = array(
 -	'Tutorial/AddressBook.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'
 -	);
 -
 -$pages['Configurations'] = array(
 -	'Configurations/Overview.page',
 -	'Configurations/Templates1.page',
 -	'Configurations/Templates2.page',
 -	'Configurations/Templates3.page',
 -	'Configurations/AppConfig.page',
 -	'Configurations/PageConfig.page',
 -	'Configurations/UrlMapping.page'
 -	);
 -
 -$pages['Control Reference : Standard Controls'] = array(
 -	'Controls/Standard.page',
 -	'Controls/Button.page',
 -	'Controls/Captcha.page',
 -	'Controls/CheckBox.page',
 -	'Controls/ClientScript.page',
 -	'Controls/ClientScriptLoader.page',
 -	'Controls/Conditional.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/Keyboard.page',
 -	'Controls/Label.page',
 -	'Controls/LinkButton.page',
 -	'Controls/Literal.page',
 -	'Controls/MultiView.page',
 -	'Controls/OutputCache.page',
 -	'Controls/Pager.page',
 -	'Controls/Panel.page',
 -	'Controls/PlaceHolder.page',
 -	'Controls/RadioButton.page',
 -	'Controls/SafeHtml.page',
 -	'Controls/Slider.page',
 -	'Controls/Statements.page',
 -	'Controls/Table.page',
 -	'Controls/TabPanel.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['Control Reference : Active Controls (AJAX)'] = array(
 -	'ActiveControls/ActiveButton.page',
 -	'ActiveControls/ActiveCheckBox.page',
 -	'ActiveControls/ActiveCheckBoxList.page',
 -	'ActiveControls/ActiveCustomValidator.page',
 -	'ActiveControls/ActiveDataList.page',
 -	'ActiveControls/ActiveDataGrid.page',
 -	'ActiveControls/ActiveDatePicker.page',
 -	'ActiveControls/ActiveDropDownList.page',
 -	'ActiveControls/ActiveFileUpload.page',
 -	'ActiveControls/ActiveHiddenField.page',
 -	'ActiveControls/ActiveHyperLink.page',
 -	'ActiveControls/ActiveImage.page',
 -	'ActiveControls/ActiveImageButton.page',
 -	'ActiveControls/ActiveLabel.page',
 -	'ActiveControls/ActiveLinkButton.page',
 -	'ActiveControls/ActiveListBox.page',
 -	'ActiveControls/ActiveMultiView.page',
 -	'ActiveControls/ActivePager.page',
 -	'ActiveControls/ActivePanel.page',
 -	'ActiveControls/ActiveRadioButton.page',
 -	'ActiveControls/ActiveRadioButtonList.page',
 -	'ActiveControls/ActiveRepeater.page',
 -	'ActiveControls/ActiveTextBox.page',
 -	'ActiveControls/AutoComplete.page',
 -	'ActiveControls/Callback.page',
 -	'ActiveControls/CallbackClientScript.page',
 -	'ActiveControls/CallbackClientSide.page',
 -	'ActiveControls/CallbackEventParameter.page',
 -	'ActiveControls/CallbackOptions.page',
 -	'ActiveControls/DragDrop.page',
 -	'ActiveControls/EventTriggeredCallback.page',
 -	'ActiveControls/InPlaceTextBox.page',
 -	'ActiveControls/TimeTriggeredCallback.page',
 -	'ActiveControls/ValueTriggeredCallback.page');
 -
 -$pages['Active Control Overview'] = array(
 -		'ActiveControls/Home.page',
 -	'ActiveControls/Introduction.page');
 -
 -$pages['Write New Controls'] = array(
 -	'Controls/NewControl.page');
 -
 -$pages['Service References'] = array(
 -	'Services/SoapService.page');
 -
 -$pages['Working with Databases'] = array(
 -	'Database/DAO.page',
 -	'Database/ActiveRecord.page',
 -	'Database/Scaffold.page',
 -	'Database/SqlMap.page');
 -
 -$pages['Advanced Topics'] = array(
 -	'Advanced/Collections.page',
 -	'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');
 -
 -return $pages;
 -//-------------- END CONFIG ----------------
 -
 +<?php +/* + * $Id$ + */ + +//list page into chapters +$pages['Getting Started'] = array( +	'GettingStarted/Introduction.page', +	'GettingStarted/AboutPrado.page', +	'GettingStarted/Installation.page', +	'GettingStarted/NewFeatures.page', +	'GettingStarted/Upgrading.page' +	); + +$pages['Tutorials'] = array( +	'GettingStarted/HelloWorld.page', +	'Fundamentals/Hangman.page', +	'GettingStarted/CommandLine.page' +	); + +$pages['Tutorial: Currency Converter'] = array( +	'Tutorial/CurrencyConverter.page' +	); + +$pages['Tutorial: Building an AJAX Chat Application'] = array( +	'Tutorial/AjaxChat.page' +	); + +$pages['Tutorial: Addressbook'] = array( +	'Tutorial/AddressBook.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' +	); + +$pages['Configurations'] = array( +	'Configurations/Overview.page', +	'Configurations/Templates1.page', +	'Configurations/Templates2.page', +	'Configurations/Templates3.page', +	'Configurations/AppConfig.page', +	'Configurations/PageConfig.page', +	'Configurations/UrlMapping.page' +	); + +$pages['Control Reference : Standard Controls'] = array( +	'Controls/Standard.page', +	'Controls/Button.page', +	'Controls/Captcha.page', +	'Controls/CheckBox.page', +	'Controls/ClientScript.page', +	'Controls/ClientScriptLoader.page', +	'Controls/Conditional.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/Keyboard.page', +	'Controls/Label.page', +	'Controls/LinkButton.page', +	'Controls/Literal.page', +	'Controls/MultiView.page', +	'Controls/OutputCache.page', +	'Controls/Pager.page', +	'Controls/Panel.page', +	'Controls/PlaceHolder.page', +	'Controls/RadioButton.page', +	'Controls/SafeHtml.page', +	'Controls/Slider.page', +	'Controls/Statements.page', +	'Controls/Table.page', +	'Controls/TabPanel.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['Control Reference : Active Controls (AJAX)'] = array( +	'ActiveControls/ActiveButton.page', +	'ActiveControls/ActiveCheckBox.page', +	'ActiveControls/ActiveCheckBoxList.page', +	'ActiveControls/ActiveCustomValidator.page', +	'ActiveControls/ActiveDataList.page', +	'ActiveControls/ActiveDataGrid.page', +	'ActiveControls/ActiveDatePicker.page', +	'ActiveControls/ActiveDropDownList.page', +	'ActiveControls/ActiveFileUpload.page', +	'ActiveControls/ActiveHiddenField.page', +	'ActiveControls/ActiveHyperLink.page', +	'ActiveControls/ActiveImage.page', +	'ActiveControls/ActiveImageButton.page', +	'ActiveControls/ActiveLabel.page', +	'ActiveControls/ActiveLinkButton.page', +	'ActiveControls/ActiveListBox.page', +	'ActiveControls/ActiveMultiView.page', +	'ActiveControls/ActivePager.page', +	'ActiveControls/ActivePanel.page', +	'ActiveControls/ActiveRadioButton.page', +	'ActiveControls/ActiveRadioButtonList.page', +	'ActiveControls/ActiveRepeater.page', +	'ActiveControls/ActiveTextBox.page', +	'ActiveControls/AutoComplete.page', +	'ActiveControls/Callback.page', +	'ActiveControls/CallbackClientScript.page', +	'ActiveControls/CallbackClientSide.page', +	'ActiveControls/CallbackEventParameter.page', +	'ActiveControls/CallbackOptions.page', +	'ActiveControls/DragDrop.page', +	'ActiveControls/EventTriggeredCallback.page', +	'ActiveControls/InPlaceTextBox.page', +	'ActiveControls/TimeTriggeredCallback.page', +	'ActiveControls/ValueTriggeredCallback.page'); + +$pages['Active Control Overview'] = array( +		'ActiveControls/Home.page', +	'ActiveControls/Introduction.page'); + +$pages['Write New Controls'] = array( +	'Controls/NewControl.page'); + +$pages['Service References'] = array( +	'Services/SoapService.page'); + +$pages['Working with Databases'] = array( +	'Database/DAO.page', +	'Database/ActiveRecord.page', +	'Database/Scaffold.page', +	'Database/SqlMap.page'); + +$pages['Advanced Topics'] = array( +	'Advanced/Collections.page', +	'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'); + +return $pages; +//-------------- END CONFIG ---------------- +  ?>
\ No newline at end of file diff --git a/buildscripts/texbuilder/sqlmap/build.php b/buildscripts/texbuilder/sqlmap/build.php index 46773390..4ea4d75e 100644 --- a/buildscripts/texbuilder/sqlmap/build.php +++ b/buildscripts/texbuilder/sqlmap/build.php @@ -1,81 +1,81 @@ -<?php
 -
 -// TBD: subsections in Control Reference
 -
 -$pdflatexExec = "C:/Wei/miktex/texmf/MiKTeX/bin/pdflatex.exe";
 -$pdfTex = "$pdflatexExec -interaction=nonstopmode -max-print-line=120 %s";
 -
 -$mainTexFile = dirname(__FILE__).'/sqlmap.tex';
 -
 -//page root location
 -$base = realpath(dirname(__FILE__).'/../../../demos/sqlmap/protected/pages/');
 -
 -//-------------- END CONFIG ------------------
 -
 -$pages = include('pages.php');
 -
 -include('../../../../prado-3.0/buildscripts/texbuilder/Page2Tex.php');
 -
 -// ---------------- Create the Tex files ---------
 -$count = 1;
 -$j = 1;
 -$current_path = '';
 -echo "Compiling .page files to Latex files\n\n";
 -
 -$parser = new Page2Tex($base, dirname(__FILE__));
 -
 -foreach($pages as $chapter => $sections)
 -{
 -	$content = '\chapter{'.$chapter.'}'.$parser->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;
 -		$parser->setCurrentPage($current_path);
 -
 -		//add id to <h1>, <h2>, <3>
 -		$tmp_content = $parser->set_header_id(file_get_contents($page),$j++);
 -//		file_put_contents($page, $tmp_content);
 -
 -		$content .= $parser->get_section_label($section);
 -		$file_content = file_get_contents($page);
 -		$tex =
 -		$content .= $parser->parse_html($page,$file_content);
 -	}
 -
 -	//var_dump($content);
 -	file_put_contents("ch{$count}.tex", $content);
 -	$count++;
 -	echo "\n";
 -}
 -
 -//$indexer->commit();
 -
 -if($argc <= 1 && $count > 1)
 -{
 -	echo "** Use pdflatex to compile quickstart.tex to obtain PDF version of quickstart tutorial. **\n";
 -	exit;
 -}
 -if($argv[1] == 'pdf')
 -{
 -	if(is_file($pdflatexExec))
 -	{
 -		//build pdfTex
 -		$command=sprintf($pdfTex,$mainTexFile);
 -		system($command);
 -		system($command); //run it twice
 -
 -		echo "\n\n** PDF file quickstart.pdf created **\n\n";
 -
 -	}
 -	else
 -	{
 -		echo " Unable to find pdfLatex executable $pdflatexExec";
 -	}
 -}
 -
 -
 -?>
 +<?php + +// TBD: subsections in Control Reference + +$pdflatexExec = "C:/Wei/miktex/texmf/MiKTeX/bin/pdflatex.exe"; +$pdfTex = "$pdflatexExec -interaction=nonstopmode -max-print-line=120 %s"; + +$mainTexFile = dirname(__FILE__).'/sqlmap.tex'; + +//page root location +$base = realpath(dirname(__FILE__).'/../../../demos/sqlmap/protected/pages/'); + +//-------------- END CONFIG ------------------ + +$pages = include('pages.php'); + +include('../../../../prado-3.0/buildscripts/texbuilder/Page2Tex.php'); + +// ---------------- Create the Tex files --------- +$count = 1; +$j = 1; +$current_path = ''; +echo "Compiling .page files to Latex files\n\n"; + +$parser = new Page2Tex($base, dirname(__FILE__)); + +foreach($pages as $chapter => $sections) +{ +	$content = '\chapter{'.$chapter.'}'.$parser->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; +		$parser->setCurrentPage($current_path); + +		//add id to <h1>, <h2>, <3> +		$tmp_content = $parser->set_header_id(file_get_contents($page),$j++); +//		file_put_contents($page, $tmp_content); + +		$content .= $parser->get_section_label($section); +		$file_content = file_get_contents($page); +		$tex = +		$content .= $parser->parse_html($page,$file_content); +	} + +	//var_dump($content); +	file_put_contents("ch{$count}.tex", $content); +	$count++; +	echo "\n"; +} + +//$indexer->commit(); + +if($argc <= 1 && $count > 1) +{ +	echo "** Use pdflatex to compile quickstart.tex to obtain PDF version of quickstart tutorial. **\n"; +	exit; +} +if($argv[1] == 'pdf') +{ +	if(is_file($pdflatexExec)) +	{ +		//build pdfTex +		$command=sprintf($pdfTex,$mainTexFile); +		system($command); +		system($command); //run it twice + +		echo "\n\n** PDF file quickstart.pdf created **\n\n"; + +	} +	else +	{ +		echo " Unable to find pdfLatex executable $pdflatexExec"; +	} +} + + +?> diff --git a/buildscripts/texbuilder/sqlmap/pages.php b/buildscripts/texbuilder/sqlmap/pages.php index adf788ff..57fff767 100644 --- a/buildscripts/texbuilder/sqlmap/pages.php +++ b/buildscripts/texbuilder/sqlmap/pages.php @@ -1,62 +1,62 @@ -<?php
 -
 -$pages['Introduction'] = array(
 -	'Manual/Overview.page',
 -	'Manual/BigPicture.page'
 -);
 -
 -$pages['Installation and Setup'] = array(
 -	'Manual/Installing.page',
 -	'Manual/Configuring.page',
 -//	'Manual/DataMapperConfiguration.page',
 -	'Manual/ConfigurationElements.page'
 -);
 -
 -$pages['SQLMap for PHP Tutorial'] = array(
 -	'Manual/Tutorial/TestFirst.page',
 -	'Manual/Tutorial/TestSecond.page',
 -	'Manual/Tutorial/TestAgain.page'
 -);
 -
 -$pages['Using SQLMap DataMapper'] = array(
 -	'Manual/BuildingTSqlMapper.page',
 -	'Manual/DataMapperAPI.page',
 -	'Manual/CodingExamples.page'
 -);
 -
 -$pages['Working with Data Maps'] = array(
 -	'Manual/WorkingWithDataMaps.page',
 -//	'Manual/DataMapDefinition.page',
 -	'Manual/MappedStatements.page',
 -	'Manual/TheSQL.page',
 -	'Manual/StatementElementAttributes.page'
 -);
 -
 -$pages['Parameter Maps and Inline Parameters'] = array(
 -	'Manual/ParameterMap.page',
 -//	'Manual/Parameter.page',
 -	'Manual/InlineParameterMaps.page',
 -//	'Manual/StandardTypeParameters.page',
 -//	'Manual/ArrayTypeParameters.page'
 -);
 -
 -$pages['Parameter Maps and Inline Parameters'] = array(
 -	'Manual/ResultMaps.page',
 -//	'Manual/ExtendingResultMaps.page',
 -	'Manual/ResultMapAttributes.page',
 -//	'Manual/ResultElements.page',
 -	'Manual/CustomTypeHandlers.page',
 -	'Manual/InheritanceMapping.page',
 -	'Manual/ImplicitResultMaps.page',
 -	'Manual/ComplexProperties.page',
 -	'Manual/CompositeKeys.page'
 -);
 -
 -$pages['Advanced Topics'] = array(
 -	'Manual/CacheModels.page',
 -	'Manual/DynamicSQL.page'
 -);
 -
 -return $pages;
 -
 +<?php + +$pages['Introduction'] = array( +	'Manual/Overview.page', +	'Manual/BigPicture.page' +); + +$pages['Installation and Setup'] = array( +	'Manual/Installing.page', +	'Manual/Configuring.page', +//	'Manual/DataMapperConfiguration.page', +	'Manual/ConfigurationElements.page' +); + +$pages['SQLMap for PHP Tutorial'] = array( +	'Manual/Tutorial/TestFirst.page', +	'Manual/Tutorial/TestSecond.page', +	'Manual/Tutorial/TestAgain.page' +); + +$pages['Using SQLMap DataMapper'] = array( +	'Manual/BuildingTSqlMapper.page', +	'Manual/DataMapperAPI.page', +	'Manual/CodingExamples.page' +); + +$pages['Working with Data Maps'] = array( +	'Manual/WorkingWithDataMaps.page', +//	'Manual/DataMapDefinition.page', +	'Manual/MappedStatements.page', +	'Manual/TheSQL.page', +	'Manual/StatementElementAttributes.page' +); + +$pages['Parameter Maps and Inline Parameters'] = array( +	'Manual/ParameterMap.page', +//	'Manual/Parameter.page', +	'Manual/InlineParameterMaps.page', +//	'Manual/StandardTypeParameters.page', +//	'Manual/ArrayTypeParameters.page' +); + +$pages['Parameter Maps and Inline Parameters'] = array( +	'Manual/ResultMaps.page', +//	'Manual/ExtendingResultMaps.page', +	'Manual/ResultMapAttributes.page', +//	'Manual/ResultElements.page', +	'Manual/CustomTypeHandlers.page', +	'Manual/InheritanceMapping.page', +	'Manual/ImplicitResultMaps.page', +	'Manual/ComplexProperties.page', +	'Manual/CompositeKeys.page' +); + +$pages['Advanced Topics'] = array( +	'Manual/CacheModels.page', +	'Manual/DynamicSQL.page' +); + +return $pages; +  ?>
\ No newline at end of file diff --git a/buildscripts/texbuilder/time-tracker/pages.php b/buildscripts/texbuilder/time-tracker/pages.php index 5ec3335a..732f675d 100644 --- a/buildscripts/texbuilder/time-tracker/pages.php +++ b/buildscripts/texbuilder/time-tracker/pages.php @@ -1,18 +1,18 @@ -<?php
 -
 -//list page into chapters
 -$pages['Getting Started'] = array(
 -	'Docs/Introduction.page',
 -	'Docs/GettingStarted.page',
 -	'Docs/WritingUnitTest.page',
 -	'Docs/WritingFunctionalTest.page'
 -	);
 -
 -$pages['Testing Business Code'] = array(
 -	'Docs/CreateBusinessCode.page',
 -	'Docs/UsingSQLMap.page',
 -	'Docs/UserClassAndExceptions.page'
 -	);
 -return $pages;
 -
 +<?php + +//list page into chapters +$pages['Getting Started'] = array( +	'Docs/Introduction.page', +	'Docs/GettingStarted.page', +	'Docs/WritingUnitTest.page', +	'Docs/WritingFunctionalTest.page' +	); + +$pages['Testing Business Code'] = array( +	'Docs/CreateBusinessCode.page', +	'Docs/UsingSQLMap.page', +	'Docs/UserClassAndExceptions.page' +	); +return $pages; +  ?>
\ No newline at end of file  | 
