aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas "Cakeisalie5" Touhey <thomas@touhey.fr>2018-07-26 23:40:19 +0200
committerThomas "Cakeisalie5" Touhey <thomas@touhey.fr>2018-07-26 23:40:19 +0200
commitf162d1b94c7f58517c7ba6434bbb6c460f8a5c72 (patch)
tree584708fbf3d5f7442c20458905efb2c03f260bb1
parentf4ee519eb3acd16246f5a44d769d7b4d88599393 (diff)
Corrected the [quote][show][justify]hehe problem, still problems to go
-rwxr-xr-xtextoutpc/translate.py24
1 files 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()