|
|
@ -76,22 +76,22 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): |
|
|
|
@classmethod |
|
|
|
def _clean_path(cls, elem): |
|
|
|
"""Shorten the path relative to the `songs` directory""" |
|
|
|
if isinstance(elem, song.SongRenderer): |
|
|
|
songpath = os.path.join(os.path.dirname(__file__), 'datadir', 'songs') |
|
|
|
return files.path2posix(files.relpath(elem.song.fullpath, songpath)) |
|
|
|
|
|
|
|
elif isinstance(elem, section.Section): |
|
|
|
latex_command_classes = ( |
|
|
|
section.Section, |
|
|
|
songsection.SongSection, |
|
|
|
setcounter.CounterSetter, |
|
|
|
) |
|
|
|
if isinstance(elem, latex_command_classes): |
|
|
|
return elem.render(None)[1:] |
|
|
|
|
|
|
|
elif isinstance(elem, songsection.SongSection): |
|
|
|
return elem.render(None)[1:] |
|
|
|
elif isinstance(elem, song.SongRenderer): |
|
|
|
songpath = os.path.join(os.path.dirname(__file__), 'datadir', 'songs') |
|
|
|
return files.path2posix(files.relpath(elem.song.fullpath, songpath)) |
|
|
|
|
|
|
|
elif isinstance(elem, tex.LaTeX): |
|
|
|
return files.path2posix(elem.filename) |
|
|
|
|
|
|
|
elif isinstance(elem, setcounter.CounterSetter): |
|
|
|
return elem.render(None)[1:] |
|
|
|
|
|
|
|
else: |
|
|
|
raise Exception(elem) |
|
|
|
|
|
|
|