Revert previous commit, was incorrect
[amarok.git] / release_scripts / generate_changelog.rb
blobd0431955417c4c0b6764362dd5e55bd9a2f95c76
1 #!/usr/bin/env ruby
3 # Script for generating a HTML page from Amarok's text ChangeLog
5 # (c) 2005 Mark Kretschmann <markey@web.de>, Ian Monroe <ian@monroe.nu>
6 # License: GPL V2
9 $input  = File.new( "ChangeLog",  File::RDONLY )
10 $output = File.new( "ChangeLog.html", File::CREAT | File::RDWR | File::TRUNC )
12 $changelog = $input.read
15 # Replace bug number with direct link to bugs.kde.org
16 allmatches = $changelog.scan( /BR [0-9]*/ )
17 for bug in allmatches
18     bugnum = /[0-9].*/.match( bug )
19     url = "<a href='http://bugs.kde.org/show_bug.cgi?id=#{bugnum}'>#{bug}</a>"
20     $changelog.gsub!( bug, url )
21 end
23 # Make bullets
24 newOldArray = $changelog.split("VERSION 1.2.1:")
25 a=newOldArray[0].split('*')
26 a.shift
27 a.each{|s|
28     $changelog.sub!("*#{s}","<li>#{s}</li>")
31 # Beautify heading
32 $changelog.gsub!( /Amarok ChangeLog\n\=*\n/, "<h2>Amarok ChangeLog</h2>" )
34 # Makes an extra </ul>... meh
35 ['FEATURES','CHANGES','BUGFIXES'].each { |header|
36     $changelog.gsub!( "#{header}:\n", "</ul><h4>#{header.capitalize!}</h4><ul>" )
38 $changelog.gsub!("VERSION 1.2.1:", "</ul>VERSION 1.2.1:" )
40 # Replace newlines in old format of changelog
41 $changelog.sub!(newOldArray[1],newOldArray[1].gsub( /\n/, "</br>\n" ))
44 # Format version headers
45 $changelog.gsub!(/(VERSION)(.*$)/, '</ul><h3>Version\2</h3>');
46 # Write destination file
47 $output.write( $changelog )