James Tocknell avatar James Tocknell committed 2f1f9e5

Added songs to handlers.rst

Comments (0)

Files changed (4)


 Handlers must be an object which specifies a ``layout`` method which takes a
 theme object, which must have a ``templates`` attribute. If none of the required
 templates are given in the ``templates`` attribute, then the handler should
 .. automodule:: shinypress.handler
+Documentation for specific handlers follows:
+This handler is for songs/lyrics.
+.. automodule:: shinypress.songs
+    :members:


         raise NotImplemented
+class CannotRender(Exception):
+    """
+    Generic error for handlers to raise.
+    """
+    pass


 from itertools import groupby
 import json
-import ..handler.Handler as BaseHandler
-from ..handler import CannotRender
+from shinypress.handler import Handler as BaseHandler
+from shinypress.handler import CannotRender
-from .old_format import parse as old_parse
-from .old_format import dumps as old_dumps
-from .old_format import Verse
-from .utils import flatten, uniqc
+from shinypress.songs.old_format import parse as old_parse
+from shinypress.songs.old_format import dumps as old_dumps
+from shinypress.songs.old_format import Verse
+from shinypress.songs.utils import flatten, uniqc
 class Song(BaseHandler):
     A representation of a song.
     info = {}
     verses = {}
     ordering = {}
     def to_old_format(self, f, ordering_name=""):
-        f.write(old_dumps(self.info, Verse(
+        f.write(old_dumps(self.info, (Verse(
-            ) for verse in uniqc(flatten(self.ordering[ordering_name]))))
+            ) for verse in uniqc(flatten(self.ordering[ordering_name])))))


 # -*- coding: utf-8 -*-
-from ..text.mulitple import GreedyDualSize
-from . import Song
+from shinypress.songs import Song
 def old_to_new(old_song_file, new_json_file):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.