Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to selectively remove styles from source files during merge #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yonkoma
Copy link

@yonkoma yonkoma commented Jul 29, 2021

No description provided.

@Myaamori
Copy link
Owner

Myaamori commented Aug 6, 2021

I've been meaning to add an option to remove unused styles, which I think could be combined with this change. E.g. there could be an enum similar to OnNegativeTimestamp where you can choose to either leave styles as is, remove unused styles, or remove all styles.

The question, though, is whether to keep it at the top level or in the merge specification. For removing unused styles, it's likely that the top level is more appropriate, while when removing all styles, you probably want to do it for individual files. Would you mind describing what your use case is, exactly? Is it possible that just removing all unused styles would satisfy it?

I was planning on implementing removing unused styles myself at some point, but if you're interested in looking at it for this PR, it should be easy enough by filtering dialogue lines to select uncommented ones, mapping to the name of the style, and then using toSet to get a set of used styles, after which you can remove all styles not present in that set.

P.S. It would be better if you refrained from updating the documentation with this pull request, as that will break all links unless I change the current version tag.

@yonkoma
Copy link
Author

yonkoma commented Aug 6, 2021

The use case for which I did this is editing an existing subtitle file, with styles that we aren't using. We have the styles in a separate common file, and have some issues with conflicting styles. I did set style conflicts to fail, and also make a local task to achieve this, but this would be easier and cleaner.
As far as I can tell the use cases are separate, and both are worth implementing.

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.

2 participants