forked from mia/Aegisub
ASS: Fix script header
Previously, Aegisub wrote its "Script generated by" lines without a semicolon to mark them as comments. As a result, it prepended these lines every time a script was loaded and then saved again. Fix. Also fix a bug that caused the ASS parser to treat comments before the [Script Info] section as non-blank lines, therefore inserting a duplicate section header whenever such comments were present.
This commit is contained in:
parent
3f840ceec8
commit
b1e40455ed
2 changed files with 6 additions and 6 deletions
|
@ -66,16 +66,16 @@ void AssParser::ParseAttachmentLine(wxString const& data) {
|
|||
}
|
||||
|
||||
void AssParser::ParseScriptInfoLine(wxString const& data) {
|
||||
// If the first nonblank line isn't a header pretend it starts with [Script Info]
|
||||
if (target->Line.empty())
|
||||
target->Line.push_back(*new AssEntry("[Script Info]", "[Script Info]"));
|
||||
|
||||
if (data.StartsWith(";")) {
|
||||
// Skip stupid comments added by other programs
|
||||
// Of course, we'll add our own in place later... ;)
|
||||
return;
|
||||
}
|
||||
|
||||
// If the first nonblank line isn't a header pretend it starts with [Script Info]
|
||||
if (target->Line.empty())
|
||||
target->Line.push_back(*new AssEntry("[Script Info]", "[Script Info]"));
|
||||
|
||||
if (data.StartsWith("ScriptType:")) {
|
||||
wxString versionString = data.Mid(11).Trim(true).Trim(false).Lower();
|
||||
int trueVersion;
|
||||
|
|
|
@ -86,8 +86,8 @@ void AssSubtitleFormat::ReadFile(AssFile *target, wxString const& filename, wxSt
|
|||
void AssSubtitleFormat::WriteFile(const AssFile *src, wxString const& filename, wxString const& encoding) const {
|
||||
TextFileWriter file(filename, encoding);
|
||||
|
||||
file.WriteLineToFile(wxString("Script generated by Aegisub ") + GetAegisubLongVersionString());
|
||||
file.WriteLineToFile("http://www.aegisub.org/");
|
||||
file.WriteLineToFile(wxString("; Script generated by Aegisub ") + GetAegisubLongVersionString());
|
||||
file.WriteLineToFile("; http://www.aegisub.org/");
|
||||
|
||||
bool ssa = filename.Right(4).Lower() == ".ssa";
|
||||
|
||||
|
|
Loading…
Reference in a new issue