Navigation Menu

Skip to content
This repository has been archived by the owner on Dec 23, 2020. It is now read-only.

Commit

Permalink
Implement task generate-html-changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaetano Giunta committed Jul 13, 2012
1 parent 5827981 commit a1cc0f1
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion pakefile.php
Expand Up @@ -366,8 +366,55 @@ function run_generate_html_changelog( $task=null, $args=array(), $cliopts=array(
$filename = eZPCPBuilder::changelogFilename( $opts );

$file = pake_read_file( $changelogdir . '/' . $filename );
$htmlfile = array();
$mode = null;
foreach( explode( "\n", $file ) as $line )
{
switch( $line )
{
case "Bugfixes":
$mode = 'wit';
$htmlfile[] = '<h3>' . $line . '</h3><ul>';
break;
case "Enhancements":
$mode = 'wit';
$htmlfile[] = '</ul><h3>' . $line . '</h3><ul>';
break;
case "Pull requests":
$mode = 'github';
$htmlfile[] = '</ul><h3>' . $line . '</h3><ul>';
break;
case "Miscellaneous":
$mode = null;
$htmlfile[] = '</ul><h3>' . $line . '</h3><ul>';
break;
default:
if ( trim( $line ) == '' || preg_match( '/^=+$/', $line ) )
{
continue;
}
switch( $mode )
{
case 'wit':
$line = preg_replace( '/^- /', '', $line );
$line = preg_replace( '/#(\d+):/', '<a href="http://issues.ez.no/$1">$1</a>:', $line );
break;
case 'github':
$line = preg_replace( '/^- /', '', $line );
$line = preg_replace( '/#(\d+):/', '<a href="https://github.com/ezsystems/ezpublish/pull/$1">$1</a>:', $line );
break;
default;
$line = preg_replace( '/^- /', '', $line );
break;

}
$htmlfile[] = '<li>' . $line . '</li>';
}
}
$htmlfile[] = '</ul>';
$htmlfile = implode( "\n", $htmlfile );

pake_echo( 'TO DO: build html version of changelog' );
pake_echo( $htmlfile );
}

/**
Expand Down

0 comments on commit a1cc0f1

Please sign in to comment.