/[opental]/opental/OpenTAL/tal_handler.py
ViewVC logotype

Diff of /opental/OpenTAL/tal_handler.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.27 by lalo, Mon Jan 27 19:50:36 2003 UTC revision 1.28 by lalo, Thu Jan 30 16:32:27 2003 UTC
# Line 170  def compile_define(element, context, val Line 170  def compile_define(element, context, val
170      for item in split_multiple(value):      for item in split_multiple(value):
171          scope, expr = split_spec(item, 'local', 'global')          scope, expr = split_spec(item, 'local', 'global')
172    
173    
174          name, expr = expr.split(None, 1)          name, expr = expr.split(None, 1)
175          data.append((scope=='global', name, context.compile(expr)))          data.append((scope=='global', name, context.compile(expr)))
176      return data      return data
# Line 204  def compile_omit_tag(element, context, v Line 205  def compile_omit_tag(element, context, v
205  #def compile_tal_start(element, context):  #def compile_tal_start(element, context):
206  #    return element  #    return element
207    
208  #def compile_tal_finish(element, context):  def compile_tal_finish(element, context):
209  #    return element      # handle configuration <tal:config prop="value" />
210        if getattr(element, 'ns', None) == tal_ns and element.name == 'config':
211            if not hasattr(context, 'tal_configuration'):
212                context.tal_configuration = {}
213            conf = context.tal_configuration
214            for property, value in element.attributes[tal_ns].items():
215                value = [sub.strip().replace(';;', ';') for sub in multiple_re.split(value)]
216                if len(value) == 1:
217                    value = value[0]
218                elif len(value) > 1 and not value[-1].strip():
219                    del value[-1] # It ended in a semicolon
220                conf[property] = value
221            # remove it from the compiled tree
222            return None
223        return element
224    
225    
226  tal_compiler = AttributeCompiler('tal', tal_ns)  tal_compiler = AttributeCompiler('tal', tal_ns)
# Line 218  tal_compiler.add_handler('replace', comp Line 233  tal_compiler.add_handler('replace', comp
233  tal_compiler.add_handler('attributes', compile_attributes)  tal_compiler.add_handler('attributes', compile_attributes)
234  tal_compiler.add_handler('omit-tag', compile_omit_tag)  tal_compiler.add_handler('omit-tag', compile_omit_tag)
235  #tal_compiler.preprocess = compile_tal_start  #tal_compiler.preprocess = compile_tal_start
236  #tal_compiler.postprocess = compile_tal_finish  tal_compiler.postprocess = compile_tal_finish
237    
238    
239  __all__ = ('tal_handler', 'tal_compiler')  __all__ = ('tal_handler', 'tal_compiler')

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26