|
1
|
|
|
<?php |
|
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
header( 'Content-Type: text/plain' ); |
|
4
|
|
|
|
|
5
|
|
|
$data = file_get_contents( __DIR__ . '/../changelog.json' ); |
|
6
|
|
|
$changelog = json_decode( $data ); |
|
7
|
|
|
|
|
8
|
|
|
function render_changes( $changes, $level = 0 ) { |
|
|
|
|
|
|
9
|
|
|
$indent = $level * 2; |
|
10
|
|
|
|
|
11
|
|
|
if ( is_string( $changes ) ) { |
|
12
|
|
|
echo str_repeat( ' ', $indent ), '- ', $changes, "\r\n"; |
|
|
|
|
|
|
13
|
|
|
} elseif ( is_array( $changes ) ) { |
|
14
|
|
|
foreach ( $changes as $change ) { |
|
15
|
|
|
render_changes( $change, $level ); |
|
16
|
|
|
} |
|
17
|
|
|
} elseif ( is_object( $changes ) ) { |
|
18
|
|
|
if ( isset( $changes->name ) ) { |
|
19
|
|
|
// Changes group. |
|
20
|
|
|
echo "\r\n"; |
|
21
|
|
|
echo '### ', $changes->name, "\r\n"; |
|
|
|
|
|
|
22
|
|
|
|
|
23
|
|
|
if ( isset( $changes->changes ) ) { |
|
24
|
|
|
render_changes( $changes->changes, $level ); |
|
25
|
|
|
} |
|
26
|
|
|
} else { |
|
27
|
|
|
if ( isset( $changes->description ) ) { |
|
28
|
|
|
render_changes( $changes->description, $level ); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
if ( isset( $changes->changes ) ) { |
|
32
|
|
|
render_changes( $changes->changes, $level + 1 ); |
|
33
|
|
|
} |
|
34
|
|
|
} |
|
35
|
|
|
} |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
?> |
|
39
|
|
|
# Change Log |
|
40
|
|
|
|
|
41
|
|
|
All notable changes to this project will be documented in this file. |
|
42
|
|
|
|
|
43
|
|
|
This projects adheres to [Semantic Versioning](http://semver.org/) and [Keep a CHANGELOG](http://keepachangelog.com/). |
|
44
|
|
|
|
|
45
|
|
|
<?php |
|
46
|
|
|
|
|
47
|
|
|
foreach ( $changelog as $log ) { |
|
48
|
|
|
if ( 'Unreleased' === $log->version ) { |
|
49
|
|
|
echo '## [', $log->version, '][unreleased]', "\r\n"; |
|
|
|
|
|
|
50
|
|
|
} else { |
|
51
|
|
|
echo '## [', $log->version, '] - ', $log->date, "\r\n"; |
|
|
|
|
|
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
render_changes( $log->changes ); |
|
55
|
|
|
|
|
56
|
|
|
echo "\r\n"; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
$collection = new CachingIterator( new ArrayIterator( $changelog ), CachingIterator::TOSTRING_USE_CURRENT ); |
|
60
|
|
|
|
|
61
|
|
|
foreach ( $collection as $log ) { |
|
62
|
|
|
if ( $collection->hasNext() ) { |
|
63
|
|
|
$prev = $collection->getInnerIterator()->current(); |
|
64
|
|
|
|
|
65
|
|
|
if ( 'Unreleased' === $log->version ) { |
|
66
|
|
|
echo '[unreleased]: https://github.com/pronamic/wp-pronamic-ideal/compare/', $prev->version, '...', 'HEAD', "\r\n"; |
|
|
|
|
|
|
67
|
|
|
} else { |
|
68
|
|
|
echo '[', $log->version, ']: https://github.com/pronamic/wp-pronamic-ideal/compare/', $prev->version, '...', $log->version, "\r\n"; |
|
|
|
|
|
|
69
|
|
|
} |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
|