{{ from applications.OZtree.modules.embed import media_embed from applications.OZtree.modules.markdown import markdown ts_classes = ( # CSS classes that can be added to template_data as boolean properties 'visible-transition_in', 'visible-transition_in_wait', 'visible-transition_out', 'visible-transition_out_wait', 'visible-active_wait', 'hidden-active_wait', ) tour_props = ( # Data properties that can be added to tour data ('author', False), ('license', False), ('title', True), ('description', True), ('image_url', False), ('keywords', False), ) ts_props = ( # Data properties that can be added to tourstop data 'ott', 'qs_opts', 'transition_in', 'fly_in_speed', 'transition_in_wait', 'stop_wait', 'stop_wait_after_backward', ) ts_fields = ( # HTML fields that can be added to container # NB: 'title' will be added to header ('window_text', 'div'), ('author', 'div'), ('checked_by', 'div'), ) }} {{T.set_current_languages((tour['lang'],))}}
{{for ts_idx, ts in enumerate(tour['tourstops']):}} {{tdata = ts['template_data']}} {{if tdata.get('class', '') and not tdata['class'].isalnum():}}{{pass}} {{T.set_current_languages((ts['lang'],))}}
{{if tdata.get('title', ''):}}

{{=tdata['title']}}

{{pass}}
{{for k, tag in ts_fields:}}{{if tdata.get(k, ''):}}{{for value in tdata[k] if isinstance(tdata[k], list) else [tdata[k]]:}} {{content_dict = value if isinstance(value, dict) else dict(text=value)}} <{{=tag}} class="{{=k}} {{=' '.join(key for key, value in content_dict.items() if value is True)}}" >{{=XML(markdown(content_dict['text']))}}{{pass}}{{pass}}{{pass}} {{if len(tdata.get('media', [])) > 0:}}{{for url in tdata['media']:}} {{=XML(media_embed(url, defaults=dict(ts_autoplay='tsstate-active_wait', url_base=tours_url_base)))}} {{pass}}{{pass}}
{{pass}}