From f162d1b94c7f58517c7ba6434bbb6c460f8a5c72 Mon Sep 17 00:00:00 2001 From: "Thomas \"Cakeisalie5\" Touhey" Date: Thu, 26 Jul 2018 23:40:19 +0200 Subject: [PATCH] Corrected the [quote][show][justify]hehe problem, still problems to go --- textoutpc/translate.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/textoutpc/translate.py b/textoutpc/translate.py index 7263704..931a01b 100755 --- a/textoutpc/translate.py +++ b/textoutpc/translate.py @@ -279,18 +279,18 @@ class Translator: dat.last = True continue - # Add the content to the preprocess buffer. - - if not dat.raw: - text = process_func(text) - dat.last += text - # Start the tags if we're about to give this content to # preprocessing. if start_tags: self.start_tags() + # Add the content to the preprocess buffer. + + if not dat.raw: + text = process_func(text) + dat.last += text + break else: # No `break` has been encountered, which means the content has @@ -311,14 +311,15 @@ class Translator: self.outp.write(message) - def put_code(self, code, start_tags = True, + def put_code(self, code, start_tags = True, flush_text = True, superblocks_only = True, next_block_is_super = False): """ Put some code. """ # We don't want to mix text and code, so we'll flush to be sure that # the order doesn't get mixed up. - self.flush_text() + if flush_text: + self.flush_text() # First of all, check if the text is empty or if we want to ignore it. @@ -559,7 +560,7 @@ class Translator: continue if hasattr(dat.tag, 'end'): - self.put_code(dat.tag.end(), False) + self.put_code(dat.tag.end(), start_tags = False) dat.started = False dat.reset() @@ -571,7 +572,8 @@ class Translator: continue if hasattr(dat.tag, 'begin'): - self.put_code(dat.tag.begin(), False) + self.put_code(dat.tag.begin(), start_tags = False, + flush_text = False) dat.started = True def close_inline_tags(self): @@ -585,7 +587,7 @@ class Translator: continue if hasattr(dat.tag, 'end'): - self.put_code(dat.tag.end(), False) + self.put_code(dat.tag.end(), start_tags = False) dat.started = False dat.reset()