Пример #1
0
 def get_song(self):
   if self.songbook:
     song = stemml.parse(os.path.join(os.path.dirname(self.songbook.filename), self.filename))
     if self.title != song.title:
       self.title = song.title
       self.songbook.save()
   else:
     song = stemml.parse(self.filename)
     
   self.__class__ = song.__class__
   self.__dict__.update(song.__dict__)
   return self
Пример #2
0
  def latex(self):
    import latex
    
    latexes = []
    lang    = None
    
    for song in self.songs:
      if isinstance(song, SongRef): song = stemml.parse(os.path.join(os.path.dirname(self.filename), song.filename))
      latexes.append(latex.latexify(song, 1))
      if not lang: lang = song.lang
      
    return r"""
\documentclass[%s,10pt]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[lmargin=1.0cm,rmargin=2.0cm,tmargin=1.0cm,bmargin=2.0cm]{geometry}
%s

\begin{document}

\title {%s}
\author{%s}
\date  {}
\maketitle
\vfill
%s
\tableofcontents
\pagebreak

%s


\end{document}
""" % (globdef.config.PAGE_FORMAT,
       latex.lang_iso2latex[lang],
       self.title.encode("latin"),
       self.authors.encode("latin"),
       self.comments.encode("latin"),
       r"""
\pagebreak
""".join(latexes),
       )
Пример #3
0
 def add_song(self, filename, title = None):
   if not title: title = stemml.parse(os.path.join(os.path.dirname(self.filename), filename)).title
   self.songs.append(SongRef(self, filename, title))