lp-schedule.jinja2 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. {# -*- mode: jinja2; -*- #}
  2. {#
  3. Copyright (C) 2015-2016 lpschedule-generator contributors. See CONTRIBUTORS.
  4. This file is part of lpschedule-generator.
  5. lpschedule-generator is free software: you can redistribute it
  6. and/or modify it under the terms of the GNU General Public License
  7. as published by the Free Software Foundation, either version 3 of
  8. the License, or (at your option) any later version.
  9. lpschedule-generator is distributed in the hope that it will be useful, but
  10. WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with lpschedule-generator (see COPYING). If not, see
  15. <http://www.gnu.org/licenses/>.
  16. #}
  17. {# macros start #}
  18. {# make speakers macro #}
  19. {% macro mk_speakers(speakers) %}
  20. {% if speakers[0]|lower != 'speakertba' %}
  21. <span class="program-session-speaker">
  22. {% for speaker in speakers %}
  23. {% if loop.last %}
  24. {{ speaker }}
  25. {% else %}
  26. {{ speaker }},
  27. {% endif %}
  28. {% endfor %}
  29. </span>
  30. {% endif %}
  31. {% endmacro %}
  32. {# make room macro #}
  33. {% macro mk_room(room) %}
  34. {% if room|lower != 'roomtba' %}
  35. <span class="room label label-default">{{ room }}</span>
  36. {% endif %}
  37. {% endmacro %}
  38. {# make day header macro #}
  39. {% macro mk_day_header(day, collapse_area) %}
  40. {% if day|trim != '' %}
  41. <header class="program-day-header">
  42. <hgroup>
  43. <h2>{{ day }}</h2>
  44. </hgroup>
  45. </header>
  46. {% endif %}
  47. {% endmacro %}
  48. {# make timeslot header macro #}
  49. {% macro mk_timeslot_header(timeslot, collapse, collapse_area='') %}
  50. {% if timeslot|trim != '' %}
  51. <header class="program-timeslot-header">
  52. <hgroup>
  53. <h2>{{ timeslot }}</h2>
  54. </hgroup>
  55. </header>
  56. {% endif %}
  57. {% endmacro %}
  58. {# make session header macro #}
  59. {% macro mk_session_header(session) %}
  60. <header class="program-session-header">
  61. <hgroup>
  62. <h2>{{ session }}</h2>
  63. </hgroup>
  64. </header>
  65. {% endmacro %}
  66. {# desc macro #}
  67. {% macro desc(disc_list) %}
  68. {% for desc_p in disc_list %}
  69. <p>{{ desc_p }}</p>
  70. {% endfor %}
  71. {% endmacro %}
  72. {# populate sessions macro #}
  73. {% macro populate_sessions(sessions, day_index, timeslot_index) %}
  74. {% for session, session_info in sessions.iteritems() %} {# session start #}
  75. <section id="day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}" class="program-session">
  76. {{ mk_session_header(session) }}
  77. {{ mk_speakers(session_info['speakers']) }}
  78. <p class="program-session-room-details">
  79. {{ mk_room(session_info['room']) }}
  80. {% if session_info['desc'][0]|lower == 'desctba' %}
  81. </p>
  82. {% else %}
  83. <button class="btn btn-default btn-xs"
  84. data-toggle="collapse" aria-expanded="false"
  85. aria-controls="day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}-collapse"
  86. data-target="#day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}-collapse">
  87. Details
  88. </button>
  89. </p>
  90. <div class="session-desc collapse in"
  91. id="day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}-collapse">
  92. {{ desc(session_info['desc']) }}
  93. </div> <!-- day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}-collapse end -->
  94. {% endif %}
  95. </section> <!-- day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }} end -->
  96. {% endfor %} {# session end #}
  97. {% endmacro %}
  98. {# populate timeslots macro #}
  99. {% macro populate_timeslots(timeslots, day_index) %}
  100. {% for timeslot, sessions in timeslots.iteritems() %} {# timeslot start #}
  101. <article id="day-{{ day_index }}-timeslot-{{ loop.index }}" class="program-timeslot">
  102. {{ mk_timeslot_header(timeslot) }}
  103. {% if sessions|length > 0 %}
  104. {{ populate_sessions(sessions, day_index, loop.index) }}
  105. {% endif %}
  106. </article> <!-- day-{{ day_index }}-timeslot-{{ loop.index }} end -->
  107. {% endfor %} {# timeslot start #}
  108. {% endmacro %}
  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 #}