From c004bbdf4f0e824e5ccbaef8f98ca4a3d44d3b49 Mon Sep 17 00:00:00 2001 From: wei <> Date: Fri, 14 Jul 2006 06:46:31 +0000 Subject: Changed SQLMap manual into a prado app. --- buildscripts/texbuilder/quickstart/build.php | 290 ++++++++++++++++++++++ buildscripts/texbuilder/quickstart/pages.php | 103 ++++++++ buildscripts/texbuilder/quickstart/quickstart.tex | 122 +++++++++ 3 files changed, 515 insertions(+) create mode 100644 buildscripts/texbuilder/quickstart/build.php create mode 100644 buildscripts/texbuilder/quickstart/pages.php create mode 100644 buildscripts/texbuilder/quickstart/quickstart.tex (limited to 'buildscripts/texbuilder/quickstart') diff --git a/buildscripts/texbuilder/quickstart/build.php b/buildscripts/texbuilder/quickstart/build.php new file mode 100644 index 00000000..c0577c8f --- /dev/null +++ b/buildscripts/texbuilder/quickstart/build.php @@ -0,0 +1,290 @@ +]*>/', '', $html); + $html = preg_replace('/<\/?p>/m', '', $html); + + //escape { and } + $html = preg_replace('/([^\s]+){([^}]*)}([^\s]+)/', '$1\\\{$2\\\}$3', $html); + + //codes + $html = str_replace('$', '\$', $html); + $html = preg_replace('/]*>/', '`1`', $html); + $html = preg_replace('/<\/com:TTextHighlighter>/', '`2`', $html); + $html = preg_replace_callback('/(`1`)([^`]*)(`2`)/m', 'escape_verbatim', $html); + $html = preg_replace_callback('/(
)([^<]*)(<\/div>)/', 'escape_verbatim', $html); + $html = preg_replace_callback('/(
)([^<]*)(<\/pre>)/', 'escape_verbatim', $html);
+
+	//
+	$html = preg_replace_callback('/([^<]*)<\/code>/', 'escape_verb', $html);
+
+	$html = preg_replace_callback('/"?[^\\/]*\/>/', 'include_image', $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>/', 'texttt', $html);
+
+	//links
+	$html = preg_replace_callback('/]+href="([^"]*)"[^>]*>([^<]*)<\/a>/',
+							'make_link', $html);
+	//anchor
+	$html = preg_replace_callback('/]+name="([^"]*)"[^>]*><\/a>/', '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); + $html = preg_replace('/
      /', '\begin{enumerate}', $html); + $html = preg_replace('/<\/ol>/', '\end{enumerate}', $html); + $html = preg_replace('/
    1. /', '\item ', $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 = 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).'}{}'; +} + + +function set_header_id($content, $count) +{ + global $header_count; + $header_count = $count*100; + $content = preg_replace_callback('/

      /', "h1", $content); + $content = preg_replace_callback('/

      /', "h2", $content); + $content = preg_replace_callback('/

      /', "h3", $content); + return $content; +} + +function h1($matches) +{ + global $header_count; + return "

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

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

      "; +} + +$header_count = 0; + +//--------------- BEGIN PROCESSING ------------------- + + +//--------------- Indexer ------------------- + +//require_once('create_index.php'); +//$indexer = new quickstart_index($index_dir); + +// ---------------- Create the Tex files --------- +$count = 1; +$j = 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; + + //add id to

      ,

      , <3> + $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 = + $content .= 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 new file mode 100644 index 00000000..9b8a97ad --- /dev/null +++ b/buildscripts/texbuilder/quickstart/pages.php @@ -0,0 +1,103 @@ + \ No newline at end of file diff --git a/buildscripts/texbuilder/quickstart/quickstart.tex b/buildscripts/texbuilder/quickstart/quickstart.tex new file mode 100644 index 00000000..a0553658 --- /dev/null +++ b/buildscripts/texbuilder/quickstart/quickstart.tex @@ -0,0 +1,122 @@ +\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 v3.0.3 Quickstart Tutorial + \thanks{Copyright 2005-2006. All Rights Reserved.} +} +\author{Qiang Xue and Wei Zhuo} +\date{\today} + + +%-------------- BEGIN DOCUMENT ------------------ + + +\begin{document} + +\maketitle + +\pagestyle{plain} +\addcontentsline{toc}{chapter}{Contents} +\pagenumbering{roman} +\tableofcontents + +\chapter*{Preface} +\addcontentsline{toc}{chapter}{Preface} +Prado quick start doc + +\chapter*{License} +\addcontentsline{toc}{chapter}{License} +PRADO is free software released under the terms of the following BSD license.\\ +Copyright 2004-2006, The PRADO Group (http://www.pradosoft.com)\\ +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: +\begin{enumerate} + \item Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + + \item Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +\item Neither the name of the PRADO Group nor the names of its contributors may +be used to endorse or promote products derived from this software without +specific prior written permission. +\end{enumerate} + +\begin{verbatim} +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +\end{verbatim} + + +\newpage + +\pagestyle{fancyplain} +\pagenumbering{arabic} + +\include{ch1} +\include{ch2} +\include{ch3} +\include{ch4} +\include{ch5} +\include{ch6} +\include{ch7} +\include{ch8} +\include{ch9} +\include{ch10} +\include{ch11} +\include{ch12} +\include{ch13} + +\end{document} -- cgit v1.2.3