Browse Source

[WIP][Image size] LaTeX generation works

pull/218/head
Louis 8 years ago
parent
commit
acd13c8e3d
  1. 12
      patacrep/songs/chordpro/__init__.py
  2. 1
      test/test_song/image.csg
  3. 57
      test/test_song/image.tsg
  4. 2
      test/test_song/metadata.csg
  5. 2
      test/test_song/metadata.tsg

12
patacrep/songs/chordpro/__init__.py

@ -210,7 +210,17 @@ class Chordpro2LatexSong(ChordproSong):
@staticmethod @staticmethod
def _render_size(size): 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): class Chordpro2ChordproSong(ChordproSong):
"""Render chordpro song to chordpro code""" """Render chordpro song to chordpro code"""

1
test/test_song/image.csg

@ -37,4 +37,5 @@
{image: "image.png" } {image: "image.png" }
{image: "image with spaces.png" } {image: "image with spaces.png" }
{image: "image with spaces.png" } {image: "image with spaces.png" }
{image: "image.png" }

57
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

2
test/test_song/metadata.csg

@ -16,7 +16,7 @@
{comment: Comment} {comment: Comment}
{guitar_comment: GuitarComment} {guitar_comment: GuitarComment}
{partition: metadata_lilypond} {partition: metadata_lilypond}
{image: metadata_image} {image: "metadata_image" }
Foo Foo

2
test/test_song/metadata.tsg

@ -20,7 +20,7 @@ Subtitle5}[
\textnote{Comment} \textnote{Comment}
\musicnote{GuitarComment} \musicnote{GuitarComment}
\lilypond{scores/metadata_lilypond} \lilypond{scores/metadata_lilypond}
\image{img/metadata_image} \image[]{img/metadata_image}

Loading…
Cancel
Save