lpschedule-generator

libreplanet schedule generator - ricketyspace.net/lpschedule-generator
git clone git://git.ricketyspace.net/lpschedule-generator.git
Log | Files | Refs

lp-schedule.jinja2 (3865B)


      1 {# -*- mode: jinja2; -*- #}
      2 {#
      3     SPDX-License-Identifier: CC0-1.0
      4 
      5     This file is part of lpschedule-generator.
      6 #}
      7 
      8 {# macros start #}
      9 
     10 {# make speakers macro #}
     11 {% macro mk_speakers(speakers) %}
     12   {% if speakers[0]|lower != 'speakertba' %}
     13     <span class="program-session-speaker">
     14       {% for speaker in speakers %}
     15         {% if loop.last %}
     16           {{ speaker }}
     17         {% else %}
     18           {{ speaker }},
     19         {% endif %}
     20       {% endfor %}
     21     </span>
     22   {% endif %}
     23 {% endmacro %}
     24 
     25 {# make room macro #}
     26 {% macro mk_room(room) %}
     27   {% if room|lower != 'roomtba' %}
     28     <span class="room label label-default">{{ room }}</span>
     29   {% endif %}
     30 {% endmacro %}
     31 
     32 {# make day header macro #}
     33 {% macro mk_day_header(day, collapse_area) %}
     34   {% if day|trim != '' %}
     35     <header class="program-day-header">
     36       <hgroup>
     37         <h2>{{ day }}</h2>
     38       </hgroup>
     39     </header>
     40   {% endif %}
     41 {% endmacro %}
     42 
     43 {# make timeslot header macro #}
     44 {% macro mk_timeslot_header(timeslot, collapse, collapse_area='') %}
     45   {% if timeslot|trim != '' %}
     46     <header class="program-timeslot-header">
     47       <hgroup>
     48         <h2>{{ timeslot }}</h2>
     49       </hgroup>
     50     </header>
     51   {% endif %}
     52 {% endmacro %}
     53 
     54 {# make session header macro #}
     55 {% macro mk_session_header(session) %}
     56   <header class="program-session-header">
     57     <hgroup>
     58       <h2>{{ session }}</h2>
     59     </hgroup>
     60   </header>
     61 {% endmacro %}
     62 
     63 {# desc macro #}
     64 {% macro desc(disc_list) %}
     65   {% for desc_p in disc_list %}
     66     <p>{{ desc_p }}</p>
     67   {% endfor %}
     68 {% endmacro %}
     69 
     70 {# populate sessions macro #}
     71 {% macro populate_sessions(sessions, day_index, timeslot_index) %}
     72   {% for session, session_info in sessions.iteritems() %} {# session start #}
     73     <section id="day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}" class="program-session">
     74       {{ mk_session_header(session) }}
     75       {{ mk_speakers(session_info['speakers']) }}
     76       <p class="program-session-room-details">
     77         {{ mk_room(session_info['room']) }}
     78         {% if session_info['desc'][0]|lower == 'desctba' %}
     79           </p>
     80         {% else %}
     81           <button class="btn btn-default btn-xs"
     82                   data-toggle="collapse" aria-expanded="false"
     83                   aria-controls="day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}-collapse"
     84                   data-target="#day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}-collapse">
     85                   Details
     86           </button>
     87           </p>
     88           <div class="session-desc collapse in"
     89                id="day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}-collapse">
     90                {{ desc(session_info['desc']) }}
     91           </div> <!-- day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}-collapse end -->
     92         {% endif %}
     93     </section> <!-- day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }} end -->
     94   {% endfor %} {# session end #}
     95 {% endmacro %}
     96 
     97 {# populate timeslots macro #}
     98 {% macro populate_timeslots(timeslots, day_index) %}
     99   {% for timeslot, sessions in timeslots.iteritems() %}  {# timeslot start #}
    100     <article id="day-{{ day_index }}-timeslot-{{ loop.index }}" class="program-timeslot">
    101       {{ mk_timeslot_header(timeslot) }}
    102       {% if sessions|length > 0 %}
    103              {{ populate_sessions(sessions, day_index, loop.index) }}
    104       {% endif %}
    105     </article> <!-- day-{{ day_index }}-timeslot-{{ loop.index }} end -->
    106   {% endfor %} {# timeslot start #}
    107 {% endmacro %}
    108 
    109 {# lp schedule 2016 template start #}
    110 {% for day, timeslots in lp_dict.iteritems() %} {# day start #}
    111   <article id="day-{{ loop.index }}-program" class="program-day">
    112     {{ mk_day_header(day) }}
    113       {{ populate_timeslots(timeslots, loop.index) }}
    114   </article> <!-- day-{{ loop.index }} end -->
    115 {% endfor %} {# day loop end #}