コード例 #1
0
ファイル: glossary.py プロジェクト: davebooth/osis-converters
 def endElement(self, name):
     if name == 'chapter':
         self._endArticle()
         
     elif name == 'div':
         self._endArticle()
         
     elif name == 'p':
         self._endDfn = False
         OsisHandler.endElement(self, name)
         
     elif name == 'seg':
         if self._inDfn:
             self._writeHtml('</%s>' % self._keywordTag)
             if self._keywordTag == 'h4':
                 self._writeHtml('\n<div class="glossary-entry">')
             self._inDfn = False
             self._endDfn = True
             
     elif name == 'title':
         if self._inTitle:
             self._inTitle = False
             if self._ignoreTitle:
                 self._ignoreTitle = False                       
             elif self._headerProcessed:
                 if self._inChapterTitle:
                     self._titleTag = '<h3 toclevel = 2>' 
                     self._inChapterTitle = False
                     self._entryTocLevel = 3
                 else:
                     self._glossTitleWritten = True
                 self._writeTitle()
                 
     else:
         OsisHandler.endElement(self, name)
コード例 #2
0
ファイル: bible.py プロジェクト: davebooth/osis-converters
 def endElement(self, name):
     if name == 'chapter':
         if self._ignoreChEnd:
             self._ignoreChEnd = False
         else:
             self._docStructure.endChapter(self._docStructure.chapterRef)
             self._writeBreak(True)
   
     elif name == 'div':
         if self._ignoreDivEnd:
             self._ignoreDivEnd = False
         else:
             divType = self._docStructure.endDiv(None)
             if divType == self._docStructure.BOOK:
                 self._footnotes.writeFootnotes()
             elif divType == self._docStructure.GROUP:
                 if self._groupEmpty:
                     print 'Ignoring empty book group'
                     self._docStructure.groupNumber -= 1
                     self._htmlWriter.closeAndRemove()
                     self._groupHtmlOpen = False
             elif divType == self._docStructure.INTRO:
                 if self._bibleHtmlOpen:
                     self._bibleIntroWritten = True
                 elif self._groupHtmlOpen:
                     self._groupIntroWritten = True
                     
     elif name == 'figure':
         if self._inIntro:
             self._introTextFound = True
         OsisHandler.endElement(self, name)
             
     elif name == 'l':
         if self._lineSpan:
             self._writeHtml('</span>\n')
         else:
             if self._inIntro:
                 self._writeHtml('</span>')
             OsisHandler.endElement(self, name)
           
     elif name == 'note':
         if self._inFootnote:
             self._inFootnoteRef = False
         OsisHandler.endElement(self, name)
             
     elif name == 'reference':
         if self._inFootnoteRef:
             self._inFootnoteRef = False
         else:
             OsisHandler.endElement(self, name)
     
     elif name == 'title':
         if self._inTitle:
             self._inTitle = False
             if self._ignoreTitle:
                 self._ignoreTitle = False
                     
             elif self._headerProcessed:
                 titleWritten = False
                 if not self._docStructure.inBook:
                     titleWritten = self._processIntroTitle()
                 elif self._inIntro:
                     titleWritten = self._processBookIntroTitle()
                 else:
                     titleWritten = self._processScriptureTitle()                
                 if titleWritten:
                     self._breakCount = 2
                     self._psDivTitle = False
                     self._canonicalTitleWritten = False
                     if re.search('chapter', self._titleTag) is not None:
                         self._chHeadingWritten = True
             
         elif self._inCanonicalTitle:
             closingTag = ''
             if self._context.canonicalClassDefined:
                 closingTag = '</span>'
             else:
                 closingTag = '</i>' 
             self._inCanonicalTitle = False
             self._writeHtml(closingTag + '<br />\n')
             self._breakCount = 1
             self._canonicalTitleWritten = True
             if self._docStructure.verse != '':
                 self._inVerse = True
                 self._verseEmpty = True
                 if self._chTitleWritten or self._docStructure.verse != '1':
                     self._verseText = '<sup>' + self._docStructure.verse + '</sup>'
                     self._verseNumWritten = True
                     
         elif self._inChapterTitle:
             chAttribute =''
             if not self._chHeadingWritten:
                 chAttribute = 'chapter="%s" ' % self._docStructure.chapter
             self._chapterTitle = '<h3 %s class="x-chapter-title">%s</h3>' % (chAttribute, self._chapterTitle)
             if self._chFootnoteMarker != '':
                 self._chapterTitle += self._chFootnoteMarker
                 self._chFootnoteMarker = ''
             self._chapterTitle += '<br />'
             self._chHeadingWritten = True
             self._inChapterTitle = False
             
     else:
         OsisHandler.endElement(self, name)