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} {song}
""").format( """).format(
separator="%"*80, separator="%"*80,
path=self.song.subpath, path=files.path2posix(self.song.subpath),
song=self.song.render(output=context['filename']), song=self.song.render(output=context['filename']),
) )

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

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

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

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

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

@ -29,7 +29,7 @@
(* endfor *) (* endfor *)
(* if 'cover' in metadata *) (* if 'cover' in metadata *)
(* block cover *) (* block cover *)
(* set cover = metadata["cover"].argument|search_image *) (* set cover = metadata["cover"].argument|search_image|path2posix *)
(* if cover *) (* if cover *)
cover={(( cover ))}, cover={(( cover ))},
(* endif *) (* 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.songs.chordpro.syntax import parse_song
from patacrep.templates import Renderer from patacrep.templates import Renderer
from patacrep.latex import lang2babel from patacrep.latex import lang2babel
from patacrep.files import path2posix
LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__)
@ -59,6 +60,7 @@ class ChordproSong(Song):
jinjaenv.filters['search_partition'] = self.search_partition jinjaenv.filters['search_partition'] = self.search_partition
jinjaenv.filters['lang2babel'] = lang2babel jinjaenv.filters['lang2babel'] = lang2babel
jinjaenv.filters['sortargs'] = sort_directive_argument jinjaenv.filters['sortargs'] = sort_directive_argument
jinjaenv.filters['path2posix'] = path2posix
try: try:
return Renderer( return Renderer(

15
test/test_compilation/test_compilation.py

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

Loading…
Cancel
Save