Changeset 346

Show
Ignore:
Timestamp:
06/21/08 22:04:03 (4 years ago)
Author:
simon
Message:

Update copyright. Add changelog. Fix whitespace.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • hodgestar/Talks/PythonObjects/slides.py

    r342 r346  
    11# Slides, a HTML slide generator 
    22# Copyright (C) 2002 Moshe Zadka, Itamar Shtull-Trauring 
     3# Minor modifications (C) 2008 Simon Cross 
    34#  
    45# This library is free software; you can redistribute it and/or 
     
    1415# License along with this library; if not, write to the Free Software 
    1516# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
     17# 
     18# History: 
     19# 
     20# 2008-06-21, Simon Cross 
     21#   Version 1.0.2 
     22#   Minor changes to move prev/next links to bottom. Clean-up tabs. 
     23#  
     24# 2002, Moshe Zadka and Itamar Shtull-Traurin 
     25#   Version 1.0.1 
     26#   Original implementation 
    1627 
    1728"""Slides, a HTML slide generator.""" 
     
    3243    When you're done call renderHTML(). 
    3344    """ 
    34      
     45 
    3546    css = None 
    3647 
    3748    def __init__(self, name, *slides): 
    3849        self.name = name 
    39         self.slides = slides 
    40          
     50        self.slides = slides 
     51 
    4152    def renderHTML(self, directory, basename, css=None): 
    4253        """Render all slides and their index. 
     
    6172            result += '<link rel="stylesheet" type="text/css" href="%s" />\n' % self.css 
    6273        return result + '</head>\n<body>\n' 
    63      
     74 
    6475    def getFooter(self): 
    6576        """Return the footer for HTML pages.""" 
     
    7889        for i in range(len(self.slides)): 
    7990            fp.write("<li><a href='%s'>%s</a></li>\n" % 
    80                  (basename % (i+1), self.slides[i].title)) 
     91                    (basename % (i+1), self.slides[i].title)) 
    8192        fp.write('</ol>\n') 
    8293        fp.write(self.getIndexFooter()) 
     
    98109        index = '<a href="%s">Index</a>' % (basename % 0) 
    99110        result = (self.getHeader() + html 
    100               + " | ".join([prev, index, next]) + self.getFooter()) 
     111            + " | ".join([prev, index, next]) + self.getFooter()) 
    101112        fp = open(os.path.join(directory, basename % i), 'w') 
    102113        fp.write(result) 
     
    111122      *bullets -- Bullet instances. 
    112123    """ 
    113      
     124 
    114125    start = "<ul>\n" 
    115126    end = "</ul>\n" 
    116      
     127 
    117128    def __init__(self, title, *bullets): 
    118129        self.title = title 
     
    134145      *bullets -- Bullet instances. 
    135146    """ 
    136      
     147 
    137148    start = "<ol>\n" 
    138149    end = "</ol>\n" 
     
    145156      *bullets -- Bullet instances. 
    146157    """ 
    147      
     158 
    148159    def __init__(self, *bullets): 
    149160        self.bullets = bullets 
     
    158169class Bullet: 
    159170    """A bullet.""" 
    160      
     171 
    161172    def __init__(self, *texts): 
    162173        self.texts = texts 
    163174 
    164     def toHTML(self):         
     175    def toHTML(self): 
    165176        return '<li>'+ "".join(map(toHTML, self.texts)) + '</li>\n' 
    166177 
     
    168179class PRE: 
    169180    """A quoted text.""" 
    170      
     181 
    171182    def __init__(self, text): 
    172183        self.text = text 
     
    205216class Center: 
    206217    """Center an item.""" 
    207      
     218 
    208219    def __init__(self, text): 
    209220        self.text = text 
     
    215226class Image: 
    216227    """An image.""" 
    217      
     228 
    218229    def __init__(self, image, description=""): 
    219230        self.image = image 
    220231        self.description = description 
    221          
     232 
    222233    def toHTML(self): 
    223234        return "<img src='%s' alt='%s' />" % (self.image, self.description)