summaryrefslogtreecommitdiff
path: root/buildscripts/texbuilder/Page2Tex.php
diff options
context:
space:
mode:
authorwei <>2007-01-06 00:00:57 +0000
committerwei <>2007-01-06 00:00:57 +0000
commitbde6488e19b9852011a657fda8aa39680d9c4a62 (patch)
tree4550e521558ddde1e4c42c9d992501beda48b489 /buildscripts/texbuilder/Page2Tex.php
parent6c2a7b9b5674c5c9f0c8e78e32531af43462638c (diff)
Update docs.
Diffstat (limited to 'buildscripts/texbuilder/Page2Tex.php')
-rw-r--r--buildscripts/texbuilder/Page2Tex.php20
1 files changed, 14 insertions, 6 deletions
diff --git a/buildscripts/texbuilder/Page2Tex.php b/buildscripts/texbuilder/Page2Tex.php
index 9c779a64..5d9a2b81 100644
--- a/buildscripts/texbuilder/Page2Tex.php
+++ b/buildscripts/texbuilder/Page2Tex.php
@@ -88,7 +88,9 @@ class Page2Tex
function texttt($matches)
{
- return '\texttt{'.str_replace(array('#','_','&amp;'),array('\#','\_','\&'), $matches[1]).'}';
+ $text ='\texttt{'.str_replace(array('#','_','&amp;'),array('\#','\_','\&'), $matches[1]).'}';
+ //$text = preg_replace('/([^\\\\])&([^;]+)/', '$1\&$2', $text);
+ return $text;
}
function get_current_path()
@@ -105,8 +107,11 @@ class Page2Tex
{
if(strpos($matches[1],'?') ===false)
{
- $target = $this->get_current_path().'/'.substr($matches[1],1);
- return '\hyperlink{'.$target.'}{'.$matches[2].'}';
+ if(strpos($matches[1],'http://')===false)
+ {
+ $target = $this->get_current_path().'/'.substr($matches[1],1);
+ return '\hyperlink{'.$target.'}{'.$matches[2].'}';
+ }
}
else
{
@@ -121,7 +126,7 @@ class Page2Tex
$page = str_replace('?page=','',$matches[1]);
return '\hyperlink{'.$page.'}{'.$matches[2].'}';
}
- return '\href{'.$matches[1].'}{'.$matches[2].'}';
+ return '\href{'.str_replace('#','\\#',$matches[1]).'}{'.$matches[2].'}';
}
function parse_html($page,$html)
@@ -144,7 +149,7 @@ class Page2Tex
//codes
$html = str_replace('$', '\$', $html);
- $html = preg_replace_callback('/<com:TTextHighlighter[^>]*>((.|\n)*?)<\/com:TTextHighlighter>/', array($this,'escape_verbatim'), $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);
@@ -158,12 +163,15 @@ class Page2Tex
'\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('/<i[^>]*>([^<]*)+?<\/i>/', '\emph{$1}', $html);
$html = preg_replace_callback('/<tt>([^<]*)<\/tt>/', array($this,'texttt'), $html);
//links