From 9b23c76a1e2aec0863aab153056a336de5ebc243 Mon Sep 17 00:00:00 2001 From: sorz Date: Mon, 25 Aug 2014 16:15:03 +0800 Subject: [PATCH] Refactor --- asstosrt/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/asstosrt/__init__.py b/asstosrt/__init__.py index 3fc5e17..43a8b04 100644 --- a/asstosrt/__init__.py +++ b/asstosrt/__init__.py @@ -78,7 +78,7 @@ def __unicode__(self): def _preprocess_line(line): """Remove line endings and comments.""" line = line.strip() - if line.startswith(';') | line.endswith('{\p0}'): + if line.startswith(';'): return '' else: return line @@ -124,6 +124,8 @@ def convert(file, translator=None, no_effect=False, only_first_line=False): if no_effect: if dialogue.get('effect', ''): continue + if dialogue['text'].endswith('{\p0}'): # TODO: Exact match drawing commands. + continue text = ''.join(_REG_CMD.split(dialogue['text'])) # Remove commands. text = text.replace(r'\N', '\r\n').replace(r'\n', '\r\n')