def print_proceedings(entry, id):
    output = open('../html/paper.html', 'r').read()
    f = open('../../publications/' + id + '.html', 'w')

    output += '<h2 class="first">' + entry.title.value.replace(":", ":<br>") + '</h2>'

    output += '<h3 style="margin-top: 1em;">edited by ' + print_author(entry.editor) + '</h3>'
    
    if 'abstract' in entry:
        output += '<p style="margin-top: 1.5em;"><strong>Abstract.</strong> ' + entry.abstract.value + '</p>'

    output += pdf_iframe(entry, id)

    output += '</div></div>'
    output += footer()
    output += '</body></html>'

    f.write(output.replace(" & ", " &amp; ").replace(" - ", " &mdash; ").replace("%%PAPERTITLE%%", entry.title.value))
    f.close()


    result = '<li id="' + id + '">'

    # PDF
    result += pdf_link(entry, id)

    # author and title
    result += print_editor(entry.editor) + '. '
    #result += '<strong>' + entry.title.value + '</strong>'
    result += '<strong><a href="publications/' + id + '.html">' + entry.title.value + '</a></strong>'

    # volume and series
    if 'volume' in entry:
        result += ', volume ' + entry.volume.value + ' of '
    else:
        result += ', '
    if 'series' in entry:
        result += '<em>' + entry.series.value + '</em>'

    result += ', '

    # month and year
    if 'month' in entry:
        result += entry.month.value + ' '
    result += entry.year.value + '.'

    # publisher
    if 'publisher' in entry:
        result += ' ' + entry.publisher.value + '.'

    # note
    if 'note' in entry:
        result += ' ' + entry.note.value

    # DOI
    if 'doi' in entry:
        result += ' <small><a href="http://dx.doi.org/' + entry.doi.value + '">DOI</a></small>'

    result += '</li>'
    return result
Beispiel #2
0
def index():
    nabes = [
        "Downtown Brooklyn", "Williamsburg", "Upper East Side",
        "Upper West Side", "Midtown East"
    ]
    footer = utils.footer()
    if "username" in session and session["username"] != "":
        header = utils.header(session["username"])

        if request.args.get("neighborhood") not in nabes:
            return redirect("/?neighborhood=%s" % nabes[0])

        nabes = user_actions.nabes(request.args.get("neighborhood"))

        sug = suggestions.next_restaurant(request.args.get("neighborhood"))
        eatlist = suggestions.generate_superlike_table()
        return render_template("homepage.html",
                               restaurant=sug,
                               superlike=eatlist,
                               header=header,
                               footer=footer,
                               neighborhoods=nabes)
    else:
        header = utils.header("")
        return render_template("index.html", header=header, footer=footer)
def tools():
    # add header template
    print("Generating tools.html...")
    output = open('../html/tools.html', 'r').read()

    # read data XML file
    xml = XML2Dict()
    data = xml.fromstring(open('../xml/tools.xml', 'r').read())

    # fetch papers
    paperdata = generate_publications.init()

    first = True

    for entry in data.tooling.tools.tool:
        release = time.strptime(entry.release, '%d %b %Y')

        if first:
            output += '<h2 class="first">' + entry.name + '</h2>'
            first = False
        else:
            output += '<h2>' + entry.name + '</h2>'

        output += '<ul class="talks">\n'

        output += '<li>' + entry.description.replace(entry.name, '<strong>' + entry.name + '</strong>') + '</li>\n'

        if 'paper' in entry:
            output += generate_publications.formatentry(generate_publications.entrybyname(entry.paper, paperdata)) + '\n'

        if 'codevelopers' in entry:
            if entry.codevelopers.find('and') != -1:
                output += '<li>co-developers: ' + entry.codevelopers + '</li>\n'
            else:
                output += '<li>co-developer: ' + entry.codevelopers + '</li>\n'

        output += '<li>development status: ' + entry.status + '</li>\n'
        output += '<li>latest release: ' + timeperiod(release, release) + '</li>\n'
        output += '</ul>\n'


    # footer
    output += '</div></div>'
    output += footer()
    output += '</body></html>'

    print("Writing tools.html...")
    f = open('../../tools.html', 'w')
    f.write(output.replace(" & ", " &amp; ").replace(" - ", " &mdash; "))
    f.close()
Beispiel #4
0
def login():
    if "username" in session and session["username"] != "":
        return "<script>window.location='/'</script>"  #FIX

    header = utils.header("")
    footer = utils.footer()

    if request.method == 'POST':
        return_code = user_actions.login(request.form["username"],
                                         request.form["password"])
        if return_code == 1:
            session["username"] = request.form["username"]
            return "<script>window.location='/'</script>"  #FIX
        else:
            return render_template("login.html",
                                   return_code=return_code,
                                   header=header,
                                   footer=footer)
    else:
        return render_template("login.html", header=header, footer=footer)
def presentations():
    # add header template
    print("Generating presentations.html...")
    output = open('../html/presentations.html', 'r').read()

    # read data XML file
    xml = XML2Dict()
    data = xml.fromstring(open('../xml/presentations.xml', 'r').read())


    #########################
    # part 1: Invited Talks #
    #########################

    # transform date types
    for entry in data.presentations.invited.talk:
        entry.date = time.strptime(entry.date, '%d %b %Y')

    # sort by begin date
    data.presentations.invited.talk = sorted(data.presentations.invited.talk, key=lambda k: k.date, reverse=True)

    output += '<h2 class="first">Invited Presentations</h2>'
    output += '<ul class="talks">\n'

    for entry in data.presentations.invited.talk:

        output += '<li id="' + entry.id + '">'
        if 'slideshare' in entry:
            output += '<a href="' + entry.slideshare + '" title="slides of the talk at Slideshare"></a>'
        if 'vimeo' in entry:
            output += '<a href="' + entry.vimeo + '" title="video of the talk at Vimeo"></a>'
        output += '<strong>' + entry.title + '</strong><br/>'
        output += entry.detail + '<br/>'

        if entry.date > time.localtime():
            output += 'to be held on '

        output += timeperiod(entry.date, entry.date) + ' in ' + placelink(entry.venue)
        output += '</li>\n'

        # output for Slideshare.net
        stdoutput = '\nInvited presentation given by Niels Lohmann on ' + timeperiod(entry.date, entry.date)
        stdoutput += ' in ' + entry.venue + ' as ' + entry.detail
        if stdoutput[-1] != '.':
            stdoutput += '.\n'
        sys.stderr.write(stdoutput)

    output += '</ul>\n'


    ############################
    # part 2: Conference Talks #
    ############################

    # transform date types
    for entry in data.presentations.conferences.talk:
        entry.date = time.strptime(entry.date, '%d %b %Y')

    # sort by begin date
    data.presentations.conferences.talk = sorted(data.presentations.conferences.talk, key=lambda k: k.date, reverse=True)

    output += '<h2>Conference Presentations</h2>'
    output += '<ul class="talks">\n'

    for entry in data.presentations.conferences.talk:

        output += '<li id="' + entry.id + '">'
        if 'slideshare' in entry:
            output += '<a href="' + entry.slideshare + '" title="slides of the talk at Slideshare"></a>'
        if 'vimeo' in entry:
            output += '<a href="' + entry.vimeo + '" title="video of the talk at Vimeo"></a>'
        output += '<strong>' + entry.title + '</strong><br/>'
        if 'abbreviation' in entry:
            output += '<em>' + entry.conference + ' (<a href="' + entry.url + '">' + entry.abbreviation.replace(" ", "&nbsp;") + '</a>)</em><br/>'
        else:
            output += '<em><a href="' + entry.url + '">' + entry.conference + ' </a></em><br/>'

        if entry.date > time.localtime():
            output += 'to be held on '

        output += timeperiod(entry.date, entry.date) + ' in ' + placelink(entry.venue)
        output += '</li>\n'

        # output for Slideshare.net
        stdoutput = '\nConference presentation given by Niels Lohmann on ' + timeperiod(entry.date, entry.date)
        stdoutput += ' in ' + entry.venue + ' at the ' + entry.conference
        if 'abbreviation' in entry:
            stdoutput += ' (' + entry.abbreviation + ')'
        stdoutput += '.\n'
        sys.stderr.write(stdoutput)

    output += '</ul>\n'


    ##########################
    # part 3: Workshop Talks #
    ##########################

    # transform date types
    for entry in data.presentations.workshops.talk:
        entry.date = time.strptime(entry.date, '%d %b %Y')

    # sort by begin date
    data.presentations.workshops.talk = sorted(data.presentations.workshops.talk, key=lambda k: k.date, reverse=True)

    output += '<h2>Workshop Presentations</h2>'
    output += '<ul class="talks">\n'

    for entry in data.presentations.workshops.talk:

        output += '<li id="' + entry.id + '">'
        if 'slideshare' in entry:
            output += '<a href="' + entry.slideshare + '" title="slides of the talk at Slideshare"></a>'
        if 'vimeo' in entry:
            output += '<a href="' + entry.vimeo + '" title="video of the talk at Vimeo"></a>'
        output += '<strong>' + entry.title + '</strong><br/>'
        if 'abbreviation' in entry:
            if 'url' in entry:
                output += '<em>' + entry.conference + ' (<a href="' + entry.url + '">' + entry.abbreviation.replace(" ", "&nbsp;") + '</a>)'
            else:
                output += '<em>' + entry.conference + ' (' + entry.abbreviation.replace(" ", "&nbsp;") + ')'
        else:
            if 'url' in entry:
                output += '<em><a href="' + entry.url + '">' + entry.conference + '</a>'
            else:
                output += '<em>' + entry.conference
        if 'colocation' in entry:
            if 'courl' in entry:
                output += '; part of <a href="' + entry.courl + '">' + entry.colocation.replace(" ", "&nbsp;") + '</a>'
            else:
                output += '; part of ' + entry.colocation.replace(" ", "&nbsp;")
        output += '</em><br/>'

        if entry.date > time.localtime():
            output += 'to be held on '

        output += timeperiod(entry.date, entry.date) + ' in ' + placelink(entry.venue)
        output += '</li>\n'

        # output for Slideshare.net
        stdoutput = '\nWorkshop presentation given by Niels Lohmann on ' + timeperiod(entry.date, entry.date)
        stdoutput += ' in ' + entry.venue + ' at the ' + entry.conference
        if 'abbreviation' in entry:
            stdoutput += ' (' + entry.abbreviation + ')'
        if 'colocation' in entry:
            stdoutput += '; part of ' + entry.colocation
        stdoutput += '.\n'
        sys.stderr.write(stdoutput)

    output += '</ul>\n'


    ##########################
    # part 4: Demonstrations #
    ##########################

    # transform date types
    for entry in data.presentations.demonstrations.talk:
        entry.date = time.strptime(entry.date, '%d %b %Y')

    # sort by begin date
    data.presentations.demonstrations.talk = sorted(data.presentations.demonstrations.talk, key=lambda k: k.date, reverse=True)

    output += '<h2>Tool Demonstrations</h2>'
    output += '<ul class="talks">\n'

    for entry in data.presentations.demonstrations.talk:

        output += '<li id="' + entry.id + '">'
        if 'slideshare' in entry:
            output += '<a href="' + entry.slideshare + '" title="slides of the talk at Slideshare"></a>'
        if 'vimeo' in entry:
            output += '<a href="' + entry.vimeo + '" title="video of the talk at Vimeo"></a>'
        output += '<strong>' + entry.title + '</strong><br/>'
        if 'abbreviation' in entry:
            if 'url' in entry:
                output += '<em>' + entry.conference + ' (<a href="' + entry.url + '">' + entry.abbreviation.replace(" ", "&nbsp;") + '</a>)'
            else:
                output += '<em>' + entry.conference + ' (' + entry.abbreviation.replace(" ", "&nbsp;") + ')'
        else:
            if 'url' in entry:
                output += '<em><a href="' + entry.url + '">' + entry.conference + '</a>'
            else:
                output += '<em>' + entry.conference
        if 'colocation' in entry:
            if 'courl' in entry:
                output += '; part of <a href="' + entry.courl + '">' + entry.colocation.replace(" ", "&nbsp;") + '</a>'
            else:
                output += '; part of ' + entry.colocation.replace(" ", "&nbsp;")
        output += '</em><br/>'
        output += timeperiod(entry.date, entry.date) + ' in ' + placelink(entry.venue)
        output += '</li>\n'

        # output for Slideshare.net
        stdoutput = '\nTool demonstration given by Niels Lohmann on ' + timeperiod(entry.date, entry.date)
        stdoutput += ' in ' + entry.venue + ' at the ' + entry.conference
        if 'abbreviation' in entry:
            stdoutput += ' (' + entry.abbreviation + ')'
        if 'colocation' in entry:
            stdoutput += '; part of ' + entry.colocation
        stdoutput += '.\n'
        sys.stderr.write(stdoutput)

    output += '</ul>\n'



    #########################
    # part 5: Miscellaneous #
    #########################

    # transform date types
    for entry in data.presentations.miscellaneous.talk:
        entry.date = time.strptime(entry.date, '%d %b %Y')

    # sort by begin date
    data.presentations.miscellaneous.talk = sorted(data.presentations.miscellaneous.talk, key=lambda k: k.date, reverse=True)

    output += '<h2>Miscellaneous</h2>'
    output += '<ul class="talks">\n'

    for entry in data.presentations.miscellaneous.talk:

        output += '<li id="' + entry.id + '">'
        output += '<a href="' + entry.slideshare + '" title="slides of the talk at Slideshare"></a>'
        if 'vimeo' in entry:
            output += '<a href="' + entry.vimeo + '" title="video of the talk at Vimeo"></a>'
        output += '<strong>' + entry.title + '</strong><br/>'
        output += entry.detail + '<br/>'
        output += timeperiod(entry.date, entry.date) + ' in ' + placelink(entry.venue)
        output += '</li>\n'

        # output for Slideshare.net
        stdoutput = '\nPresentation given by Niels Lohmann on ' + timeperiod(entry.date, entry.date)
        stdoutput += ' in ' + entry.venue + '; ' + entry.detail
        stdoutput += '.\n'
        sys.stderr.write(stdoutput)

    output += '</ul>\n'



    # footer
    output += '</div></div>'
    output += footer()
    output += '</body></html>'

    print("Writing presentations.html...")
    f = open('../../presentations.html', 'w')
    f.write(output.replace(" & ", " &amp; ").replace(" - ", " &mdash; "))
    f.close()
def news():
    # add header template
    print("Generating index.html...")
    output = open('../html/index.html', 'r').read()

    # read data XML file
    xml = XML2Dict()
    data = xml.fromstring(open('../xml/news.xml', 'r').read())

    # fetch papers
    paperdata = generate_publications.init()

    past = []
    past_images = []
    past_sticky = 0

    max_entries = 6

    present = []
    future = []

    # add academic services
    everything = data.newsentries.entries.news + read_academic()

    for entry in data.newsentries.entries.news:
        entry.begin = time.strptime(entry.begin, '%d %b %Y')
        if 'end' in entry:
            entry.end = time.strptime(entry.end, '%d %b %Y')
        else:
            entry.end = entry.begin

    # sort by begin date
    everything = sorted(everything, key=lambda k: k.begin, reverse=True)

    # get sticky entries, images and sort into past and future

    for entry in everything:
        if entry.end > time.localtime():
            future.append(entry)
            continue

        if entry.begin < time.localtime():
            past.append(entry)
            if 'image' in entry:
                past_images.append([entry.image, entry.text])
            if 'sticky' in entry:
                past_sticky += 1
            continue

        present.append(entry)

    future.reverse()

    ########################################################################

    if len(future) > 0:
        output += '<h2 style="margin-top: 1em;">Soon&hellip;</h2>\n'
        output += '<ul class="news">\n'
        count = 0
        for entry in future:
            count += 1
            if count > max_entries and 'sticky' not in entry:
                continue

            output += '<li>'

            if entry.type == 'free':
                output += print_free(entry)
            if entry.type == 'visit':
                output += print_visit(entry)
            if entry.type == 'lecture':
                output += print_lecture(entry)
            if entry.type == 'venue':
                output += print_venue(entry)

            output += '</li>\n'

        output += '</ul>\n'

    ########################################################################

    if len(past) > 0:
        output += '<h2 style="margin-top: 1em;">Recently&hellip;</h2>\n'

        for img in past_images:
            output += '<img src="resources/img/' + img[0] + '" alt="' + img[1] + '" style="padding-left:10px; padding-bottom:10px; float: right;" />'

        output += '<ul class="news">\n'
        count = 0
        for entry in past:
            count += 1
            if count > (max_entries-past_sticky) and 'sticky' not in entry:
                continue

            output += '<li>'

            if entry.type == 'pc':
                output += print_pc(entry)
            if entry.type == 'free':
                output += print_free(entry)
            if entry.type == 'visit':
                output += print_visit(entry)
            if entry.type == 'lecture':
                output += print_lecture(entry)
            if entry.type == 'venue':
                output += print_venue(entry)
            if entry.type == 'paper_accepted':
                output += print_paper_accepted(entry, paperdata)

            output += '</li>\n'
        output += '</ul>\n'

    ########################################################################

    # footer
    output += '</div></div>'
    output += footer()
    output += '</body></html>'

    print("Writing index.html...")
    f = open('../../index.html', 'w')
    f.write(output.replace(" & ", " &amp; ").replace(" - ", " &mdash; "))
    f.close()
def print_techreport(entry, id):
    output = open('../html/paper.html', 'r').read()
    f = open('../../publications/' + id + '.html', 'w')

    output += '<h2 class="first">' + entry.title.value.replace(":", ":<br>") + '</h2>'

    output += '<h3 style="margin-top: 1em;">by ' + print_author(entry.author) + '</h3>'
    
    if 'abstract' in entry:
        output += '<p style="margin-top: 1.5em;"><strong>Abstract.</strong> ' + entry.abstract.value + '</p>'

    output += '<p>Appeared as technical report at ' + entry.institution.value
    if 'address' in entry:
        output += ' in ' + entry.address.value
    output += '.</p>'

    output += pdf_iframe(entry, id)

    output += '</div></div>'
    output += footer()
    output += '</body></html>'

    f.write(output.replace(" & ", " &amp; ").replace(" - ", " &mdash; ").replace("%%PAPERTITLE%%", entry.title.value))
    f.close()


    result = '<li id="' + id + '">'

    # PDF
    result += pdf_link(entry, id)

    # author and title
    result += print_author(entry.author) + '. '
#    result += '<strong>' + entry.title.value + '</strong>. '
    result += '<strong><a href="publications/' + id + '.html">' + entry.title.value + '</a></strong>. '

    # type
    result += entry.type.value

    # volume and number
    if 'number' in entry:
        result += ' ' + entry.number.value

    # institution and address
    if 'institution' in entry:
        result += ', ' + entry.institution.value
    if 'address' in entry:
        result += ', ' + entry.address.value

    result += ', '

    # month and year
    if 'month' in entry:
        result += entry.month.value + ' '
    result += entry.year.value + '.'

    # note
    if 'note' in entry:
        result += ' ' + entry.note

    # DOI
    if 'doi' in entry:
        result += ' <small><a href="http://dx.doi.org/' + entry.doi.value + '">DOI</a></small>'

    result += '</li>'
    return result
def main():
    # get data
    data = init()

    # add header template
    print("Generating publications.html...")
    output = open('../html/publications.html', 'r').read()

    filterauthor = 'Niels Lohmann'

    #######################
    # part 1: Proceedings #
    #######################
    output += '<h2 class="first">Proceedings</h2>\n'
    output += '<ul class="publications">\n'

    for entry in data.file.entry:
        if 'proceedings' in entry:
            if print_editor(entry.proceedings.editor).find(filterauthor) != -1:
                output += formatentry(entry)

    output += '</ul>\n'

    ##########################
    # part 1a: Book Chapters #
    ##########################
    output += '<h2>Book Chapters (reviewed)</h2>\n'
    output += '<ul class="publications">\n'

    for entry in data.file.entry:
        if 'inbook' in entry:
            if print_author(entry.inbook.author).find(filterauthor) != -1:
                output += formatentry(entry)

    output += '</ul>\n'

    ####################
    # part 2: Articles #
    ####################
    output += '<h2>Journal Articles (reviewed)</h2>\n'
    output += '<ul class="publications">\n'

    for entry in data.file.entry:
        if 'article' in entry:
            if print_author(entry.article.author).find(filterauthor) != -1:
                output += formatentry(entry)

    output += '</ul>\n'

    #############################
    # part 3: Conference Papers #
    #############################

    output += '<h2>Conference Papers (reviewed)</h2>\n'
    output += '<ul class="publications">\n'

    for entry in data.file.entry:
        if 'inproceedings' in entry:
            if print_author(entry.inproceedings.author).find(filterauthor) != -1:
                if not is_workshop(entry) and is_reviewed(entry):
                    output += formatentry(entry)

    output += '</ul>\n'

    ######################################
    # part 4: Workshop Papers (reviewed) #
    ######################################

    output += '<h2>Workshop Papers (reviewed)</h2>\n'
    output += '<ul class="publications">\n'

    for entry in data.file.entry:
        if 'inproceedings' in entry:
            if print_author(entry.inproceedings.author).find(filterauthor) != -1:
                if is_workshop(entry) and is_reviewed(entry):
                    output += formatentry(entry)

    output += '</ul>\n'

    ########################################
    # part 5: Workshop Papers (unreviewed) #
    ########################################

    output += '<h2>Workshop Papers (unreviewed)</h2>\n'
    output += '<ul class="publications">\n'

    for entry in data.file.entry:
        if 'inproceedings' in entry:
            if print_author(entry.inproceedings.author).find(filterauthor) != -1:
                if is_workshop(entry) and not is_reviewed(entry):
                    output += formatentry(entry)

    output += '</ul>\n'

    #############################
    # part 6: Technical Reports #
    #############################

    output += '<h2>Technical Reports</h2>\n'
    output += '<ul class="publications">\n'

    for entry in data.file.entry:
        if 'techreport' in entry:
            if print_author(entry.techreport.author).find(filterauthor) != -1:
                output += formatentry(entry)

    output += '</ul>\n'

    ##################
    # part 7: Theses #
    ##################

    output += '<h2>Theses</h2>\n'
    output += '<ul class="publications">\n'

    for entry in data.file.entry:
        if 'phdthesis' in entry:
            if print_author(entry.phdthesis.author).find(filterauthor) != -1:
                output += formatentry(entry)
        if 'mastersthesis' in entry:
            if print_author(entry.mastersthesis.author).find(filterauthor) != -1:
                output += formatentry(entry)

    output += '</ul>\n'


    # footer
    output += '</div></div>'
    output += footer()
    output += '</body></html>'

    print("Writing publications.html...")
    f = open('../../publications.html', 'w')
    f.write(output.replace(" & ", " &amp; ").replace(" - ", " &mdash; "))
    f.close()
def teaching():
    # add header template
    print("Generating teaching.html...")
    output = open('../html/teaching.html', 'r').read()

    # read data XML file
    xml = XML2Dict()
    data = xml.fromstring(open('../xml/teaching.xml', 'r').read())


    #################################
    # part 1: Supervision of Theses #
    #################################

    output += '<h2 class="first">Supervision of Theses</h2>'
    output += '<ul class="talks">\n'

    for entry in data.teaching.supervisions.thesis:

        output += '<li>' + entry.author + '. '
        output += '<strong>' + entry.title + '</strong><br/>'
        output += entry.type + ', ' + entry.institution
        if 'date' in entry:
            entry.date = time.strptime(entry.date, '%d %b %Y')
            output += ', submitted ' + timeperiod(entry.date, entry.date)
        else:
            output += ', expected ' + entry.expected
        output += '</li>\n'

    output += '</ul>\n'


    ####################
    # part 2: Lectures #
    ####################

    output += '<h2>Lectures</h2>'
    output += '<ul class="talks">\n'

    for entry in data.teaching.lectures.lecture:

        output += '<li>'
        output += '<strong>' + entry.title
        if 'byProxy' in entry:
            output += ' &mdash; by proxy'
        output += '</strong><br/>'
        if 'detail' in entry:
            output += entry.detail + ', '
        output += entry.institution + ' (' + entry.term + ')'
        output += '</li>\n'

    output += '</ul>\n'


    ####################
    # part 3: Seminars #
    ####################

    output += '<h2>Seminars</h2>'
    output += '<ul class="talks">\n'

    for entry in data.teaching.seminars.seminar:

        output += '<li>'
        output += '<strong>' + entry.title
        if 'byProxy' in entry:
            output += ' &mdash; by proxy'
        output += '</strong><br/>'
        if 'detail' in entry:
            output += entry.detail + ', '
        output += entry.institution + ' (' + entry.term + ')'
        output += '</li>\n'

    output += '</ul>\n'


    #####################
    # part 4: Exercises #
    #####################

    output += '<h2>Exercises</h2>'
    output += '<ul class="talks">\n'

    for entry in data.teaching.exercises.exercise:

        output += '<li>'

#        if 'evaluation' in entry:
#            output += '<a href="files/' + entry.evaluation + '" class="evaluation"></a>'

        output += '<strong>'
        
        if 'page' in entry:
            output += '<a href="teaching/' + entry.page + '.html">' + entry.title + '</a>'
        else:
            output += entry.title

        output += '</strong><br/>'
        if 'detail' in entry:
            output += entry.detail + ', '
        output += entry.institution + ' (' + entry.term + ')'
        output += '</li>\n'

    output += '</ul>\n'




    # footer
    output += '</div></div>'
    output += footer()
    output += '</body></html>'

    print("Writing teaching.html...")
    f = open('../../teaching.html', 'w')
    f.write(output.replace(" & ", " &amp; ").replace(" - ", " &mdash; "))
    f.close()
def academic():
    # add header template
    print("Generating academic.html...")
    output = open('../html/academic.html', 'r').read()

    # read data XML file
    xml = XML2Dict()
    data = xml.fromstring(open('../xml/academic.xml', 'r').read())

    output += '<h2 class="first">Steering Committee Membership</h2>\n'
    output += '<ul class="talks">\n'
    output += '<li><strong><a href="http://zeus-workshop.eu/">ZEUS Workshop Series</a></strong><br />Central European Workshop on Services and their Composition</li>'
    output += '</ul>\n'

    #####################################
    # part 1: Organization of Workshops #
    #####################################

    # transform date types
    for entry in data.scientific.organization.workshop:
        entry.begin = time.strptime(entry.begin, '%d %b %Y')
        entry.end = time.strptime(entry.end, '%d %b %Y')

    # sort by begin date
    data.scientific.organization.workshop = sorted(data.scientific.organization.workshop, key=lambda k: k.begin, reverse=True)

    # output
    output += '<h2>Organization of Workshops</h2>\n'
    output += '<ul class="talks">\n'

    for entry in data.scientific.organization.workshop:

        # title
        output += '<li><strong>'

        if 'abbreviation' in entry:
            output += entry.title
            if 'url' in entry:
                output += ' (<a href="' + entry.url + '">' + entry.abbreviation.replace(" ", "&nbsp;") + '</a>)'
            else:
                output += ' (' + entry.abbreviation.replace(" ", "&nbsp;") + ')'
        else:
            if 'url' in entry:
                output += '<a href="' + entry.url + '">' + entry.title + '</a>'
            else:
                output += entry.title

        output += '</strong><br/>\n'

        # colocation
        if 'kind' in entry:
            output += entry.kind
            if 'colocation' in entry:
                output += ', '
                if 'courl' in entry:
                    output += 'part of <a href="' + entry.courl + '">' + entry.colocation + '</a>'
                else:
                    output += 'part of ' + entry.colocation
        else:
            if 'colocation' in entry:
                if 'courl' in entry:
                    output += 'part of <a href="' + entry.courl + '">' + entry.colocation + '</a>'
                else:
                    output += 'part of ' + entry.colocation

        # date
        output += '<br/>'
        output += timeperiod(entry.begin, entry.end)

        # venue
        if 'venue' in entry:
            output += ' in ' + entry.venue

        output += '</li>\n'

    output += '</ul>\n'

    ##########################
    # part 2: PC memberships #
    ##########################

    # transform date types
    for entry in data.scientific.memberships.pc:
        entry.date = time.strptime(entry.date, '%d %b %Y')
        entry.begin = time.strptime(entry.begin, '%d %b %Y')
        entry.end = time.strptime(entry.end, '%d %b %Y')

    # sort by begin date
    data.scientific.memberships.pc = sorted(data.scientific.memberships.pc, key=lambda k: k.begin, reverse=True)

    # output
    output += '<h2>Program Committee Memberships</h2>\n'
    output += '<ul class="talks">\n'
    for entry in data.scientific.memberships.pc:

        # title
        output += '<li><strong>'

        if 'abbreviation' in entry:
            output += entry.title
            if 'url' in entry:
                output += ' (<a href="' + entry.url + '">' + entry.abbreviation.replace(" ", "&nbsp;") + '</a>)'
            else:
                output += ' (' + entry.abbreviation.replace(" ", "&nbsp;") + ')'
        else:
            if 'url' in entry:
                output += '<a href="' + entry.url + '">' + entry.title + '</a>'
            else:
                output += entry.title

        if 'role' in entry:
            output += ' &mdash; ' + entry.role

        output += '</strong><br/>\n'

        # colocation
        if 'kind' in entry:
            output += entry.kind
            if 'colocation' in entry:
                output += ', '
                if 'courl' in entry:
                    output += 'part of <a href="' + entry.courl + '">' + entry.colocation + '</a>'
                else:
                    output += 'part of ' + entry.colocation
        else:
            if 'colocation' in entry:
                if 'courl' in entry:
                    output += 'part of <a href="' + entry.courl + '">' + entry.colocation + '</a>'
                else:
                    output += 'part of ' + entry.colocation

        # date
        output += '<br/>'
        output += timeperiod(entry.begin, entry.end)

        # venue
        if 'venue' in entry:
            output += ' in ' + entry.venue

        # call for paper
        if 'cfp' in entry and entry.begin > time.localtime():
            output += '<br/><a href="' + entry.cfp + '">Call for papers</a>'

        output += '</li>\n'

    output += '</ul>\n'

    ###########################
    # part 3: Journal Reviews #
    ###########################

    # sort by journal title
    data.scientific.journalreviews.journal = sorted(data.scientific.journalreviews.journal, key=lambda k: k.title)

    # output
    output += '<h2>Journal Reviewing Activities</h2>\n'
    output += '<ul class="talks">\n'
    for entry in data.scientific.journalreviews.journal:

        # title
        output += '<li><strong>'

        if 'url' in entry:
            output += '<a href="' + entry.url + '">' + entry.title + '</a>'
        else:
            output += entry.title
        output += '</strong></li>\n'

    output += '</ul>\n'


    # footer
    output += '</div></div>'
    output += footer()
    output += '</body></html>'

    print("Writing academic.html...")
    f = open('../../academic.html', 'w')
    f.write(output.replace(" & ", " &amp; ").replace(" - ", " &mdash; "))
    f.close()