Author: dr
Date: Thu Jan 31 15:29:52 2008
New Revision: 7268

Log:
- Fixes for building downloadable docs
- Automatically upload docs.
- Fixed rendering docs re. listings.

Modified:
    scripts/autogen-version-tags.sh
    scripts/build-docs.sh
    scripts/build-downloadable-docs.sh
    scripts/render-tutorial.php

Modified: scripts/autogen-version-tags.sh
==============================================================================
    (empty)

Modified: scripts/build-docs.sh
==============================================================================
--- scripts/build-docs.sh [iso-8859-1] (original)
+++ scripts/build-docs.sh [iso-8859-1] Thu Jan 31 15:29:52 2008
@@ -83,7 +83,7 @@
        version=`echo "$i" | sed "s/\/$comp//" | sed "s/releases\///"`
        if test -f $i/docs/tutorial.txt; then
                echo "* $comp ($version)"
-               php scripts/render-tutorial.php -c $comp -t ${DOC_OUTPUT_DIR} 
-v $version
+               php scripts/render-tutorial.php -c $comp -t ${DOC_OUTPUT_DIR} 
-v $version -r $release
 
                cat >> ${DOC_OUTPUT_DIR}/tutorials.tpl << EOF
 <li><a href="introduction_$comp.html')}">$comp</a></li>
@@ -111,7 +111,7 @@
                                        echo -n "  - Rendering extra doc 
'$output_name' to $release/${comp}_${output_name}"
                                        php scripts/render-rst-file.php -v 
$release -c $comp -t "${DOC_OUTPUT_DIR}" -f $t
                                        short_name=`echo $output_name | sed 
's/.html//'`
-                                       short_name=`php -r "echo ucfirst( 
'$short_name' );"`
+                                       short_name=`php -r "echo strtr( 
ucfirst( '$short_name' ), '-_', '  ' );"`
                                        extra1="$extra1 <b>[ <a 
href='../${comp}_${output_name}'>$short_name</a> ]</b>"
                                        extra2="$extra2 <b>[ <a 
href='${comp}_${output_name}'>$short_name</a> ]</b>"
                                fi
@@ -188,3 +188,6 @@
 cd ..
 gzip -c -9 cdocs-${release}.tar > cdocs-${release}.tgz || exit 12
 rm cdocs-${release}.tar
+scp -i /home/derick/.ssh/id_ezdoc_rsa -p cdocs-${release}.tgz components:.
+ssh -i /home/derick/.ssh/id_ezdoc_rsa components ./copy-doc.sh 
cdocs-${release}.tgz
+echo "scp -p cdocs-${release}.tgz components:."

Modified: scripts/build-downloadable-docs.sh
==============================================================================
--- scripts/build-downloadable-docs.sh [iso-8859-1] (original)
+++ scripts/build-downloadable-docs.sh [iso-8859-1] Thu Jan 31 15:29:52 2008
@@ -105,7 +105,7 @@
        version=`echo "$i" | sed "s/\/$comp//" | sed "s/releases\///"`
        if test -f $i/docs/tutorial.txt; then
                echo "* $comp ($version)"
-               php scripts/render-tutorial.php -c $comp -t ${DOC_OUTPUT_DIR} 
-v $version
+               php scripts/render-tutorial.php -c $comp -t ${DOC_OUTPUT_DIR} 
-v $version -r $release
 
                cp ${DOC_OUTPUT_DIR}/introduction_$comp.html /tmp/file4.html
                php -r "echo preg_replace( '@/docs/api/(.*?)/@', '', 
file_get_contents( '/tmp/file4.html' ) ); " > 
${DOC_OUTPUT_DIR}/introduction_$comp.html
@@ -199,3 +199,5 @@
 tar -chzf /tmp/ezcomponents-$release-docs.tar.gz ezcomponents-$release
 cd ../..
 rm -rf components
+scp -p /tmp/ezcomponents-$release-docs.tar.gz 
components.ez.no:/home/httpd/ezcomponents.org/files/downloads
+echo "scp -p /tmp/ezcomponents-$release-docs.tar.gz 
components.ez.no:/home/httpd/ezcomponents.org/files/downloads"

Modified: scripts/render-tutorial.php
==============================================================================
--- scripts/render-tutorial.php [iso-8859-1] (original)
+++ scripts/render-tutorial.php [iso-8859-1] Thu Jan 31 15:29:52 2008
@@ -64,6 +64,11 @@
 $versionOption->shorthelp = "The version of the component that should be read. 
E.g. trunk, 1.0rc1, etc.";
 $params->registerOption( $versionOption );
 
+$versionOption = new ezcConsoleOption( 'r', 'release', 
ezcConsoleInput::TYPE_STRING );
+$versionOption->mandatory = true;
+$versionOption->shorthelp = "The release of the components we're building this 
tutorial for.";
+$params->registerOption( $versionOption );
+
 // Process console parameters
 try
 {
@@ -86,6 +91,7 @@
 
 $component = $params->getOption( 'component' )->value;
 $version = $params->getOption( 'version' )->value;
+$release = $params->getOption( 'release' )->value;
 
 if ( $version == 'trunk' )
 {
@@ -98,7 +104,7 @@
 
 $output = getRstOutput( $componentDir );
 $output = removeHeaderFooter( $output );
-$output = addNewHeader( $component, $output, $version );
+$output = addNewHeader( $component, $output, $release );
 $output = addExampleLineNumbers( $output );
 $output = addLinks( $component, $output, $version );
 $output = addNewFooter( $output );
@@ -129,16 +135,12 @@
 
 function addNewFooter( $output )
 {
-    return $output . "\n". "<div style=\"color: #959fa8; text-align: right; 
font-size: 0.85em;\">Last updated: ". date( 'D, d M Y' ) . 
"</div></body></html>";
+    return $output . "\n". "<div style=\"color: #959fa8; text-align: right; 
font-size: 0.85em;\">Last updated: ". date( 'D, d M Y' ) . "</div>";
 }
 
 function addNewHeader( $component, $output, $version )
 {
     $outputHeader = <<<FOO
-<html>
-<head>
-<meta http-equiv="content-type" content="text/html; charset=utf-8">
-<body>
 <h1>$component</h1>
 <b>[ <a href="/docs/api/$version/introduction_$component.html" 
class="menu">Tutorial</a> ]</b>
 <!-- EXTRA DOCS GO HERE! -->
@@ -156,6 +158,8 @@
 //    $base = "http://ez.no/doc/components/view/$version/(file)/$component/";
     $base = "$component/";
 
+    $output = preg_replace_callback( '@<span 
class="nx">(ezc[A-Z][a-zA-Z0-9]+)</span><span class="o">::</span><span 
class="na">([A-Za-z0-9_]+)</span>@', 'callBackFormatClassStaticMethodLink', 
$output );
+    $output = preg_replace_callback( '@(?<!>)<span 
class="nx">(ezc[A-Z][a-zA-Z0-9]+)</span>@', 'callBackFormatClassLink', $output 
);
     $output = preg_replace_callback( 
'@(ezc[A-Z][a-zA-Z0-9]+)::\$([A-Za-z0-9]+)@', 'callBackFormatClassVarLink', 
$output );
     $output = preg_replace_callback( 
"@(ezc[A-Z][a-zA-Z0-9]+)::([A-Za-z0-9_]+)(?=\()@", 
'callBackFormatClassStaticMethodLink', $output );
     $output = preg_replace_callback( 
"@(ezc[A-Z][a-zA-Z0-9]+)-(>|\&gt;)([A-Za-z0-9_]+)(?=\()@", 
'callBackFormatClassDynamicMethodLink', $output );
@@ -263,15 +267,22 @@
     
     if ( strstr( $args[1], '&lt;?php' ) !== false )
     {
-        $listing = '<pre class="listing">';
-        $highlighted = highlight_string( html_entity_decode( $args[1] ), true 
);
-        $highlighted = preg_replace( '@^<code><span style="color: 
#000000">.<br />@ms', '<code><br />', $highlighted );
-        $highlighted = preg_replace( '@(<span style="color: 
#[0-9A-F]+">)(.*?)((<br />)+)(.*?)(</span>)@ms', '\1\2\6\3\1\5\6', $highlighted 
);
-        $highlighted = preg_replace( '@(<span style="color: 
#[0-9A-F]+">)(.+?)(<br />)(</span>)@ms', '\1\2\4\3', $highlighted );
-        $highlighted = preg_replace( '@<span style="color: 
#[0-9A-F]+"></span>@', '', $highlighted );
-        $highlighted = preg_replace( '@</span><br />.</code>[EMAIL 
PROTECTED]', "</code>", $highlighted );
-        $highlighted = preg_replace_callback( '@(.*?)<br />@', 
"callbackAddLineNr", $highlighted );
-        $listing .= $highlighted . '</pre>';
+        file_put_contents( "/tmp/foo2.php", trim( html_entity_decode( $args[1] 
) ) );
+        `pygmentize -o /tmp/foo3.html /tmp/foo2.php`;
+        $contents = file( "/tmp/foo3.html" );
+        // strip out BS at start and end
+        $contents[0] = str_replace( '<div class="highlight"><pre>', '', 
$contents[0] );
+        unset( $contents[count( $contents ) - 1] );
+        $listing = <<<ENDT
+<ol class="example">
+ 
+ENDT;
+        foreach ( $contents as $line )
+        {
+            $listing .= "<li>{$line}</li>";
+        }
+
+        $listing .= "</ol>\n";
         return $listing;
     } else {
         return $args[0];


-- 
svn-components mailing list
[EMAIL PROTECTED]
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to