Author: Derick Rethans
Date: 2006-01-19 13:19:28 +0100 (Thu, 19 Jan 2006)
New Revision: 1977
Log:
- Add line numbers and better headers
Modified:
scripts/build-docs.sh
scripts/render-tutorial.php
Modified: scripts/build-docs.sh
===================================================================
--- scripts/build-docs.sh 2006-01-19 12:03:24 UTC (rev 1976)
+++ scripts/build-docs.sh 2006-01-19 12:19:28 UTC (rev 1977)
@@ -17,7 +17,11 @@
echo "* $i"
php ../scripts/render-tutorial.php -c $i -t
/home/httpd/html/components/phpdoc_gen/ezcomponents/1.0rc1
else
- echo "<h1>No introduction available for $i</h1>" >
/home/httpd/html/components/phpdoc_gen/ezcomponents/1.0rc1/introduction_$i.html
+ echo '<div class="attribute-heading"><h1>'$i'</h1></div>' >
/home/httpd/html/components/phpdoc_gen/ezcomponents/1.0rc1/introduction_$i.html
+ echo '<b>[ <a href="introduction_'$i'.html"
class="menu">Introduction</a> ]</b>' >>
/home/httpd/html/components/phpdoc_gen/ezcomponents/1.0rc1/introduction_$i.html
+ echo '<b>[ <a href="classtrees_'$i'.html" class="menu">Class
tree</a> ]</b>' >>
/home/httpd/html/components/phpdoc_gen/ezcomponents/1.0rc1/introduction_$i.html
+ echo '<b>[ <a href="elementindex_'$i'.html"
class="menu">Element index</a> ]</b>' >>
/home/httpd/html/components/phpdoc_gen/ezcomponents/1.0rc1/introduction_$i.html
+ echo "<h1>No introduction available for $i</h1>" >>
/home/httpd/html/components/phpdoc_gen/ezcomponents/1.0rc1/introduction_$i.html
fi
done
cd ..
Modified: scripts/render-tutorial.php
===================================================================
--- scripts/render-tutorial.php 2006-01-19 12:03:24 UTC (rev 1976)
+++ scripts/render-tutorial.php 2006-01-19 12:19:28 UTC (rev 1977)
@@ -43,6 +43,7 @@
$output = getRstOutput( $component );
$output = removeHeaderFooter( $output );
$output = addNewHeader( $component, $output );
+$output = addExampleLineNumbers( $output );
$output = addLinks( $component, $output );
$targetDir = $params->getOption( 'target' )->value;
@@ -94,3 +95,17 @@
return $output;
}
+
+function addExampleLineNumbers( $output )
+{
+ return preg_replace_callback( '@<pre
class=\"literal-block\">(.+?)<\/pre>@ms', 'callbackAddLineNumbers', $output );
+}
+
+function callbackAddLineNumbers( $args )
+{
+ $listing = '<div class="listing"><pre><ol>';
+ $highlighted = highlight_string( html_entity_decode( $args[1] ), true );
+ $listing .= preg_replace( '@(.*?)<br />@ms', "<li>\\1</li>\n",
$highlighted );
+ $listing .= '</ol></pre></div>';
+ return $listing;
+}
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components