lpschedule-generator

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

commit ddd7c33e8e488ebfb163cef2ebd2ef6cbc9f6dc0
parent faf6829a09cde3319c802ec3c0bda75855cb7cda
Author: rsiddharth <rsd@gnu.org>
Date:   Wed, 11 May 2016 04:10:07 +0000

Add `DescTBA` feature for LP Schedule.

From now on `DescTBA` can be given if the description for a session is
not decided yet; `DescTBA` will be filtered out of the generated HTML.

Addresses issue #4.

Diffstat:
libreplanet-templates/2016/lp-schedule.jinja2 | 26+++++++++++++++-----------
tests/test_lps_gen.py | 25+++++++++++++++++++++++++
2 files changed, 40 insertions(+), 11 deletions(-)

diff --git a/libreplanet-templates/2016/lp-schedule.jinja2 b/libreplanet-templates/2016/lp-schedule.jinja2 @@ -89,17 +89,21 @@ {{ mk_speakers(session_info['speakers']) }} <p class="program-session-room-details"> {{ mk_room(session_info['room']) }} - <button class="btn btn-default btn-xs" - data-toggle="collapse" aria-expanded="false" - aria-controls="day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}-collapse" - data-target="#day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}-collapse"> - Details - </button> - </p> - <div class="collapse in" - id="day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}-collapse"> - {{ desc(session_info['desc']) }} - </div> <!-- day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}-collapse end --> + {% if session_info['desc'][0]|lower == 'desctba' %} + </p> + {% else %} + <button class="btn btn-default btn-xs" + data-toggle="collapse" aria-expanded="false" + aria-controls="day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}-collapse" + data-target="#day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}-collapse"> + Details + </button> + </p> + <div class="session-desc collapse in" + id="day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}-collapse"> + {{ desc(session_info['desc']) }} + </div> <!-- day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}-collapse end --> + {% endif %} </section> <!-- day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }} end --> {% endfor %} {# session end #} {% endmacro %} diff --git a/tests/test_lps_gen.py b/tests/test_lps_gen.py @@ -553,6 +553,10 @@ class TestLPSTBA(object): if len(s.strip())]) + def cleanup_desc(self, desc): + return desc.replace('\n', '').strip() + + def test_LP_speakers(self): """Tests the non-existence of `SpeakerTBA` in gen. HTML. @@ -589,6 +593,27 @@ class TestLPSTBA(object): assert_equal(room_block, rooms.pop(0)) + def test_LP_description(self): + """Tests the non-existence of `DescTBA` in gen. HTML. + """ + descriptions = [ + 'Your workplace can exert a lot of control over how', + 'Free software developers and users tend to be most', + 'This talk will help you gather information, frame', + 'A look back at free software history', + 'Academic Institutions and their researchers', + 'At CUNY, we have taken steps to change this', + 'Being a free software user isn\'t easy,', + 'In this session, I\'ll give students tips', + ] + + for descs in self.soup.find_all(class_='session-desc'): + for desc in descs.strings: + desc = self.cleanup_desc(desc) + if desc: + assert desc.startswith(descriptions.pop(0)) + + def teardown(self): """Cleans up things after each test in this class.