Write the version comments under the [Script Info] header. Closes #1567.

This commit is contained in:
Thomas Goyne 2013-01-09 08:05:01 -08:00
parent 8470ffdbf0
commit 8566960312

View file

@ -110,17 +110,17 @@ static inline wxString format(AssEntryGroup group, bool ssa) {
void AssSubtitleFormat::WriteFile(const AssFile *src, wxString const& filename, wxString const& encoding) const { void AssSubtitleFormat::WriteFile(const AssFile *src, wxString const& filename, wxString const& encoding) const {
TextFileWriter file(filename, encoding); TextFileWriter file(filename, encoding);
file.WriteLineToFile("[Script Info]");
file.WriteLineToFile(wxString("; Script generated by Aegisub ") + GetAegisubLongVersionString()); file.WriteLineToFile(wxString("; Script generated by Aegisub ") + GetAegisubLongVersionString());
file.WriteLineToFile("; http://www.aegisub.org/"); file.WriteLineToFile("; http://www.aegisub.org/");
bool ssa = filename.Right(4).Lower() == ".ssa"; bool ssa = filename.Right(4).Lower() == ".ssa";
AssEntryGroup group = ENTRY_GROUP_MAX; AssEntryGroup group = ENTRY_INFO;
for (auto const& line : src->Line) { for (auto const& line : src->Line) {
if (line.Group() != group) { if (line.Group() != group) {
// Add a blank line between each group // Add a blank line between each group
if (group != ENTRY_GROUP_MAX) file.WriteLineToFile("");
file.WriteLineToFile("");
file.WriteLineToFile(line.GroupHeader(ssa)); file.WriteLineToFile(line.GroupHeader(ssa));
file.WriteLineToFile(format(line.Group(), ssa), false); file.WriteLineToFile(format(line.Group(), ssa), false);