Browse Source

Use path2posix on LaTeX path

pull/149/head
Oliverpool 9 years ago
parent
commit
a4d1091e30
  1. 2
      patacrep/content/song.py
  2. 2
      patacrep/data/ast_templates/chordpro/latex/content_image
  3. 4
      patacrep/data/ast_templates/chordpro/latex/content_partition
  4. 2
      patacrep/data/ast_templates/chordpro/latex/song
  5. 2
      patacrep/songs/chordpro/__init__.py
  6. 15
      test/test_compilation/test_compilation.py

2
patacrep/content/song.py

@ -42,7 +42,7 @@ class SongRenderer(Content):
{song}
""").format(
separator="%"*80,
path=self.song.subpath,
path=files.path2posix(self.song.subpath),
song=self.song.render(output=context['filename']),
)

2
patacrep/data/ast_templates/chordpro/latex/content_image

@ -1,5 +1,5 @@
(* block image *)
(* set image = content.argument|search_image *)
(* set image = content.argument|search_image|path2posix *)
(* if image *)
\image{(( image ))}
(*- endif *)

4
patacrep/data/ast_templates/chordpro/latex/content_partition

@ -1,6 +1,6 @@
(* block partition *)
(* set partition = content.argument|search_partition *)
(* set partition = content.argument|search_partition|path2posix *)
(* if partition *)
\lilypond{ ((- content.argument|search_partition -)) }
\lilypond{ ((- partition -)) }
(*- endif -*)
(*- endblock -*)

2
patacrep/data/ast_templates/chordpro/latex/song

@ -29,7 +29,7 @@
(* endfor *)
(* if 'cover' in metadata *)
(* block cover *)
(* set cover = metadata["cover"].argument|search_image *)
(* set cover = metadata["cover"].argument|search_image|path2posix *)
(* if cover *)
cover={(( cover ))},
(* endif *)

2
patacrep/songs/chordpro/__init__.py

@ -11,6 +11,7 @@ from patacrep.songs import Song
from patacrep.songs.chordpro.syntax import parse_song
from patacrep.templates import Renderer
from patacrep.latex import lang2babel
from patacrep.files import path2posix
LOGGER = logging.getLogger(__name__)
@ -59,6 +60,7 @@ class ChordproSong(Song):
jinjaenv.filters['search_partition'] = self.search_partition
jinjaenv.filters['lang2babel'] = lang2babel
jinjaenv.filters['sortargs'] = sort_directive_argument
jinjaenv.filters['path2posix'] = path2posix
try:
return Renderer(

15
test/test_compilation/test_compilation.py

@ -9,6 +9,7 @@ import subprocess
import unittest
from patacrep.encoding import open_read
from patacrep.files import path2posix
from .. import dynamic # pylint: disable=unused-import
@ -67,16 +68,18 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest):
expected = expectfile.read().strip()
expected = expected.replace(
"@TEST_FOLDER@",
os.path.dirname(__file__),
path2posix(os.path.dirname(__file__)),
)
expected = expected.replace(
"@DATA_FOLDER@",
subprocess.check_output(
["python", "-c", 'import patacrep, pkg_resources; print(pkg_resources.resource_filename(patacrep.__name__, "data"))'], # pylint: disable=line-too-long
universal_newlines=True,
cwd=os.path.dirname(songbook),
).strip(),
path2posix(
subprocess.check_output(
["python", "-c", 'import patacrep, pkg_resources; print(pkg_resources.resource_filename(patacrep.__name__, "data"))'], # pylint: disable=line-too-long
universal_newlines=True,
cwd=os.path.dirname(songbook),
).strip()
),
)
self.assertMultiLineEqual(

Loading…
Cancel
Save