Skip to content

Allow manipulation of comments in the Script Info section#36

Open
ItMightBeKaraoke wants to merge 2 commits into
chireiden:masterfrom
ItMightBeKaraoke:preserve_comments
Open

Allow manipulation of comments in the Script Info section#36
ItMightBeKaraoke wants to merge 2 commits into
chireiden:masterfrom
ItMightBeKaraoke:preserve_comments

Conversation

@ItMightBeKaraoke
Copy link
Copy Markdown

The idea here is that a user of this library should have the ability to add Script Info comments to an ass document. When parsing a file, they are also preserved. It may make more sense to allow them in any section, but as I understand it the spec only mentions ";" comments to be available in Script Info so that is all that is implemented here. The existing functionality of ignoring lines starting with ";" in other sections is maintained.

Note that while this retains the order of the comments, it will always put them in their customary position at the beginning of the Script Info, before any of the fields, rather than tracking any position they could have interleaved between the field lines. This means they can't be used as comments for particular fields, but I don't think that was ever an intended use case of these comments anyway.

The idea here is that a user of this library should have the ability to add Script Info comments to an ass document. When parsing a file, they are also preserved. It may make more sense to allow them in any section, but as I understand it the spec only mentions ";" comments to be available in Script Info so that is all that is implemented here. The existing functionality of ignoring lines starting with ";" in other sections is maintained.

Note that while this retains the order of the comments, it will always put them in their customary position at the beginning of the Script Info, before any of the fields, rather than tracking any position they could have interleaved between the field lines. This means they can't be used as comments for particular fields, but I don't think that was ever an intended use case of these comments anyway.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant