Author: Derick Rethans
Date: 2006-01-23 23:26:12 +0100 (Mon, 23 Jan 2006)
New Revision: 2011
Log:
- Fixed tutorial rendering script to create links to the correct online version.
- Added more auto-links to the tutorial rendering script.
Modified:
scripts/build-docs.sh
scripts/render-tutorial.php
Modified: scripts/build-docs.sh
===================================================================
--- scripts/build-docs.sh 2006-01-23 22:23:32 UTC (rev 2010)
+++ scripts/build-docs.sh 2006-01-23 22:26:12 UTC (rev 2011)
@@ -35,7 +35,7 @@
if test -f $i/docs/tutorial.txt; then
comp=`echo $i | cut -d / -f 1`
echo "* $comp"
- php ../scripts/render-tutorial.php -c $comp -t
/home/httpd/html/components/phpdoc_gen/ezcomponents/$1
+ php ../scripts/render-tutorial.php -c $comp -t
/home/httpd/html/components/phpdoc_gen/ezcomponents/$1 -v $1
else
echo '<div class="attribute-heading"><h1>'$i'</h1></div>' >
/home/httpd/html/components/phpdoc_gen/ezcomponents/$1/introduction_$comp.html
echo '<b>[ <a href="introduction_'$i'.html"
class="menu">Introduction</a> ]</b>' >>
/home/httpd/html/components/phpdoc_gen/ezcomponents/$1/introduction_$comp.html
Modified: scripts/render-tutorial.php
===================================================================
--- scripts/render-tutorial.php 2006-01-23 22:23:32 UTC (rev 2010)
+++ scripts/render-tutorial.php 2006-01-23 22:26:12 UTC (rev 2011)
@@ -34,6 +34,10 @@
$targetOption->mandatory = true;
$params->registerOption( $targetOption );
+$versionOption = new ezcConsoleOption( 'v', 'version',
ezcConsoleInput::TYPE_STRING );
+$versionOption->mandatory = true;
+$params->registerOption( $versionOption );
+
// Process console parameters
try
{
@@ -45,11 +49,12 @@
}
$component = $params->getOption( 'component' )->value;
+$version = $params->getOption( 'version' )->value;
$output = getRstOutput( $component );
$output = removeHeaderFooter( $output );
$output = addNewHeader( $component, $output );
$output = addExampleLineNumbers( $output );
-$output = addLinks( $component, $output );
+$output = addLinks( $component, $output, $version );
$targetDir = $params->getOption( 'target' )->value;
file_put_contents( "$targetDir/introduction_$component.html", $output );
@@ -88,17 +93,20 @@
return $outputHeader . $output;
}
-function addLinks( $component, $output )
+function addLinks( $component, $output, $version )
{
- $base = "http://ez.no/doc/components/view/(file)/1.0rc1/$component/";
+ $base = "http://ez.no/doc/components/view/(file)/$version/$component/";
$output = preg_replace( '@(ezc[A-Z][a-zA-Z]+)::\$([A-Za-z0-9]+)@', "<a
href='{$base}\\1.html#\$\\2'>\\0</a>", $output );
- $output = preg_replace( "@(ezc[A-Z][a-zA-Z]+)::([A-Z_]+)@", "<a
href='{$base}\\1.html#const\\2'>\\0</a>", $output );
- $output = preg_replace( "@(ezc[A-Z][a-zA-Z]+)::([A-Za-z0-9]+)\(\)@", "<a
href='{$base}\\1.html#\\2'>\\0</a>", $output );
- $output = preg_replace( "@(ezc[A-Z][a-zA-Z]+)->([A-Za-z0-9]+)\(\)@", "<a
href='{$base}\\1.html#\\2'>\\0</a>", $output );
+ $output = preg_replace( "@(ezc[A-Z][a-zA-Z]+)::([A-Za-z0-9_]+)(?=\()@",
"<a href='{$base}\\1.html#\\2'>\\0</a>", $output );
+ $output = preg_replace( "@(ezc[A-Z][a-zA-Z]+)->([A-Za-z0-9_]+)(?=\()@",
"<a href='{$base}\\1.html#\\2'>\\0</a>", $output );
+ $output = preg_replace( "@(ezc[A-Z][a-zA-Z]+)::([A-Z_]+)\\b@", "<a
href='{$base}\\1.html#const\\2'>\\0</a>", $output );
$output = preg_replace( "@(?<![/>])(ezc[A-Z][a-zA-Z]+)@", "<a
href='{$base}\\1.html'>\\0</a>", $output );
$output = preg_replace( "@(<span style=\"color:
#[0-9A-F]+\">)(ezc[A-Z][a-zA-Z]+)(</span><span style=\"color:
#[0-9A-F]+\">\()@", "\\1<a href='{$base}\\2.html'>\\2</a>\\3", $output );
-
+ $output = preg_replace( "@(ezc[A-Z][a-zA-Z]+)(</span><span style=\"color:
#[0-9A-F]+\">::</span><span style=\"color: #[0-9A-F]+\">)([A-Z_]+)@", "<a
href='{$base}\\1.html#const\\3'>\\1::\\3</a>", $output );
+ $output = preg_replace( "@(<span style=\"color:
#[0-9A-F]+\">)(ezc[A-Z][a-zA-Z]+)(</li>)@", "\\1<a
href='{$base}\\2.html'>\\2</a>\\3", $output );
+ $output = preg_replace( "@(<span style=\"color:
#[0-9A-F]+\">)(ezc[A-Z][a-zA-Z]+)(</span><span style=\"color:
#[0-9A-Z]+\">::</span><span style=\"color:
#[0-9A-F]+\">)([A-Za-z]+)(</span>)@", "\\1<a
href='{$base}\\2.html#\\4'>\\2::\\4</a>\\5", $output );
+ $output = preg_replace( "@(<span style=\"color:
#[0-9A-F]+\">)(ezc[A-Z][a-zA-Z]+Exception)(\ \\$)@", "\\1<a
href='{$base}\\2.html'>\\2</a>\\3", $output );
return $output;
}
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components