Пример #1
0
 def processTitlePage(self):
     if not any(txt != '' for txt in [self.coll.title,
                                      self.coll.subtitle,
                                      self.coll.editor]):
         return
     titlepage = collection.Chapter(self.coll.title)
     titlepage.id = 'titlepage'
     body_content = [E.h1(self.coll.title,
                          style="margin-top:20%;font-size:200%;text-align:center;"),
                     E.h2(self.coll.subtitle,
                          style="margin-top:1em;font-size:150%;text-align:center;"),
                     E.h3(self.coll.editor,
                          style="margin-top:1em;font-size:100%;text-align:center;"),
                     ]
     if any('wikipedia.org' in url for url in self.coll.url2webpage):
         img_src = 'wikipedia_logo.jpg'
         titlepage.images = {img_src:
                             os.path.join(os.path.dirname(__file__), img_src)}
         body_content.append(E.div(E.img(src='images/'+img_src,
                                         width='50%', alt='',
                                         ),
                                   style='text-align:center;margin-top:4em;'
                                   ))
     tree = misc.xhtml_page(title=self.coll.title,
                            body_content=body_content,
                            flatten=False)
     titlepage.tree = tree
     titlepage.xml = misc.flatten_tree(tree)
     self.container.addArticle(titlepage)
Пример #2
0
 def processTitlePage(self):
     if not any(txt != '' for txt in
                [self.coll.title, self.coll.subtitle, self.coll.editor]):
         return
     titlepage = collection.Chapter(self.coll.title)
     titlepage.id = 'titlepage'
     body_content = [
         E.h1(self.coll.title,
              style="margin-top:20%;font-size:200%;text-align:center;"),
         E.h2(self.coll.subtitle,
              style="margin-top:1em;font-size:150%;text-align:center;"),
         E.h3(self.coll.editor,
              style="margin-top:1em;font-size:100%;text-align:center;"),
     ]
     if any('wikipedia.org' in url for url in self.coll.url2webpage):
         img_src = 'wikipedia_logo.jpg'
         titlepage.images = {
             img_src: os.path.join(os.path.dirname(__file__), img_src)
         }
         body_content.append(
             E.div(E.img(
                 src='images/' + img_src,
                 width='50%',
                 alt='',
             ),
                   style='text-align:center;margin-top:4em;'))
     tree = misc.xhtml_page(title=self.coll.title,
                            body_content=body_content,
                            flatten=False)
     titlepage.tree = tree
     titlepage.xml = misc.flatten_tree(tree)
     self.container.addArticle(titlepage)
Пример #3
0
 def processChapter(self, chapter):
     self.num_chapters = getattr(self, 'num_chapters', 0) + 1
     chapter.id = 'chapter_%02d' % self.num_chapters
     title = xmlescape(chapter.title)
     chapter.xml = misc.xhtml_page(
         title=title,
         body_content=[E.h1({'style':
                             'margin-top:15%;font-size:200%;text-align:center;'},
                            title)]
         )
     self.container.addArticle(chapter)
Пример #4
0
 def processChapter(self, chapter):
     self.num_chapters = getattr(self, 'num_chapters', 0) + 1
     chapter.id = 'chapter_%02d' % self.num_chapters
     title = xmlescape(chapter.title)
     chapter.xml = misc.xhtml_page(
         title=title,
         body_content=[
             E.h1(
                 {
                     'style':
                     'margin-top:15%;font-size:200%;text-align:center;'
                 }, title)
         ])
     self.container.addArticle(chapter)
Пример #5
0
 def processCoverImage(self):
     if not self.cover_img:
         return
     content = [E.div(dict(style='width:100%;height:100%;'),
                      E.img(dict(src='images/' + 'cover'+ os.path.splitext(self.cover_img)[1],
                                 alt='',
                                 #width='100%',
                                 height='100%',
                                 style='max-height:100%;max-width:100%;margin:auto;',
                                 ))),
                ]
     xml = misc.xhtml_page(title='cover',
                            body_content=content,
                            flatten=True)
     self.container.addCover(xml, os.path.abspath(self.cover_img))
Пример #6
0
 def processCoverImage(self):
     if not self.cover_img:
         return
     content = [
         E.div(
             dict(style='width:100%;height:100%;'),
             E.img(
                 dict(
                     src='images/' + 'cover' +
                     os.path.splitext(self.cover_img)[1],
                     alt='',
                     #width='100%',
                     height='100%',
                     style='max-height:100%;max-width:100%;margin:auto;',
                 ))),
     ]
     xml = misc.xhtml_page(title='cover',
                           body_content=content,
                           flatten=True)
     self.container.addCover(xml, os.path.abspath(self.cover_img))