From 4d2309123cef988d6e52d388b87c29b53d1ff247 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Sat, 13 Feb 2016 21:32:06 -0500 Subject: Templates are now at /libreplanet-templates/ --- README.rst | 6 +- libreplanet-templates/2016/lp-schedule.jinja2 | 123 +++++++++++++++++++++++++ libreplanet-templates/2016/lp-speakers.jinja2 | 124 ++++++++++++++++++++++++++ tests/files/lp-sch-2016.jinja2 | 123 ------------------------- tests/files/lp-speakers-2016.jinja2 | 124 -------------------------- tests/test_lps_gen.py | 16 ++-- 6 files changed, 258 insertions(+), 258 deletions(-) create mode 100644 libreplanet-templates/2016/lp-schedule.jinja2 create mode 100644 libreplanet-templates/2016/lp-speakers.jinja2 delete mode 100644 tests/files/lp-sch-2016.jinja2 delete mode 100644 tests/files/lp-speakers-2016.jinja2 diff --git a/README.rst b/README.rst index c641396..d74b6ba 100644 --- a/README.rst +++ b/README.rst @@ -53,7 +53,7 @@ LP schedule usage or:: - $ lps_gen --schedule path/to/lp-sch.jinja2 path/to/lp-sch.md > path/to/program-schedule.html + $ lps_gen --schedule path/to/lp-schedule.jinja2 path/to/lp-sch.md > path/to/program-schedule.html LP schedule markdown structure @@ -178,11 +178,11 @@ LP speakers usage ~~~~~~~~~~~~~~~~~ :: - $ lps_gen -sp path/to/lp-speakers-2016.jinja2 path/to/lp-speakers.md > path/to/speakers-content.html + $ lps_gen -sp path/to/lp-speakers.jinja2 path/to/lp-speakers.md > path/to/speakers-content.html or:: - $ lps_gen --speakers path/to/lp-speakers-2016.jinja2 path/to/lp-speakers.md > path/to/speakers-content.html + $ lps_gen --speakers path/to/lp-speakers.jinja2 path/to/lp-speakers.md > path/to/speakers-content.html LP speakers markdown structure `````````````````````````````` diff --git a/libreplanet-templates/2016/lp-schedule.jinja2 b/libreplanet-templates/2016/lp-schedule.jinja2 new file mode 100644 index 0000000..0f0e372 --- /dev/null +++ b/libreplanet-templates/2016/lp-schedule.jinja2 @@ -0,0 +1,123 @@ +{# -*- mode: jinja2; -*- #} +{# + Copyright (C) 2015 lpschedule-generator contributors. See CONTRIBUTORS. + + This file is part of lpschedule-generator. + + lpschedule-generator is free software: you can redistribute it + and/or modify it under the terms of the GNU General Public License + as published by the Free Software Foundation, either version 3 of + the License, or (at your option) any later version. + + lpschedule-generator is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with lpschedule-generator (see COPYING). If not, see + . +#} + +{# macros start #} + +{# make speakers macro #} +{% macro mk_speakers(speakers) %} + + {% for speaker in speakers %} + {% if loop.last %} + {{ speaker }} + {% else %} + {{ speaker }}, + {% endif %} + {% endfor %} + +{% endmacro %} + +{# make room macro #} +{% macro mk_room(room) %} + {% if room|lower != 'roomtba' %} + {{ room }} + {% endif %} +{% endmacro %} + +{# make day header macro #} +{% macro mk_day_header(day, collapse_area) %} + {% if day|trim != '' %} +
+
+

{{ day }}

+
+
+ {% endif %} +{% endmacro %} + +{# make timeslot header macro #} +{% macro mk_timeslot_header(timeslot, collapse, collapse_area='') %} + {% if timeslot|trim != '' %} +
+
+

{{ timeslot }}

+
+
+ {% endif %} +{% endmacro %} + +{# make session header macro #} +{% macro mk_session_header(session) %} +
+
+

{{ session }}

+
+
+{% endmacro %} + +{# desc macro #} +{% macro desc(disc_list) %} + {% for desc_p in disc_list %} +

{{ desc_p }}

+ {% endfor %} +{% endmacro %} + +{# populate sessions macro #} +{% macro populate_sessions(sessions, day_index, timeslot_index) %} + {% for session, session_info in sessions.iteritems() %} {# session start #} +
+ {{ mk_session_header(session) }} + {{ mk_speakers(session_info['speakers']) }} +

+ {{ mk_room(session_info['room']) }} + +

+
+ {{ desc(session_info['desc']) }} +
+
+ {% endfor %} {# session end #} +{% endmacro %} + +{# populate timeslots macro #} +{% macro populate_timeslots(timeslots, day_index) %} + {% for timeslot, sessions in timeslots.iteritems() %} {# timeslot start #} +
+ {{ mk_timeslot_header(timeslot) }} + {% if sessions|length > 0 %} + {{ populate_sessions(sessions, day_index, loop.index) }} + {% endif %} +
+ {% endfor %} {# timeslot start #} +{% endmacro %} + +{# lp schedule 2016 template start #} +{% for day, timeslots in lp_dict.iteritems() %} {# day start #} +
+ {{ mk_day_header(day) }} + {{ populate_timeslots(timeslots, loop.index) }} +
+{% endfor %} {# day loop end #} diff --git a/libreplanet-templates/2016/lp-speakers.jinja2 b/libreplanet-templates/2016/lp-speakers.jinja2 new file mode 100644 index 0000000..5c1c132 --- /dev/null +++ b/libreplanet-templates/2016/lp-speakers.jinja2 @@ -0,0 +1,124 @@ +{# -*- mode: jinja2; -*- #} +{# + Copyright (C) 2016 lpschedule-generator contributors. See CONTRIBUTORS. + + This file is part of lpschedule-generator. + + lpschedule-generator is free software: you can redistribute it + and/or modify it under the terms of the GNU General Public License + as published by the Free Software Foundation, either version 3 of + the License, or (at your option) any later version. + + lpschedule-generator is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with lpschedule-generator (see COPYING). If not, see + . +#} + + +{# make speakers header macro #} +{% macro mk_speakers_header(speaker_type) %} +
+
+ {% if speaker_type == 'keynote-speakers' %} +

Keynote speakers

+ {% else %} +

Speakers

+ {% endif %} +
+
+{% endmacro %} + +{# make keynote speaker header macro #} +{% macro mk_keynote_speaker_header(speaker, id) %} +
+
+

{{ speaker }}

+
+
+{% endmacro %} + +{# make speaker header macro #} +{% macro mk_speaker_header(speaker, id) %} +
+
+

{{ speaker }}

+
+
+{% endmacro %} + +{# make bio macro #} +{% macro mk_bio(bio_list) %} + {% for bio_p in bio_list %} +

{{ bio_p }}

+ {% endfor %} +{% endmacro %} + +{# populate keynote speakers macro #} +{% macro populate_keynote_speakers(speakers) %} + {% for speaker in speakers %} +
+ +
+ {% if speaker.img_url %} + +
+ [ {{ speaker.img_alt }} ] +
+ +
+ {% else %} + +
+ {% endif %} + {{ mk_keynote_speaker_header(speaker.speaker, speaker.id) }} + {{ mk_bio(speaker.bio) }} +
+
+
+ {% endfor %} +{% endmacro %} + +{# populate speakers macro #} +{% macro populate_speakers(speakers) %} + {% for speaker in speakers %} +
+
+ {% if speaker.img_url %} + +
+ [ {{ speaker.img_alt }} ] +
+ +
+ {% else %} + +
+ {% endif %} + {{ mk_speaker_header(speaker.speaker, speaker.id) }} + {{ mk_bio(speaker.bio) }} +
+
+
+ {% endfor %} +{% endmacro %} + +{# lp speakers 2016 template start #} +{% for speaker_type, speakers in lp_dict.iteritems() %} +
+ {% if speaker_type == 'keynote-speakers' %} + {{ mk_speakers_header(speaker_type) }} + {{ populate_keynote_speakers(speakers) }} + {% elif speaker_type == 'speakers' %} + {{ mk_speakers_header(speaker_type) }} + {{ populate_speakers(speakers) }} + {% endif %} +
+{% endfor %} +{# lp speakers 2016 template end #} diff --git a/tests/files/lp-sch-2016.jinja2 b/tests/files/lp-sch-2016.jinja2 deleted file mode 100644 index 0f0e372..0000000 --- a/tests/files/lp-sch-2016.jinja2 +++ /dev/null @@ -1,123 +0,0 @@ -{# -*- mode: jinja2; -*- #} -{# - Copyright (C) 2015 lpschedule-generator contributors. See CONTRIBUTORS. - - This file is part of lpschedule-generator. - - lpschedule-generator is free software: you can redistribute it - and/or modify it under the terms of the GNU General Public License - as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. - - lpschedule-generator is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with lpschedule-generator (see COPYING). If not, see - . -#} - -{# macros start #} - -{# make speakers macro #} -{% macro mk_speakers(speakers) %} - - {% for speaker in speakers %} - {% if loop.last %} - {{ speaker }} - {% else %} - {{ speaker }}, - {% endif %} - {% endfor %} - -{% endmacro %} - -{# make room macro #} -{% macro mk_room(room) %} - {% if room|lower != 'roomtba' %} - {{ room }} - {% endif %} -{% endmacro %} - -{# make day header macro #} -{% macro mk_day_header(day, collapse_area) %} - {% if day|trim != '' %} -
-
-

{{ day }}

-
-
- {% endif %} -{% endmacro %} - -{# make timeslot header macro #} -{% macro mk_timeslot_header(timeslot, collapse, collapse_area='') %} - {% if timeslot|trim != '' %} -
-
-

{{ timeslot }}

-
-
- {% endif %} -{% endmacro %} - -{# make session header macro #} -{% macro mk_session_header(session) %} -
-
-

{{ session }}

-
-
-{% endmacro %} - -{# desc macro #} -{% macro desc(disc_list) %} - {% for desc_p in disc_list %} -

{{ desc_p }}

- {% endfor %} -{% endmacro %} - -{# populate sessions macro #} -{% macro populate_sessions(sessions, day_index, timeslot_index) %} - {% for session, session_info in sessions.iteritems() %} {# session start #} -
- {{ mk_session_header(session) }} - {{ mk_speakers(session_info['speakers']) }} -

- {{ mk_room(session_info['room']) }} - -

-
- {{ desc(session_info['desc']) }} -
-
- {% endfor %} {# session end #} -{% endmacro %} - -{# populate timeslots macro #} -{% macro populate_timeslots(timeslots, day_index) %} - {% for timeslot, sessions in timeslots.iteritems() %} {# timeslot start #} -
- {{ mk_timeslot_header(timeslot) }} - {% if sessions|length > 0 %} - {{ populate_sessions(sessions, day_index, loop.index) }} - {% endif %} -
- {% endfor %} {# timeslot start #} -{% endmacro %} - -{# lp schedule 2016 template start #} -{% for day, timeslots in lp_dict.iteritems() %} {# day start #} -
- {{ mk_day_header(day) }} - {{ populate_timeslots(timeslots, loop.index) }} -
-{% endfor %} {# day loop end #} diff --git a/tests/files/lp-speakers-2016.jinja2 b/tests/files/lp-speakers-2016.jinja2 deleted file mode 100644 index 5c1c132..0000000 --- a/tests/files/lp-speakers-2016.jinja2 +++ /dev/null @@ -1,124 +0,0 @@ -{# -*- mode: jinja2; -*- #} -{# - Copyright (C) 2016 lpschedule-generator contributors. See CONTRIBUTORS. - - This file is part of lpschedule-generator. - - lpschedule-generator is free software: you can redistribute it - and/or modify it under the terms of the GNU General Public License - as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. - - lpschedule-generator is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with lpschedule-generator (see COPYING). If not, see - . -#} - - -{# make speakers header macro #} -{% macro mk_speakers_header(speaker_type) %} -
-
- {% if speaker_type == 'keynote-speakers' %} -

Keynote speakers

- {% else %} -

Speakers

- {% endif %} -
-
-{% endmacro %} - -{# make keynote speaker header macro #} -{% macro mk_keynote_speaker_header(speaker, id) %} -
-
-

{{ speaker }}

-
-
-{% endmacro %} - -{# make speaker header macro #} -{% macro mk_speaker_header(speaker, id) %} -
-
-

{{ speaker }}

-
-
-{% endmacro %} - -{# make bio macro #} -{% macro mk_bio(bio_list) %} - {% for bio_p in bio_list %} -

{{ bio_p }}

- {% endfor %} -{% endmacro %} - -{# populate keynote speakers macro #} -{% macro populate_keynote_speakers(speakers) %} - {% for speaker in speakers %} -
- -
- {% if speaker.img_url %} - -
- [ {{ speaker.img_alt }} ] -
- -
- {% else %} - -
- {% endif %} - {{ mk_keynote_speaker_header(speaker.speaker, speaker.id) }} - {{ mk_bio(speaker.bio) }} -
-
-
- {% endfor %} -{% endmacro %} - -{# populate speakers macro #} -{% macro populate_speakers(speakers) %} - {% for speaker in speakers %} -
-
- {% if speaker.img_url %} - -
- [ {{ speaker.img_alt }} ] -
- -
- {% else %} - -
- {% endif %} - {{ mk_speaker_header(speaker.speaker, speaker.id) }} - {{ mk_bio(speaker.bio) }} -
-
-
- {% endfor %} -{% endmacro %} - -{# lp speakers 2016 template start #} -{% for speaker_type, speakers in lp_dict.iteritems() %} -
- {% if speaker_type == 'keynote-speakers' %} - {{ mk_speakers_header(speaker_type) }} - {{ populate_keynote_speakers(speakers) }} - {% elif speaker_type == 'speakers' %} - {{ mk_speakers_header(speaker_type) }} - {{ populate_speakers(speakers) }} - {% endif %} -
-{% endfor %} -{# lp speakers 2016 template end #} diff --git a/tests/test_lps_gen.py b/tests/test_lps_gen.py index 7fc0e75..7149066 100644 --- a/tests/test_lps_gen.py +++ b/tests/test_lps_gen.py @@ -125,8 +125,8 @@ class TestLPS(object): self.MD_FILE = path.join('files', 'lp-sch.md') self.MD_FILE_CONTENT = read_file(self.MD_FILE) - self.SCH_TEMPLATE = path.join('files', - 'lp-sch-2016.jinja2') + self.SCH_TEMPLATE = path.join('..', 'libreplanet-templates/2016', + 'lp-schedule.jinja2') self.markdown = LPSMarkdown() self.lps_dict = self.markdown(self.MD_FILE_CONTENT) @@ -304,8 +304,8 @@ class TestLPSpeakers(object): self.MD_FILE = path.join('files', 'lp-speakers.md') self.MD_FILE_CONTENT = read_file(self.MD_FILE) - self.SPEAKERS_TEMPLATE = path.join('files', - 'lp-speakers-2016.jinja2') + self.SPEAKERS_TEMPLATE = path.join('..', 'libreplanet-templates/2016', + 'lp-speakers.jinja2') self.markdown = LPSpeakersMarkdown() self.lpspeakers_dict = self.markdown(self.MD_FILE_CONTENT) @@ -579,13 +579,13 @@ class TestSpeakersAutoLinking(object): self.SPEAKERS_MD = path.join('files', 'lp-speakers-autolink.md') self.SPEAKERS_MD_CONTENT = read_file(self.SPEAKERS_MD) - self.SPEAKERS_TEMPLATE = path.join('files', - 'lp-speakers-2016.jinja2') + self.SPEAKERS_TEMPLATE = path.join('..', 'libreplanet-templates/2016', + 'lp-speakers.jinja2') self.SESSIONS_MD = path.join('files', 'lp-sessions-autolink.md') self.SESSIONS_MD_CONTENT = read_file(self.SESSIONS_MD) - self.SESSIONS_TEMPLATE = path.join('files', - 'lp-sch-2016.jinja2') + self.SESSIONS_TEMPLATE = path.join('..', 'libreplanet-templates/2016', + 'lp-schedule.jinja2') def setup(self): -- cgit v1.2.3