diff --git a/patacrep/songs/chordpro/__init__.py b/patacrep/songs/chordpro/__init__.py index 97302de1..1766833b 100644 --- a/patacrep/songs/chordpro/__init__.py +++ b/patacrep/songs/chordpro/__init__.py @@ -210,7 +210,17 @@ class Chordpro2LatexSong(ChordproSong): @staticmethod def _render_size(size): - return "TODO" + if size is None: + return "" + if size[0] == "size": + sizelist = [] + if size[1] != (None, None): + sizelist.append("width=" + "".join(size[1])) + if size[2] != (None, None): + sizelist.append("height=" + "".join(size[2])) + return ", ".join(sizelist) + if size[0] == "scale": + return "scale=" + size[1] class Chordpro2ChordproSong(ChordproSong): """Render chordpro song to chordpro code""" diff --git a/test/test_song/image.csg b/test/test_song/image.csg index 83631bff..6e4cb846 100644 --- a/test/test_song/image.csg +++ b/test/test_song/image.csg @@ -37,4 +37,5 @@ {image: "image.png" } {image: "image with spaces.png" } {image: "image with spaces.png" } +{image: "image.png" } diff --git a/test/test_song/image.tsg b/test/test_song/image.tsg index 1333ed77..d735095b 100644 --- a/test/test_song/image.tsg +++ b/test/test_song/image.tsg @@ -1 +1,56 @@ -TODO +\selectlanguage{english} + +\beginsong{}[ + by={ + }, +] + + +\image[]{img/image.png} +\image[]{img/image with spaces.png} + + + +\image[scale=.2]{img/image.png} +\image[scale=.20]{img/image with spaces.png} +\image[scale=1.2]{img/image.png} + + + +\image[width=2cm]{img/image.png} +\image[height=2cm]{img/image with spaces.png} +\image[width=2cm, height=1cm]{img/image.png} + + + +\image[width=2em]{img/image.png} +\image[height=2em]{img/image with spaces.png} +\image[width=2em, height=1em]{img/image.png} + + + +\image[width=50pt]{img/image.png} +\image[height=50pt]{img/image with spaces.png} +\image[width=50pt, height=100pt]{img/image.png} + + + +\image[width=2.5cm]{img/image.png} +\image[height=2.5cm]{img/image with spaces.png} +\image[width=2.5cm, height=1.5cm]{img/image.png} + + + +\image[width=3cm, height=10pt]{img/image.png} +\image[width=10pt, height=3cm]{img/image with spaces.png} +\image[]{img/image.png} + + + +\image[]{img/image.png} +\image[]{img/image with spaces.png} +\image[]{img/image with spaces.png} +\image[]{img/image.png} + + +\endsong \ No newline at end of file diff --git a/test/test_song/metadata.csg b/test/test_song/metadata.csg index 322a591b..825b8ece 100644 --- a/test/test_song/metadata.csg +++ b/test/test_song/metadata.csg @@ -16,7 +16,7 @@ {comment: Comment} {guitar_comment: GuitarComment} {partition: metadata_lilypond} -{image: metadata_image} +{image: "metadata_image" } Foo diff --git a/test/test_song/metadata.tsg b/test/test_song/metadata.tsg index 52582de4..09c768bf 100644 --- a/test/test_song/metadata.tsg +++ b/test/test_song/metadata.tsg @@ -20,7 +20,7 @@ Subtitle5}[ \textnote{Comment} \musicnote{GuitarComment} \lilypond{scores/metadata_lilypond} -\image{img/metadata_image} +\image[]{img/metadata_image}