The battle is harder and harder, seven failures to go.
This commit is contained in:
parent
d50b4a0967
commit
bcc29d65cf
|
@ -25,19 +25,27 @@ class TextoutLinkTag(TextoutRawInlineTag):
|
|||
raise Exception("No allowed prefix!")
|
||||
|
||||
def prepare(self, name, value):
|
||||
self.url = None
|
||||
|
||||
# If there is no value, wait until we have a content to
|
||||
# decide if we are valid or not.
|
||||
if value == None:
|
||||
self.preprocess = self._preprocess_if_no_value
|
||||
return
|
||||
|
||||
# Otherwise, get the URL and validate.
|
||||
self.url = value
|
||||
self._validate()
|
||||
|
||||
def _preprocess_if_no_value(self, cin):
|
||||
self.url = cin.read()
|
||||
self._validate()
|
||||
def preprocess(self, cin):
|
||||
content = cin.read()
|
||||
|
||||
if not self.url:
|
||||
self.url = content
|
||||
self._validate()
|
||||
if not content:
|
||||
content = self.url
|
||||
|
||||
return content
|
||||
|
||||
def end_text(self):
|
||||
return ' (voir "{}")'.format(self.value)
|
||||
|
|
|
@ -62,17 +62,13 @@ class TextoutTag:
|
|||
if hasattr(self, 'prepare'):
|
||||
self.prepare(name, value)
|
||||
|
||||
if not hasattr(self, 'begin') \
|
||||
and hasattr(self, 'begin_' + ot):
|
||||
if hasattr(self, 'begin_' + ot):
|
||||
self.begin = getattr(self, 'begin_' + ot)
|
||||
if not hasattr(self, 'end') \
|
||||
and hasattr(self, 'end_' + ot):
|
||||
if hasattr(self, 'end_' + ot):
|
||||
self.end = getattr(self, 'end_' + ot)
|
||||
if not hasattr(self, 'process') \
|
||||
and hasattr(self, 'process_' + ot):
|
||||
if hasattr(self, 'process_' + ot):
|
||||
self.process = getattr(self, 'process_' + ot)
|
||||
if not hasattr(self, 'preprocess') \
|
||||
and hasattr(self, 'preprocess_' + ot):
|
||||
if hasattr(self, 'preprocess_' + ot):
|
||||
self.preprocess = getattr(self, 'preprocess_' + ot)
|
||||
|
||||
# ---
|
||||
|
|
|
@ -352,7 +352,7 @@ class Translator:
|
|||
# We ought to
|
||||
|
||||
pos = -1
|
||||
if not tagdata.name:
|
||||
if tagdata.name == "[]":
|
||||
# Generic closing tag [/] management.
|
||||
# `pos` is set to 0 here.
|
||||
if self.queue:
|
||||
|
|
Loading…
Reference in New Issue