| | 202 | |
| | 203 | class Heading(LecturePart): |
| | 204 | """A heading of a given level (1, 2, ...).""" |
| | 205 | def __init__(self, num, text): |
| | 206 | self.num = num |
| | 207 | self.text = text |
| | 208 | |
| | 209 | def toHTML(self): |
| | 210 | return '<h%d>%s</h%d>' % (self.num, toHTML(self.text), self.num) |
| | 211 | |
| | 212 | |
| | 213 | class Center(LecturePart): |
| | 214 | """Center an item.""" |
| | 215 | |
| | 216 | def __init__(self, text): |
| | 217 | self.text = text |
| | 218 | |
| | 219 | def toHTML(self): |
| | 220 | return '<center>%s</center>' % toHTML(self.text) |
| | 221 | |
| | 222 | |
| | 223 | class Image(LecturePart): |
| | 224 | """An image.""" |
| | 225 | |
| | 226 | def __init__(self, image, description=""): |
| | 227 | self.image = image |
| | 228 | self.description = description |
| | 229 | |
| | 230 | def toHTML(self): |
| | 231 | return "<img src='%s' alt='%s' />" % (self.image, self.description) |
| | 232 | |
| | 233 | |
| | 234 | class TitleSlide(Slide): |
| | 235 | |
| | 236 | def toHTML(self): |
| | 237 | title = '<h1>%s</h1>' % toHTML(Center(self.title)) |
| | 238 | points = [] |
| | 239 | for point in self.bullets: |
| | 240 | points.append(Center(point).toHTML()) |
| | 241 | return title + '\n'.join(points) |
| 206 | | class Heading: |
| 207 | | """A heading of a given level (1, 2, ...).""" |
| 208 | | def __init__(self, num, text): |
| 209 | | self.num = num |
| 210 | | self.text = text |
| 211 | | |
| 212 | | def toHTML(self): |
| 213 | | return '<h%d>%s</h%d>' % (self.num, toHTML(self.text), self.num) |
| 214 | | |
| 215 | | |
| 216 | | class Center: |
| 217 | | """Center an item.""" |
| 218 | | |
| 219 | | def __init__(self, text): |
| 220 | | self.text = text |
| 221 | | |
| 222 | | def toHTML(self): |
| 223 | | return '<center>%s</center>' % toHTML(self.text) |
| 224 | | |
| 225 | | |
| 226 | | class Image: |
| 227 | | """An image.""" |
| 228 | | |
| 229 | | def __init__(self, image, description=""): |
| 230 | | self.image = image |
| 231 | | self.description = description |
| 232 | | |
| 233 | | def toHTML(self): |
| 234 | | return "<img src='%s' alt='%s' />" % (self.image, self.description) |
| 235 | | |
| 236 | | |
| 237 | | class TitleSlide(Slide): |
| 238 | | |
| 239 | | def toHTML(self): |
| 240 | | title = '<h1>%s</h1>' % toHTML(Center(self.title)) |
| 241 | | points = [] |
| 242 | | for point in self.bullets: |
| 243 | | points.append(Center(point).toHTML()) |
| 244 | | return title + '\n'.join(points) |
| 245 | | |
| 246 | | |