From 11f49258d3a39c91d62879c00597ff552b9bb9e2 Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Fri, 13 Nov 2015 10:46:31 +0100 Subject: [PATCH 01/10] Change test_parser extensions --- patacrep/songs/chordpro/__init__.py | 10 +-- test/test_chordpro/{00.sgc => 00.csg} | 0 .../{00.source => 00.csg.source} | 0 test/test_chordpro/{00.tex => 00.tsg} | 0 test/test_chordpro/{01.sgc => 01.csg} | 0 .../{01.source => 01.csg.source} | 0 test/test_chordpro/{01.tex => 01.tsg} | 0 test/test_chordpro/{02.sgc => 02.csg} | 0 .../{02.source => 02.csg.source} | 0 test/test_chordpro/{02.tex => 02.tsg} | 0 test/test_chordpro/{03.sgc => 03.csg} | 0 .../{03.source => 03.csg.source} | 0 test/test_chordpro/{03.tex => 03.tsg} | 0 test/test_chordpro/{04.sgc => 04.csg} | 0 .../{04.source => 04.csg.source} | 0 test/test_chordpro/{04.tex => 04.tsg} | 0 test/test_chordpro/{05.sgc => 05.csg} | 0 .../{05.source => 05.csg.source} | 0 test/test_chordpro/{05.tex => 05.tsg} | 0 test/test_chordpro/{06.sgc => 06.csg} | 0 .../{06.source => 06.csg.source} | 0 test/test_chordpro/{06.tex => 06.tsg} | 0 test/test_chordpro/{07.sgc => 07.csg} | 0 .../{07.source => 07.csg.source} | 0 test/test_chordpro/{07.tex => 07.tsg} | 0 test/test_chordpro/{08.sgc => 08.csg} | 0 .../{08.source => 08.csg.source} | 0 test/test_chordpro/{08.tex => 08.tsg} | 0 test/test_chordpro/{09.sgc => 09.csg} | 0 .../{09.source => 09.csg.source} | 0 test/test_chordpro/{09.tex => 09.tsg} | 0 test/test_chordpro/{10.sgc => 10.csg} | 0 .../{10.source => 10.csg.source} | 0 test/test_chordpro/{10.tex => 10.tsg} | 0 test/test_chordpro/{11.sgc => 11.csg} | 0 .../{11.source => 11.csg.source} | 0 test/test_chordpro/{11.tex => 11.tsg} | 0 test/test_chordpro/{12.sgc => 12.csg} | 0 .../{12.source => 12.csg.source} | 0 test/test_chordpro/{12.tex => 12.tsg} | 0 test/test_chordpro/{13.sgc => 13.csg} | 0 .../{13.source => 13.csg.source} | 0 test/test_chordpro/{13.tex => 13.tsg} | 0 test/test_chordpro/{21.sgc => 21.csg} | 0 .../{21.source => 21.csg.source} | 0 test/test_chordpro/{21.tex => 21.tsg} | 0 test/test_chordpro/{22.sgc => 22.csg} | 0 .../{22.source => 22.csg.source} | 0 test/test_chordpro/{22.tex => 22.tsg} | 0 test/test_chordpro/{23.sgc => 23.csg} | 0 .../{23.source => 23.csg.source} | 0 test/test_chordpro/{23.tex => 23.tsg} | 0 test/test_chordpro/{24.sgc => 24.csg} | 0 .../{24.source => 24.csg.source} | 0 test/test_chordpro/{24.tex => 24.tsg} | 0 test/test_chordpro/{25.sgc => 25.csg} | 0 .../{25.source => 25.csg.source} | 0 test/test_chordpro/{25.tex => 25.tsg} | 0 test/test_chordpro/{26.sgc => 26.csg} | 0 .../{26.source => 26.csg.source} | 0 test/test_chordpro/{26.tex => 26.tsg} | 0 test/test_chordpro/{27.sgc => 27.csg} | 0 .../{27.source => 27.csg.source} | 0 test/test_chordpro/{27.tex => 27.tsg} | 0 test/test_chordpro/{28.sgc => 28.csg} | 0 .../{28.source => 28.csg.source} | 0 test/test_chordpro/{28.tex => 28.tsg} | 0 test/test_chordpro/{29.sgc => 29.csg} | 0 .../{29.source => 29.csg.source} | 0 test/test_chordpro/{29.tex => 29.tsg} | 0 .../{author_names.sgc => author_names.csg} | 0 ...r_names.source => author_names.csg.source} | 0 .../{author_names.tex => author_names.tsg} | 0 test/test_chordpro/{chords.sgc => chords.csg} | 0 .../{chords.source => chords.csg.source} | 0 test/test_chordpro/{chords.tex => chords.tsg} | 0 .../{customchords.sgc => customchords.csg} | 0 ...mchords.source => customchords.csg.source} | 0 .../{customchords.tex => customchords.tsg} | 0 ...tent.source => invalid_content.csg.source} | 0 .../{greensleeves.sgc => greensleeves.csg} | 0 ...sleeves.source => greensleeves.csg.source} | 0 .../{greensleeves.tex => greensleeves.tsg} | 0 .../{invalid_chord.sgc => invalid_chord.csg} | 0 ..._chord.source => invalid_chord.csg.source} | 0 .../{invalid_chord.tex => invalid_chord.tsg} | 0 ...ustomchord.sgc => invalid_customchord.csg} | 0 ....source => invalid_customchord.csg.source} | 0 ...ustomchord.tex => invalid_customchord.tsg} | 0 ...id_directive.sgc => invalid_directive.csg} | 0 ...ve.source => invalid_directive.csg.source} | 0 ...id_directive.tex => invalid_directive.tsg} | 0 test/test_chordpro/{lang.sgc => lang.csg} | 0 .../{lang.source => lang.csg.source} | 0 .../{metadata.sgc => metadata.csg} | 0 .../{metadata.source => metadata.csg.source} | 0 .../{metadata.tex => metadata.tsg} | 0 .../{newline.crlf.sgc => newline.crlf.csg} | 0 test/test_chordpro/newline.crlf.csg.source | 2 + test/test_chordpro/newline.crlf.source | 2 - .../{newline.crlf.tex => newline.crlf.tsg} | 0 .../{newline.sgc => newline.csg} | 0 .../{newline.source => newline.csg.source} | 0 .../{newline.tex => newline.tsg} | 0 .../{nolyrics.sgc => nolyrics.csg} | 0 .../{nolyrics.source => nolyrics.csg.source} | 0 .../{nolyrics.tex => nolyrics.tsg} | 0 test/test_chordpro/{tags.sgc => tags.csg} | 0 .../{tags.source => tags.csg.source} | 0 test/test_chordpro/{tags.tex => tags.tsg} | 0 test/test_chordpro/test_parser.py | 69 +++++++++---------- .../{ukulelechords.sgc => ukulelechords.csg} | 0 ...chords.source => ukulelechords.csg.source} | 0 .../{ukulelechords.tex => ukulelechords.tsg} | 0 114 files changed, 41 insertions(+), 42 deletions(-) rename test/test_chordpro/{00.sgc => 00.csg} (100%) rename test/test_chordpro/{00.source => 00.csg.source} (100%) rename test/test_chordpro/{00.tex => 00.tsg} (100%) rename test/test_chordpro/{01.sgc => 01.csg} (100%) rename test/test_chordpro/{01.source => 01.csg.source} (100%) rename test/test_chordpro/{01.tex => 01.tsg} (100%) rename test/test_chordpro/{02.sgc => 02.csg} (100%) rename test/test_chordpro/{02.source => 02.csg.source} (100%) rename test/test_chordpro/{02.tex => 02.tsg} (100%) rename test/test_chordpro/{03.sgc => 03.csg} (100%) rename test/test_chordpro/{03.source => 03.csg.source} (100%) rename test/test_chordpro/{03.tex => 03.tsg} (100%) rename test/test_chordpro/{04.sgc => 04.csg} (100%) rename test/test_chordpro/{04.source => 04.csg.source} (100%) rename test/test_chordpro/{04.tex => 04.tsg} (100%) rename test/test_chordpro/{05.sgc => 05.csg} (100%) rename test/test_chordpro/{05.source => 05.csg.source} (100%) rename test/test_chordpro/{05.tex => 05.tsg} (100%) rename test/test_chordpro/{06.sgc => 06.csg} (100%) rename test/test_chordpro/{06.source => 06.csg.source} (100%) rename test/test_chordpro/{06.tex => 06.tsg} (100%) rename test/test_chordpro/{07.sgc => 07.csg} (100%) rename test/test_chordpro/{07.source => 07.csg.source} (100%) rename test/test_chordpro/{07.tex => 07.tsg} (100%) rename test/test_chordpro/{08.sgc => 08.csg} (100%) rename test/test_chordpro/{08.source => 08.csg.source} (100%) rename test/test_chordpro/{08.tex => 08.tsg} (100%) rename test/test_chordpro/{09.sgc => 09.csg} (100%) rename test/test_chordpro/{09.source => 09.csg.source} (100%) rename test/test_chordpro/{09.tex => 09.tsg} (100%) rename test/test_chordpro/{10.sgc => 10.csg} (100%) rename test/test_chordpro/{10.source => 10.csg.source} (100%) rename test/test_chordpro/{10.tex => 10.tsg} (100%) rename test/test_chordpro/{11.sgc => 11.csg} (100%) rename test/test_chordpro/{11.source => 11.csg.source} (100%) rename test/test_chordpro/{11.tex => 11.tsg} (100%) rename test/test_chordpro/{12.sgc => 12.csg} (100%) rename test/test_chordpro/{12.source => 12.csg.source} (100%) rename test/test_chordpro/{12.tex => 12.tsg} (100%) rename test/test_chordpro/{13.sgc => 13.csg} (100%) rename test/test_chordpro/{13.source => 13.csg.source} (100%) rename test/test_chordpro/{13.tex => 13.tsg} (100%) rename test/test_chordpro/{21.sgc => 21.csg} (100%) rename test/test_chordpro/{21.source => 21.csg.source} (100%) rename test/test_chordpro/{21.tex => 21.tsg} (100%) rename test/test_chordpro/{22.sgc => 22.csg} (100%) rename test/test_chordpro/{22.source => 22.csg.source} (100%) rename test/test_chordpro/{22.tex => 22.tsg} (100%) rename test/test_chordpro/{23.sgc => 23.csg} (100%) rename test/test_chordpro/{23.source => 23.csg.source} (100%) rename test/test_chordpro/{23.tex => 23.tsg} (100%) rename test/test_chordpro/{24.sgc => 24.csg} (100%) rename test/test_chordpro/{24.source => 24.csg.source} (100%) rename test/test_chordpro/{24.tex => 24.tsg} (100%) rename test/test_chordpro/{25.sgc => 25.csg} (100%) rename test/test_chordpro/{25.source => 25.csg.source} (100%) rename test/test_chordpro/{25.tex => 25.tsg} (100%) rename test/test_chordpro/{26.sgc => 26.csg} (100%) rename test/test_chordpro/{26.source => 26.csg.source} (100%) rename test/test_chordpro/{26.tex => 26.tsg} (100%) rename test/test_chordpro/{27.sgc => 27.csg} (100%) rename test/test_chordpro/{27.source => 27.csg.source} (100%) rename test/test_chordpro/{27.tex => 27.tsg} (100%) rename test/test_chordpro/{28.sgc => 28.csg} (100%) rename test/test_chordpro/{28.source => 28.csg.source} (100%) rename test/test_chordpro/{28.tex => 28.tsg} (100%) rename test/test_chordpro/{29.sgc => 29.csg} (100%) rename test/test_chordpro/{29.source => 29.csg.source} (100%) rename test/test_chordpro/{29.tex => 29.tsg} (100%) rename test/test_chordpro/{author_names.sgc => author_names.csg} (100%) rename test/test_chordpro/{author_names.source => author_names.csg.source} (100%) rename test/test_chordpro/{author_names.tex => author_names.tsg} (100%) rename test/test_chordpro/{chords.sgc => chords.csg} (100%) rename test/test_chordpro/{chords.source => chords.csg.source} (100%) rename test/test_chordpro/{chords.tex => chords.tsg} (100%) rename test/test_chordpro/{customchords.sgc => customchords.csg} (100%) rename test/test_chordpro/{customchords.source => customchords.csg.source} (100%) rename test/test_chordpro/{customchords.tex => customchords.tsg} (100%) rename test/test_chordpro/errors/{invalid_content.source => invalid_content.csg.source} (100%) rename test/test_chordpro/{greensleeves.sgc => greensleeves.csg} (100%) rename test/test_chordpro/{greensleeves.source => greensleeves.csg.source} (100%) rename test/test_chordpro/{greensleeves.tex => greensleeves.tsg} (100%) rename test/test_chordpro/{invalid_chord.sgc => invalid_chord.csg} (100%) rename test/test_chordpro/{invalid_chord.source => invalid_chord.csg.source} (100%) rename test/test_chordpro/{invalid_chord.tex => invalid_chord.tsg} (100%) rename test/test_chordpro/{invalid_customchord.sgc => invalid_customchord.csg} (100%) rename test/test_chordpro/{invalid_customchord.source => invalid_customchord.csg.source} (100%) rename test/test_chordpro/{invalid_customchord.tex => invalid_customchord.tsg} (100%) rename test/test_chordpro/{invalid_directive.sgc => invalid_directive.csg} (100%) rename test/test_chordpro/{invalid_directive.source => invalid_directive.csg.source} (100%) rename test/test_chordpro/{invalid_directive.tex => invalid_directive.tsg} (100%) rename test/test_chordpro/{lang.sgc => lang.csg} (100%) rename test/test_chordpro/{lang.source => lang.csg.source} (100%) rename test/test_chordpro/{metadata.sgc => metadata.csg} (100%) rename test/test_chordpro/{metadata.source => metadata.csg.source} (100%) rename test/test_chordpro/{metadata.tex => metadata.tsg} (100%) rename test/test_chordpro/{newline.crlf.sgc => newline.crlf.csg} (100%) create mode 100644 test/test_chordpro/newline.crlf.csg.source delete mode 100644 test/test_chordpro/newline.crlf.source rename test/test_chordpro/{newline.crlf.tex => newline.crlf.tsg} (100%) rename test/test_chordpro/{newline.sgc => newline.csg} (100%) rename test/test_chordpro/{newline.source => newline.csg.source} (100%) rename test/test_chordpro/{newline.tex => newline.tsg} (100%) rename test/test_chordpro/{nolyrics.sgc => nolyrics.csg} (100%) rename test/test_chordpro/{nolyrics.source => nolyrics.csg.source} (100%) rename test/test_chordpro/{nolyrics.tex => nolyrics.tsg} (100%) rename test/test_chordpro/{tags.sgc => tags.csg} (100%) rename test/test_chordpro/{tags.source => tags.csg.source} (100%) rename test/test_chordpro/{tags.tex => tags.tsg} (100%) rename test/test_chordpro/{ukulelechords.sgc => ukulelechords.csg} (100%) rename test/test_chordpro/{ukulelechords.source => ukulelechords.csg.source} (100%) rename test/test_chordpro/{ukulelechords.tex => ukulelechords.tsg} (100%) diff --git a/patacrep/songs/chordpro/__init__.py b/patacrep/songs/chordpro/__init__.py index 330b2f3e..5777b170 100644 --- a/patacrep/songs/chordpro/__init__.py +++ b/patacrep/songs/chordpro/__init__.py @@ -131,13 +131,13 @@ class Chordpro2ChordproSong(ChordproSong): return filename SONG_RENDERERS = { - "latex": { - 'sgc': Chordpro2LatexSong, + "tsg": { + 'csg': Chordpro2LatexSong, }, "html": { - 'sgc': Chordpro2HtmlSong, + 'csg': Chordpro2HtmlSong, }, - "chordpro": { - 'sgc': Chordpro2ChordproSong, + "csg": { + 'csg': Chordpro2ChordproSong, }, } diff --git a/test/test_chordpro/00.sgc b/test/test_chordpro/00.csg similarity index 100% rename from test/test_chordpro/00.sgc rename to test/test_chordpro/00.csg diff --git a/test/test_chordpro/00.source b/test/test_chordpro/00.csg.source similarity index 100% rename from test/test_chordpro/00.source rename to test/test_chordpro/00.csg.source diff --git a/test/test_chordpro/00.tex b/test/test_chordpro/00.tsg similarity index 100% rename from test/test_chordpro/00.tex rename to test/test_chordpro/00.tsg diff --git a/test/test_chordpro/01.sgc b/test/test_chordpro/01.csg similarity index 100% rename from test/test_chordpro/01.sgc rename to test/test_chordpro/01.csg diff --git a/test/test_chordpro/01.source b/test/test_chordpro/01.csg.source similarity index 100% rename from test/test_chordpro/01.source rename to test/test_chordpro/01.csg.source diff --git a/test/test_chordpro/01.tex b/test/test_chordpro/01.tsg similarity index 100% rename from test/test_chordpro/01.tex rename to test/test_chordpro/01.tsg diff --git a/test/test_chordpro/02.sgc b/test/test_chordpro/02.csg similarity index 100% rename from test/test_chordpro/02.sgc rename to test/test_chordpro/02.csg diff --git a/test/test_chordpro/02.source b/test/test_chordpro/02.csg.source similarity index 100% rename from test/test_chordpro/02.source rename to test/test_chordpro/02.csg.source diff --git a/test/test_chordpro/02.tex b/test/test_chordpro/02.tsg similarity index 100% rename from test/test_chordpro/02.tex rename to test/test_chordpro/02.tsg diff --git a/test/test_chordpro/03.sgc b/test/test_chordpro/03.csg similarity index 100% rename from test/test_chordpro/03.sgc rename to test/test_chordpro/03.csg diff --git a/test/test_chordpro/03.source b/test/test_chordpro/03.csg.source similarity index 100% rename from test/test_chordpro/03.source rename to test/test_chordpro/03.csg.source diff --git a/test/test_chordpro/03.tex b/test/test_chordpro/03.tsg similarity index 100% rename from test/test_chordpro/03.tex rename to test/test_chordpro/03.tsg diff --git a/test/test_chordpro/04.sgc b/test/test_chordpro/04.csg similarity index 100% rename from test/test_chordpro/04.sgc rename to test/test_chordpro/04.csg diff --git a/test/test_chordpro/04.source b/test/test_chordpro/04.csg.source similarity index 100% rename from test/test_chordpro/04.source rename to test/test_chordpro/04.csg.source diff --git a/test/test_chordpro/04.tex b/test/test_chordpro/04.tsg similarity index 100% rename from test/test_chordpro/04.tex rename to test/test_chordpro/04.tsg diff --git a/test/test_chordpro/05.sgc b/test/test_chordpro/05.csg similarity index 100% rename from test/test_chordpro/05.sgc rename to test/test_chordpro/05.csg diff --git a/test/test_chordpro/05.source b/test/test_chordpro/05.csg.source similarity index 100% rename from test/test_chordpro/05.source rename to test/test_chordpro/05.csg.source diff --git a/test/test_chordpro/05.tex b/test/test_chordpro/05.tsg similarity index 100% rename from test/test_chordpro/05.tex rename to test/test_chordpro/05.tsg diff --git a/test/test_chordpro/06.sgc b/test/test_chordpro/06.csg similarity index 100% rename from test/test_chordpro/06.sgc rename to test/test_chordpro/06.csg diff --git a/test/test_chordpro/06.source b/test/test_chordpro/06.csg.source similarity index 100% rename from test/test_chordpro/06.source rename to test/test_chordpro/06.csg.source diff --git a/test/test_chordpro/06.tex b/test/test_chordpro/06.tsg similarity index 100% rename from test/test_chordpro/06.tex rename to test/test_chordpro/06.tsg diff --git a/test/test_chordpro/07.sgc b/test/test_chordpro/07.csg similarity index 100% rename from test/test_chordpro/07.sgc rename to test/test_chordpro/07.csg diff --git a/test/test_chordpro/07.source b/test/test_chordpro/07.csg.source similarity index 100% rename from test/test_chordpro/07.source rename to test/test_chordpro/07.csg.source diff --git a/test/test_chordpro/07.tex b/test/test_chordpro/07.tsg similarity index 100% rename from test/test_chordpro/07.tex rename to test/test_chordpro/07.tsg diff --git a/test/test_chordpro/08.sgc b/test/test_chordpro/08.csg similarity index 100% rename from test/test_chordpro/08.sgc rename to test/test_chordpro/08.csg diff --git a/test/test_chordpro/08.source b/test/test_chordpro/08.csg.source similarity index 100% rename from test/test_chordpro/08.source rename to test/test_chordpro/08.csg.source diff --git a/test/test_chordpro/08.tex b/test/test_chordpro/08.tsg similarity index 100% rename from test/test_chordpro/08.tex rename to test/test_chordpro/08.tsg diff --git a/test/test_chordpro/09.sgc b/test/test_chordpro/09.csg similarity index 100% rename from test/test_chordpro/09.sgc rename to test/test_chordpro/09.csg diff --git a/test/test_chordpro/09.source b/test/test_chordpro/09.csg.source similarity index 100% rename from test/test_chordpro/09.source rename to test/test_chordpro/09.csg.source diff --git a/test/test_chordpro/09.tex b/test/test_chordpro/09.tsg similarity index 100% rename from test/test_chordpro/09.tex rename to test/test_chordpro/09.tsg diff --git a/test/test_chordpro/10.sgc b/test/test_chordpro/10.csg similarity index 100% rename from test/test_chordpro/10.sgc rename to test/test_chordpro/10.csg diff --git a/test/test_chordpro/10.source b/test/test_chordpro/10.csg.source similarity index 100% rename from test/test_chordpro/10.source rename to test/test_chordpro/10.csg.source diff --git a/test/test_chordpro/10.tex b/test/test_chordpro/10.tsg similarity index 100% rename from test/test_chordpro/10.tex rename to test/test_chordpro/10.tsg diff --git a/test/test_chordpro/11.sgc b/test/test_chordpro/11.csg similarity index 100% rename from test/test_chordpro/11.sgc rename to test/test_chordpro/11.csg diff --git a/test/test_chordpro/11.source b/test/test_chordpro/11.csg.source similarity index 100% rename from test/test_chordpro/11.source rename to test/test_chordpro/11.csg.source diff --git a/test/test_chordpro/11.tex b/test/test_chordpro/11.tsg similarity index 100% rename from test/test_chordpro/11.tex rename to test/test_chordpro/11.tsg diff --git a/test/test_chordpro/12.sgc b/test/test_chordpro/12.csg similarity index 100% rename from test/test_chordpro/12.sgc rename to test/test_chordpro/12.csg diff --git a/test/test_chordpro/12.source b/test/test_chordpro/12.csg.source similarity index 100% rename from test/test_chordpro/12.source rename to test/test_chordpro/12.csg.source diff --git a/test/test_chordpro/12.tex b/test/test_chordpro/12.tsg similarity index 100% rename from test/test_chordpro/12.tex rename to test/test_chordpro/12.tsg diff --git a/test/test_chordpro/13.sgc b/test/test_chordpro/13.csg similarity index 100% rename from test/test_chordpro/13.sgc rename to test/test_chordpro/13.csg diff --git a/test/test_chordpro/13.source b/test/test_chordpro/13.csg.source similarity index 100% rename from test/test_chordpro/13.source rename to test/test_chordpro/13.csg.source diff --git a/test/test_chordpro/13.tex b/test/test_chordpro/13.tsg similarity index 100% rename from test/test_chordpro/13.tex rename to test/test_chordpro/13.tsg diff --git a/test/test_chordpro/21.sgc b/test/test_chordpro/21.csg similarity index 100% rename from test/test_chordpro/21.sgc rename to test/test_chordpro/21.csg diff --git a/test/test_chordpro/21.source b/test/test_chordpro/21.csg.source similarity index 100% rename from test/test_chordpro/21.source rename to test/test_chordpro/21.csg.source diff --git a/test/test_chordpro/21.tex b/test/test_chordpro/21.tsg similarity index 100% rename from test/test_chordpro/21.tex rename to test/test_chordpro/21.tsg diff --git a/test/test_chordpro/22.sgc b/test/test_chordpro/22.csg similarity index 100% rename from test/test_chordpro/22.sgc rename to test/test_chordpro/22.csg diff --git a/test/test_chordpro/22.source b/test/test_chordpro/22.csg.source similarity index 100% rename from test/test_chordpro/22.source rename to test/test_chordpro/22.csg.source diff --git a/test/test_chordpro/22.tex b/test/test_chordpro/22.tsg similarity index 100% rename from test/test_chordpro/22.tex rename to test/test_chordpro/22.tsg diff --git a/test/test_chordpro/23.sgc b/test/test_chordpro/23.csg similarity index 100% rename from test/test_chordpro/23.sgc rename to test/test_chordpro/23.csg diff --git a/test/test_chordpro/23.source b/test/test_chordpro/23.csg.source similarity index 100% rename from test/test_chordpro/23.source rename to test/test_chordpro/23.csg.source diff --git a/test/test_chordpro/23.tex b/test/test_chordpro/23.tsg similarity index 100% rename from test/test_chordpro/23.tex rename to test/test_chordpro/23.tsg diff --git a/test/test_chordpro/24.sgc b/test/test_chordpro/24.csg similarity index 100% rename from test/test_chordpro/24.sgc rename to test/test_chordpro/24.csg diff --git a/test/test_chordpro/24.source b/test/test_chordpro/24.csg.source similarity index 100% rename from test/test_chordpro/24.source rename to test/test_chordpro/24.csg.source diff --git a/test/test_chordpro/24.tex b/test/test_chordpro/24.tsg similarity index 100% rename from test/test_chordpro/24.tex rename to test/test_chordpro/24.tsg diff --git a/test/test_chordpro/25.sgc b/test/test_chordpro/25.csg similarity index 100% rename from test/test_chordpro/25.sgc rename to test/test_chordpro/25.csg diff --git a/test/test_chordpro/25.source b/test/test_chordpro/25.csg.source similarity index 100% rename from test/test_chordpro/25.source rename to test/test_chordpro/25.csg.source diff --git a/test/test_chordpro/25.tex b/test/test_chordpro/25.tsg similarity index 100% rename from test/test_chordpro/25.tex rename to test/test_chordpro/25.tsg diff --git a/test/test_chordpro/26.sgc b/test/test_chordpro/26.csg similarity index 100% rename from test/test_chordpro/26.sgc rename to test/test_chordpro/26.csg diff --git a/test/test_chordpro/26.source b/test/test_chordpro/26.csg.source similarity index 100% rename from test/test_chordpro/26.source rename to test/test_chordpro/26.csg.source diff --git a/test/test_chordpro/26.tex b/test/test_chordpro/26.tsg similarity index 100% rename from test/test_chordpro/26.tex rename to test/test_chordpro/26.tsg diff --git a/test/test_chordpro/27.sgc b/test/test_chordpro/27.csg similarity index 100% rename from test/test_chordpro/27.sgc rename to test/test_chordpro/27.csg diff --git a/test/test_chordpro/27.source b/test/test_chordpro/27.csg.source similarity index 100% rename from test/test_chordpro/27.source rename to test/test_chordpro/27.csg.source diff --git a/test/test_chordpro/27.tex b/test/test_chordpro/27.tsg similarity index 100% rename from test/test_chordpro/27.tex rename to test/test_chordpro/27.tsg diff --git a/test/test_chordpro/28.sgc b/test/test_chordpro/28.csg similarity index 100% rename from test/test_chordpro/28.sgc rename to test/test_chordpro/28.csg diff --git a/test/test_chordpro/28.source b/test/test_chordpro/28.csg.source similarity index 100% rename from test/test_chordpro/28.source rename to test/test_chordpro/28.csg.source diff --git a/test/test_chordpro/28.tex b/test/test_chordpro/28.tsg similarity index 100% rename from test/test_chordpro/28.tex rename to test/test_chordpro/28.tsg diff --git a/test/test_chordpro/29.sgc b/test/test_chordpro/29.csg similarity index 100% rename from test/test_chordpro/29.sgc rename to test/test_chordpro/29.csg diff --git a/test/test_chordpro/29.source b/test/test_chordpro/29.csg.source similarity index 100% rename from test/test_chordpro/29.source rename to test/test_chordpro/29.csg.source diff --git a/test/test_chordpro/29.tex b/test/test_chordpro/29.tsg similarity index 100% rename from test/test_chordpro/29.tex rename to test/test_chordpro/29.tsg diff --git a/test/test_chordpro/author_names.sgc b/test/test_chordpro/author_names.csg similarity index 100% rename from test/test_chordpro/author_names.sgc rename to test/test_chordpro/author_names.csg diff --git a/test/test_chordpro/author_names.source b/test/test_chordpro/author_names.csg.source similarity index 100% rename from test/test_chordpro/author_names.source rename to test/test_chordpro/author_names.csg.source diff --git a/test/test_chordpro/author_names.tex b/test/test_chordpro/author_names.tsg similarity index 100% rename from test/test_chordpro/author_names.tex rename to test/test_chordpro/author_names.tsg diff --git a/test/test_chordpro/chords.sgc b/test/test_chordpro/chords.csg similarity index 100% rename from test/test_chordpro/chords.sgc rename to test/test_chordpro/chords.csg diff --git a/test/test_chordpro/chords.source b/test/test_chordpro/chords.csg.source similarity index 100% rename from test/test_chordpro/chords.source rename to test/test_chordpro/chords.csg.source diff --git a/test/test_chordpro/chords.tex b/test/test_chordpro/chords.tsg similarity index 100% rename from test/test_chordpro/chords.tex rename to test/test_chordpro/chords.tsg diff --git a/test/test_chordpro/customchords.sgc b/test/test_chordpro/customchords.csg similarity index 100% rename from test/test_chordpro/customchords.sgc rename to test/test_chordpro/customchords.csg diff --git a/test/test_chordpro/customchords.source b/test/test_chordpro/customchords.csg.source similarity index 100% rename from test/test_chordpro/customchords.source rename to test/test_chordpro/customchords.csg.source diff --git a/test/test_chordpro/customchords.tex b/test/test_chordpro/customchords.tsg similarity index 100% rename from test/test_chordpro/customchords.tex rename to test/test_chordpro/customchords.tsg diff --git a/test/test_chordpro/errors/invalid_content.source b/test/test_chordpro/errors/invalid_content.csg.source similarity index 100% rename from test/test_chordpro/errors/invalid_content.source rename to test/test_chordpro/errors/invalid_content.csg.source diff --git a/test/test_chordpro/greensleeves.sgc b/test/test_chordpro/greensleeves.csg similarity index 100% rename from test/test_chordpro/greensleeves.sgc rename to test/test_chordpro/greensleeves.csg diff --git a/test/test_chordpro/greensleeves.source b/test/test_chordpro/greensleeves.csg.source similarity index 100% rename from test/test_chordpro/greensleeves.source rename to test/test_chordpro/greensleeves.csg.source diff --git a/test/test_chordpro/greensleeves.tex b/test/test_chordpro/greensleeves.tsg similarity index 100% rename from test/test_chordpro/greensleeves.tex rename to test/test_chordpro/greensleeves.tsg diff --git a/test/test_chordpro/invalid_chord.sgc b/test/test_chordpro/invalid_chord.csg similarity index 100% rename from test/test_chordpro/invalid_chord.sgc rename to test/test_chordpro/invalid_chord.csg diff --git a/test/test_chordpro/invalid_chord.source b/test/test_chordpro/invalid_chord.csg.source similarity index 100% rename from test/test_chordpro/invalid_chord.source rename to test/test_chordpro/invalid_chord.csg.source diff --git a/test/test_chordpro/invalid_chord.tex b/test/test_chordpro/invalid_chord.tsg similarity index 100% rename from test/test_chordpro/invalid_chord.tex rename to test/test_chordpro/invalid_chord.tsg diff --git a/test/test_chordpro/invalid_customchord.sgc b/test/test_chordpro/invalid_customchord.csg similarity index 100% rename from test/test_chordpro/invalid_customchord.sgc rename to test/test_chordpro/invalid_customchord.csg diff --git a/test/test_chordpro/invalid_customchord.source b/test/test_chordpro/invalid_customchord.csg.source similarity index 100% rename from test/test_chordpro/invalid_customchord.source rename to test/test_chordpro/invalid_customchord.csg.source diff --git a/test/test_chordpro/invalid_customchord.tex b/test/test_chordpro/invalid_customchord.tsg similarity index 100% rename from test/test_chordpro/invalid_customchord.tex rename to test/test_chordpro/invalid_customchord.tsg diff --git a/test/test_chordpro/invalid_directive.sgc b/test/test_chordpro/invalid_directive.csg similarity index 100% rename from test/test_chordpro/invalid_directive.sgc rename to test/test_chordpro/invalid_directive.csg diff --git a/test/test_chordpro/invalid_directive.source b/test/test_chordpro/invalid_directive.csg.source similarity index 100% rename from test/test_chordpro/invalid_directive.source rename to test/test_chordpro/invalid_directive.csg.source diff --git a/test/test_chordpro/invalid_directive.tex b/test/test_chordpro/invalid_directive.tsg similarity index 100% rename from test/test_chordpro/invalid_directive.tex rename to test/test_chordpro/invalid_directive.tsg diff --git a/test/test_chordpro/lang.sgc b/test/test_chordpro/lang.csg similarity index 100% rename from test/test_chordpro/lang.sgc rename to test/test_chordpro/lang.csg diff --git a/test/test_chordpro/lang.source b/test/test_chordpro/lang.csg.source similarity index 100% rename from test/test_chordpro/lang.source rename to test/test_chordpro/lang.csg.source diff --git a/test/test_chordpro/metadata.sgc b/test/test_chordpro/metadata.csg similarity index 100% rename from test/test_chordpro/metadata.sgc rename to test/test_chordpro/metadata.csg diff --git a/test/test_chordpro/metadata.source b/test/test_chordpro/metadata.csg.source similarity index 100% rename from test/test_chordpro/metadata.source rename to test/test_chordpro/metadata.csg.source diff --git a/test/test_chordpro/metadata.tex b/test/test_chordpro/metadata.tsg similarity index 100% rename from test/test_chordpro/metadata.tex rename to test/test_chordpro/metadata.tsg diff --git a/test/test_chordpro/newline.crlf.sgc b/test/test_chordpro/newline.crlf.csg similarity index 100% rename from test/test_chordpro/newline.crlf.sgc rename to test/test_chordpro/newline.crlf.csg diff --git a/test/test_chordpro/newline.crlf.csg.source b/test/test_chordpro/newline.crlf.csg.source new file mode 100644 index 00000000..2071e66d --- /dev/null +++ b/test/test_chordpro/newline.crlf.csg.source @@ -0,0 +1,2 @@ +# This content will be overwritten with `newline.csg.source` content +# with windows line endings (CRLF) - for testing purposes diff --git a/test/test_chordpro/newline.crlf.source b/test/test_chordpro/newline.crlf.source deleted file mode 100644 index bd45d5ce..00000000 --- a/test/test_chordpro/newline.crlf.source +++ /dev/null @@ -1,2 +0,0 @@ -# This content will be overwritten with `newline.source` content -# with windows line endings (CRLF) - for testing purposes diff --git a/test/test_chordpro/newline.crlf.tex b/test/test_chordpro/newline.crlf.tsg similarity index 100% rename from test/test_chordpro/newline.crlf.tex rename to test/test_chordpro/newline.crlf.tsg diff --git a/test/test_chordpro/newline.sgc b/test/test_chordpro/newline.csg similarity index 100% rename from test/test_chordpro/newline.sgc rename to test/test_chordpro/newline.csg diff --git a/test/test_chordpro/newline.source b/test/test_chordpro/newline.csg.source similarity index 100% rename from test/test_chordpro/newline.source rename to test/test_chordpro/newline.csg.source diff --git a/test/test_chordpro/newline.tex b/test/test_chordpro/newline.tsg similarity index 100% rename from test/test_chordpro/newline.tex rename to test/test_chordpro/newline.tsg diff --git a/test/test_chordpro/nolyrics.sgc b/test/test_chordpro/nolyrics.csg similarity index 100% rename from test/test_chordpro/nolyrics.sgc rename to test/test_chordpro/nolyrics.csg diff --git a/test/test_chordpro/nolyrics.source b/test/test_chordpro/nolyrics.csg.source similarity index 100% rename from test/test_chordpro/nolyrics.source rename to test/test_chordpro/nolyrics.csg.source diff --git a/test/test_chordpro/nolyrics.tex b/test/test_chordpro/nolyrics.tsg similarity index 100% rename from test/test_chordpro/nolyrics.tex rename to test/test_chordpro/nolyrics.tsg diff --git a/test/test_chordpro/tags.sgc b/test/test_chordpro/tags.csg similarity index 100% rename from test/test_chordpro/tags.sgc rename to test/test_chordpro/tags.csg diff --git a/test/test_chordpro/tags.source b/test/test_chordpro/tags.csg.source similarity index 100% rename from test/test_chordpro/tags.source rename to test/test_chordpro/tags.csg.source diff --git a/test/test_chordpro/tags.tex b/test/test_chordpro/tags.tsg similarity index 100% rename from test/test_chordpro/tags.tex rename to test/test_chordpro/tags.tsg diff --git a/test/test_chordpro/test_parser.py b/test/test_chordpro/test_parser.py index 5d8a64da..9ebe3e00 100644 --- a/test/test_chordpro/test_parser.py +++ b/test/test_chordpro/test_parser.py @@ -15,17 +15,13 @@ from patacrep.encoding import open_read from .. import disable_logging from .. import dynamic # pylint: disable=unused-import -LANGUAGES = { - 'tex': 'latex', - 'sgc': 'chordpro', - 'html': 'html', -} +OUTPUTS = ['csg', 'tsg', 'html'] class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): """Test of chorpro parser, and several renderers. For any given `foo.source`, it is parsed as a chordpro file, and should be - rendered as `foo.sgc` with the chordpro renderer, and `foo.tex` with the + rendered as `foo.csg` with the chordpro renderer, and `foo.tsg` with the latex renderer. This class does nothing by itself, but its metaclass populates it with test @@ -50,15 +46,15 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): with files.chdir(resource_filename(__name__, ""), *path): yield - def assertRender(self, base, destformat): # pylint: disable=invalid-name - """Assert that `{base}.source` is correctly rendered in the `destformat`. + def assertRender(self, base, in_format, out_format): # pylint: disable=invalid-name + """Assert that `{base}.source` is correctly rendered in the `out_format`. """ - sourcename = "{}.source".format(base) - destname = "{}.{}".format(base, destformat) + sourcename = "{}.{}.source".format(base, in_format) + destname = "{}.{}".format(base, out_format) with self.chdir(): with open_read(destname) as expectfile: with disable_logging(): - song = self.song_plugins[LANGUAGES[destformat]]['sgc'](sourcename, self.config) + song = self.song_plugins[out_format][in_format](sourcename, self.config) self.assertMultiLineEqual( song.render().strip(), expectfile.read().strip(), @@ -79,45 +75,47 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): keyword='SONG_RENDERERS', ) with cls.chdir(): - for source in sorted(glob.glob('*.source')): - base = source[:-len(".source")] - for dest in LANGUAGES: - destname = "{}.{}".format(base, dest) - if not os.path.exists(destname): + for source in sorted(glob.glob('*.*.source')): + [*base, in_format, _] = source.split('.') + base = '.'.join(base) + for out_format in OUTPUTS: + outname = "{}.{}".format(base, out_format) + if not os.path.exists(outname): continue yield ( - "test_{}_{}".format(base, dest), - cls._create_test(base, dest), + "test_{}_{}_2_{}".format(base, in_format, out_format), + cls._create_test(base, in_format, out_format), ) with cls.chdir('errors'): - for source in sorted(glob.glob('*.source')): - base = source[:-len(".source")] + for source in sorted(glob.glob('*.*.source')): + [*base, in_format, _] = source.split('.') + base = '.'.join(base) yield ( - "test_{}_failure".format(base), - cls._create_failure(base), + "test_{}_{}_failure".format(base, in_format), + cls._create_failure(base, in_format), ) @classmethod - def _create_test(cls, base, dest): - """Return a function testing that `base` compilation in `dest` format. + def _create_test(cls, base, in_format, out_format): + """Return a function testing that `base` compilation in `out_format` format. """ - test_parse_render = lambda self: self.assertRender(base, dest) + test_parse_render = lambda self: self.assertRender(base, in_format, out_format) test_parse_render.__doc__ = ( - "Test that '{base}' is correctly parsed and rendererd into '{format}' format." - ).format(base=os.path.basename(base), format=dest) + "Test that '{base}.{in_format}' is correctly parsed and rendererd into '{out_format}'." + ).format(base=os.path.basename(base), in_format=in_format, out_format=out_format) return test_parse_render @classmethod - def _create_failure(cls, base): + def _create_failure(cls, base, in_format, out_format='tsg'): """Return a function testing that `base` parsing fails. """ def test_parse_failure(self): """Test that `base` parsing fails.""" - sourcename = "{}.source".format(base) + sourcename = "{}.{}.source".format(base, in_format) with self.chdir('errors'): - parser = self.song_plugins[LANGUAGES['sgc']]['sgc'] + parser = self.song_plugins[out_format][in_format] self.assertRaises(SyntaxError, parser, sourcename, self.config) test_parse_failure.__doc__ = ( @@ -130,9 +128,9 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): """Overwrite `*.crlf.source` files to force the CRLF line endings. """ with cls.chdir(): - for crlfname in sorted(glob.glob('*.crlf.source')): - base = crlfname[:-len(".crlf.source")] - sourcename = base + ".source" + for crlfname in sorted(glob.glob('*.crlf.*.source')): + [*base, _, in_format, source] = crlfname.split('.') + sourcename = '.'.join(base + [in_format, source]) with open_read(sourcename) as sourcefile: with open(crlfname, 'w') as crlffile: for line in sourcefile: @@ -146,7 +144,8 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): # with windows line endings (CRLF) - for testing purposes """ with cls.chdir(): - for crlfname in sorted(glob.glob('*.crlf.source')): - base = crlfname[:-len(".crlf.source")] + for crlfname in sorted(glob.glob('*.crlf.*.source')): + [*base, crlf, in_format, _] = crlfname.split('.') + base = '.'.join(base + [in_format]) with open(crlfname, 'w') as crlffile: crlffile.write(crlf_msg.format(base)) diff --git a/test/test_chordpro/ukulelechords.sgc b/test/test_chordpro/ukulelechords.csg similarity index 100% rename from test/test_chordpro/ukulelechords.sgc rename to test/test_chordpro/ukulelechords.csg diff --git a/test/test_chordpro/ukulelechords.source b/test/test_chordpro/ukulelechords.csg.source similarity index 100% rename from test/test_chordpro/ukulelechords.source rename to test/test_chordpro/ukulelechords.csg.source diff --git a/test/test_chordpro/ukulelechords.tex b/test/test_chordpro/ukulelechords.tsg similarity index 100% rename from test/test_chordpro/ukulelechords.tex rename to test/test_chordpro/ukulelechords.tsg From 312b63df60320bc3f96a83d6022d9483011da83c Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Fri, 13 Nov 2015 11:10:42 +0100 Subject: [PATCH 02/10] Change test_compilation extensions --- patacrep/build.py | 2 +- patacrep/content/tex.py | 4 +-- patacrep/songbook/__main__.py | 2 +- patacrep/songs/latex/__init__.py | 6 ++-- test/test_compilation/datadir.tex.control | 30 +++++++++---------- .../songs/{datadir.sgc => datadir.csg} | 0 .../songs/{datadir.sg => datadir.tsg} | 0 .../songs/{datadir2.sgc => datadir2.csg} | 0 .../songs/{datadir2.sg => datadir2.tsg} | 0 .../songs/{relative.sgc => relative.csg} | 0 .../songs/{relative.sg => relative.tsg} | 0 .../songs/subdir/{subdir.sgc => subdir.csg} | 0 .../songs/subdir/{subdir.sg => subdir.tsg} | 0 test/test_compilation/languages.tex.control | 10 +++---- .../songs/{language.sgc => language.csg} | 0 ...age_location.sgc => language_location.csg} | 0 .../{no_language.sgc => no_language.csg} | 0 ...{wrong_language.sgc => wrong_language.csg} | 0 ...{wrong_location.sgc => wrong_location.csg} | 0 test/test_compilation/syntax.tex.control | 2 +- .../songs/{musicnote.sgc => musicnote.csg} | 0 test/test_compilation/unicode.tex.control | 2 +- .../songs/{nonbreak.sgc => nonbreak.csg} | 0 23 files changed, 29 insertions(+), 29 deletions(-) rename test/test_compilation/datadir_datadir/songs/{datadir.sgc => datadir.csg} (100%) rename test/test_compilation/datadir_datadir/songs/{datadir.sg => datadir.tsg} (100%) rename test/test_compilation/datadir_datadir/songs/{datadir2.sgc => datadir2.csg} (100%) rename test/test_compilation/datadir_datadir/songs/{datadir2.sg => datadir2.tsg} (100%) rename test/test_compilation/datadir_datadir/songs/{relative.sgc => relative.csg} (100%) rename test/test_compilation/datadir_datadir/songs/{relative.sg => relative.tsg} (100%) rename test/test_compilation/datadir_datadir/songs/subdir/{subdir.sgc => subdir.csg} (100%) rename test/test_compilation/datadir_datadir/songs/subdir/{subdir.sg => subdir.tsg} (100%) rename test/test_compilation/languages_datadir/songs/{language.sgc => language.csg} (100%) rename test/test_compilation/languages_datadir/songs/{language_location.sgc => language_location.csg} (100%) rename test/test_compilation/languages_datadir/songs/{no_language.sgc => no_language.csg} (100%) rename test/test_compilation/languages_datadir/songs/{wrong_language.sgc => wrong_language.csg} (100%) rename test/test_compilation/languages_datadir/songs/{wrong_location.sgc => wrong_location.csg} (100%) rename test/test_compilation/syntax_datadir/songs/{musicnote.sgc => musicnote.csg} (100%) rename test/test_compilation/unicode_datadir/songs/{nonbreak.sgc => nonbreak.csg} (100%) diff --git a/patacrep/build.py b/patacrep/build.py index 0342959b..0526d5c2 100644 --- a/patacrep/build.py +++ b/patacrep/build.py @@ -109,7 +109,7 @@ class Songbook(object): datadirs=config.get('datadir', []), root_modules=['songs'], keyword='SONG_RENDERERS', - )['latex'] + )['tsg'] # Configuration set config['render'] = content.render diff --git a/patacrep/content/tex.py b/patacrep/content/tex.py index 0f520c19..badf58e6 100755 --- a/patacrep/content/tex.py +++ b/patacrep/content/tex.py @@ -33,7 +33,7 @@ def parse(keyword, argument, contentlist, config): """ if not contentlist: LOGGER.warning( - "Useless 'tex' content: list of files to include is empty." + "Useless 'tsg' content: list of files to include is empty." ) filelist = [] basefolders = itertools.chain( @@ -62,4 +62,4 @@ def parse(keyword, argument, contentlist, config): return filelist -CONTENT_PLUGINS = {'tex': parse} +CONTENT_PLUGINS = {'tsg': parse} diff --git a/patacrep/songbook/__main__.py b/patacrep/songbook/__main__.py index 004f3e95..d049cccb 100644 --- a/patacrep/songbook/__main__.py +++ b/patacrep/songbook/__main__.py @@ -153,7 +153,7 @@ def main(): # Command line options datadirs += [item[0] for item in options.datadir] if 'datadir' in songbook: - # .sg file + # .tsg file if isinstance(songbook['datadir'], str): songbook['datadir'] = [songbook['datadir']] datadirs += [ diff --git a/patacrep/songs/latex/__init__.py b/patacrep/songs/latex/__init__.py index d19cd10e..c9359f1c 100644 --- a/patacrep/songs/latex/__init__.py +++ b/patacrep/songs/latex/__init__.py @@ -49,9 +49,9 @@ class Latex2LatexSong(Song): self.lang = custom_lang SONG_RENDERERS = { - "latex": { - 'is': Latex2LatexSong, - 'sg': Latex2LatexSong, + "tsg": { + 'tis': Latex2LatexSong, + 'tsg': Latex2LatexSong, }, } diff --git a/test/test_compilation/datadir.tex.control b/test/test_compilation/datadir.tex.control index 14b11cb1..1df14c15 100644 --- a/test/test_compilation/datadir.tex.control +++ b/test/test_compilation/datadir.tex.control @@ -90,12 +90,7 @@ guitar, \begin{songs}{titleidx,authidx} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% songs/./datadir.sg - -\import{@TEST_FOLDER@/datadir_datadir/songs/}{datadir.sg} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% songs/./datadir.sgc +%% songs/./datadir.csg \selectlanguage{english} @@ -117,12 +112,12 @@ Chordpro}[ \endsong %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% songs/./datadir2.sg +%% songs/./datadir.tsg -\import{@TEST_FOLDER@/datadir_datadir/songs/}{datadir2.sg} +\import{@TEST_FOLDER@/datadir_datadir/songs/}{datadir.tsg} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% songs/./datadir2.sgc +%% songs/./datadir2.csg \selectlanguage{english} @@ -144,12 +139,12 @@ Chordpro}[ \endsong %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% songs/./relative.sg +%% songs/./datadir2.tsg -\import{@TEST_FOLDER@/datadir_datadir/songs/}{relative.sg} +\import{@TEST_FOLDER@/datadir_datadir/songs/}{datadir2.tsg} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% songs/./relative.sgc +%% songs/./relative.csg \selectlanguage{english} @@ -171,12 +166,12 @@ Chordpro}[ \endsong %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% songs/./subdir/subdir.sg +%% songs/./relative.tsg -\import{@TEST_FOLDER@/datadir_datadir/songs/subdir/}{subdir.sg} +\import{@TEST_FOLDER@/datadir_datadir/songs/}{relative.tsg} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% songs/./subdir/subdir.sgc +%% songs/./subdir/subdir.csg \selectlanguage{english} @@ -197,6 +192,11 @@ Chordpro}[ \endsong +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% songs/./subdir/subdir.tsg + +\import{@TEST_FOLDER@/datadir_datadir/songs/subdir/}{subdir.tsg} + \end{songs} diff --git a/test/test_compilation/datadir_datadir/songs/datadir.sgc b/test/test_compilation/datadir_datadir/songs/datadir.csg similarity index 100% rename from test/test_compilation/datadir_datadir/songs/datadir.sgc rename to test/test_compilation/datadir_datadir/songs/datadir.csg diff --git a/test/test_compilation/datadir_datadir/songs/datadir.sg b/test/test_compilation/datadir_datadir/songs/datadir.tsg similarity index 100% rename from test/test_compilation/datadir_datadir/songs/datadir.sg rename to test/test_compilation/datadir_datadir/songs/datadir.tsg diff --git a/test/test_compilation/datadir_datadir/songs/datadir2.sgc b/test/test_compilation/datadir_datadir/songs/datadir2.csg similarity index 100% rename from test/test_compilation/datadir_datadir/songs/datadir2.sgc rename to test/test_compilation/datadir_datadir/songs/datadir2.csg diff --git a/test/test_compilation/datadir_datadir/songs/datadir2.sg b/test/test_compilation/datadir_datadir/songs/datadir2.tsg similarity index 100% rename from test/test_compilation/datadir_datadir/songs/datadir2.sg rename to test/test_compilation/datadir_datadir/songs/datadir2.tsg diff --git a/test/test_compilation/datadir_datadir/songs/relative.sgc b/test/test_compilation/datadir_datadir/songs/relative.csg similarity index 100% rename from test/test_compilation/datadir_datadir/songs/relative.sgc rename to test/test_compilation/datadir_datadir/songs/relative.csg diff --git a/test/test_compilation/datadir_datadir/songs/relative.sg b/test/test_compilation/datadir_datadir/songs/relative.tsg similarity index 100% rename from test/test_compilation/datadir_datadir/songs/relative.sg rename to test/test_compilation/datadir_datadir/songs/relative.tsg diff --git a/test/test_compilation/datadir_datadir/songs/subdir/subdir.sgc b/test/test_compilation/datadir_datadir/songs/subdir/subdir.csg similarity index 100% rename from test/test_compilation/datadir_datadir/songs/subdir/subdir.sgc rename to test/test_compilation/datadir_datadir/songs/subdir/subdir.csg diff --git a/test/test_compilation/datadir_datadir/songs/subdir/subdir.sg b/test/test_compilation/datadir_datadir/songs/subdir/subdir.tsg similarity index 100% rename from test/test_compilation/datadir_datadir/songs/subdir/subdir.sg rename to test/test_compilation/datadir_datadir/songs/subdir/subdir.tsg diff --git a/test/test_compilation/languages.tex.control b/test/test_compilation/languages.tex.control index 59c233a7..6f08614f 100644 --- a/test/test_compilation/languages.tex.control +++ b/test/test_compilation/languages.tex.control @@ -91,7 +91,7 @@ guitar, \begin{songs}{titleidx,authidx} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% songs/./language.sgc +%% songs/./language.csg \selectlanguage{english} @@ -110,7 +110,7 @@ guitar, \endsong %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% songs/./language_location.sgc +%% songs/./language_location.csg \selectlanguage{french} @@ -129,7 +129,7 @@ guitar, \endsong %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% songs/./no_language.sgc +%% songs/./no_language.csg \selectlanguage{english} @@ -148,7 +148,7 @@ guitar, \endsong %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% songs/./wrong_language.sgc +%% songs/./wrong_language.csg \selectlanguage{english} @@ -167,7 +167,7 @@ guitar, \endsong %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% songs/./wrong_location.sgc +%% songs/./wrong_location.csg \selectlanguage{spanish} diff --git a/test/test_compilation/languages_datadir/songs/language.sgc b/test/test_compilation/languages_datadir/songs/language.csg similarity index 100% rename from test/test_compilation/languages_datadir/songs/language.sgc rename to test/test_compilation/languages_datadir/songs/language.csg diff --git a/test/test_compilation/languages_datadir/songs/language_location.sgc b/test/test_compilation/languages_datadir/songs/language_location.csg similarity index 100% rename from test/test_compilation/languages_datadir/songs/language_location.sgc rename to test/test_compilation/languages_datadir/songs/language_location.csg diff --git a/test/test_compilation/languages_datadir/songs/no_language.sgc b/test/test_compilation/languages_datadir/songs/no_language.csg similarity index 100% rename from test/test_compilation/languages_datadir/songs/no_language.sgc rename to test/test_compilation/languages_datadir/songs/no_language.csg diff --git a/test/test_compilation/languages_datadir/songs/wrong_language.sgc b/test/test_compilation/languages_datadir/songs/wrong_language.csg similarity index 100% rename from test/test_compilation/languages_datadir/songs/wrong_language.sgc rename to test/test_compilation/languages_datadir/songs/wrong_language.csg diff --git a/test/test_compilation/languages_datadir/songs/wrong_location.sgc b/test/test_compilation/languages_datadir/songs/wrong_location.csg similarity index 100% rename from test/test_compilation/languages_datadir/songs/wrong_location.sgc rename to test/test_compilation/languages_datadir/songs/wrong_location.csg diff --git a/test/test_compilation/syntax.tex.control b/test/test_compilation/syntax.tex.control index 6f213ef2..b2147b06 100644 --- a/test/test_compilation/syntax.tex.control +++ b/test/test_compilation/syntax.tex.control @@ -88,7 +88,7 @@ guitar, \begin{songs}{titleidx,authidx} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% songs/./musicnote.sgc +%% songs/./musicnote.csg \selectlanguage{english} diff --git a/test/test_compilation/syntax_datadir/songs/musicnote.sgc b/test/test_compilation/syntax_datadir/songs/musicnote.csg similarity index 100% rename from test/test_compilation/syntax_datadir/songs/musicnote.sgc rename to test/test_compilation/syntax_datadir/songs/musicnote.csg diff --git a/test/test_compilation/unicode.tex.control b/test/test_compilation/unicode.tex.control index 9c8e946d..759a15d8 100644 --- a/test/test_compilation/unicode.tex.control +++ b/test/test_compilation/unicode.tex.control @@ -88,7 +88,7 @@ guitar, \begin{songs}{titleidx,authidx} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% songs/./nonbreak.sgc +%% songs/./nonbreak.csg \selectlanguage{english} diff --git a/test/test_compilation/unicode_datadir/songs/nonbreak.sgc b/test/test_compilation/unicode_datadir/songs/nonbreak.csg similarity index 100% rename from test/test_compilation/unicode_datadir/songs/nonbreak.sgc rename to test/test_compilation/unicode_datadir/songs/nonbreak.csg From e1e024d2ce9f102909e03b26125dc51eedbc03d1 Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Fri, 13 Nov 2015 11:14:37 +0100 Subject: [PATCH 03/10] Convert example extensions --- ...iers_de_la_table_ronde.sg => chevaliers_de_la_table_ronde.tsg} | 0 examples/songs/{example-en.sg => example-en.tsg} | 0 examples/songs/{example-fr.sg => example-fr.tsg} | 0 examples/songs/{greensleeves.sgc => greensleeves.csg} | 0 examples/songs/{greensleeves.sg => greensleeves.tsg} | 0 examples/songs/tests/{chords.sgc => chords.csg} | 0 examples/songs/tests/{errors.sgc => errors.csg} | 0 examples/songs/tests/{newline.sgc => newline.csg} | 0 examples/songs/tests/{nolyrics.sgc => nolyrics.csg} | 0 examples/songs/{vent_frais.sg => vent_frais.tsg} | 0 10 files changed, 0 insertions(+), 0 deletions(-) rename examples/songs/{chevaliers_de_la_table_ronde.sg => chevaliers_de_la_table_ronde.tsg} (100%) rename examples/songs/{example-en.sg => example-en.tsg} (100%) rename examples/songs/{example-fr.sg => example-fr.tsg} (100%) rename examples/songs/{greensleeves.sgc => greensleeves.csg} (100%) rename examples/songs/{greensleeves.sg => greensleeves.tsg} (100%) rename examples/songs/tests/{chords.sgc => chords.csg} (100%) rename examples/songs/tests/{errors.sgc => errors.csg} (100%) rename examples/songs/tests/{newline.sgc => newline.csg} (100%) rename examples/songs/tests/{nolyrics.sgc => nolyrics.csg} (100%) rename examples/songs/{vent_frais.sg => vent_frais.tsg} (100%) diff --git a/examples/songs/chevaliers_de_la_table_ronde.sg b/examples/songs/chevaliers_de_la_table_ronde.tsg similarity index 100% rename from examples/songs/chevaliers_de_la_table_ronde.sg rename to examples/songs/chevaliers_de_la_table_ronde.tsg diff --git a/examples/songs/example-en.sg b/examples/songs/example-en.tsg similarity index 100% rename from examples/songs/example-en.sg rename to examples/songs/example-en.tsg diff --git a/examples/songs/example-fr.sg b/examples/songs/example-fr.tsg similarity index 100% rename from examples/songs/example-fr.sg rename to examples/songs/example-fr.tsg diff --git a/examples/songs/greensleeves.sgc b/examples/songs/greensleeves.csg similarity index 100% rename from examples/songs/greensleeves.sgc rename to examples/songs/greensleeves.csg diff --git a/examples/songs/greensleeves.sg b/examples/songs/greensleeves.tsg similarity index 100% rename from examples/songs/greensleeves.sg rename to examples/songs/greensleeves.tsg diff --git a/examples/songs/tests/chords.sgc b/examples/songs/tests/chords.csg similarity index 100% rename from examples/songs/tests/chords.sgc rename to examples/songs/tests/chords.csg diff --git a/examples/songs/tests/errors.sgc b/examples/songs/tests/errors.csg similarity index 100% rename from examples/songs/tests/errors.sgc rename to examples/songs/tests/errors.csg diff --git a/examples/songs/tests/newline.sgc b/examples/songs/tests/newline.csg similarity index 100% rename from examples/songs/tests/newline.sgc rename to examples/songs/tests/newline.csg diff --git a/examples/songs/tests/nolyrics.sgc b/examples/songs/tests/nolyrics.csg similarity index 100% rename from examples/songs/tests/nolyrics.sgc rename to examples/songs/tests/nolyrics.csg diff --git a/examples/songs/vent_frais.sg b/examples/songs/vent_frais.tsg similarity index 100% rename from examples/songs/vent_frais.sg rename to examples/songs/vent_frais.tsg From 85da39dac63e4c5ae632c9aa3e8e32d153eb68eb Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Fri, 13 Nov 2015 11:21:36 +0100 Subject: [PATCH 04/10] Syntax error in converter --- patacrep/songs/convert/__main__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patacrep/songs/convert/__main__.py b/patacrep/songs/convert/__main__.py index 2880cdab..9826ba0d 100644 --- a/patacrep/songs/convert/__main__.py +++ b/patacrep/songs/convert/__main__.py @@ -17,7 +17,7 @@ def __usage(): return "python3 -m patacrep.songs.convert INPUTFORMAT OUTPUTFORMAT FILES" def confirm(destname): - while True + while True: try: return yesno(input("File '{}' already exist. Overwrite? [yn] ".format(destname))) except ValueError: @@ -62,7 +62,7 @@ if __name__ == "__main__": if not confirm(destname): continue with open(destname, "w") as destfile: - destfile.write(song.render(dest)) + destfile.write(song.render('song')) except NotImplementedError: LOGGER.error("Cannot convert to format '%s'.", dest) From 7e8f69483bb6d0010fe69f7349d5390d53ce97bf Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Fri, 13 Nov 2015 11:25:10 +0100 Subject: [PATCH 05/10] Simplify converter --- patacrep/songs/convert/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patacrep/songs/convert/__main__.py b/patacrep/songs/convert/__main__.py index 9826ba0d..90276f7b 100644 --- a/patacrep/songs/convert/__main__.py +++ b/patacrep/songs/convert/__main__.py @@ -62,7 +62,7 @@ if __name__ == "__main__": if not confirm(destname): continue with open(destname, "w") as destfile: - destfile.write(song.render('song')) + destfile.write(song.render()) except NotImplementedError: LOGGER.error("Cannot convert to format '%s'.", dest) From 20aeae8003b54820618ad95776aa3dd5408f23fd Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Fri, 13 Nov 2015 11:31:55 +0100 Subject: [PATCH 06/10] (pylint) unused variable --- test/test_chordpro/test_parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_chordpro/test_parser.py b/test/test_chordpro/test_parser.py index 9ebe3e00..7b7db4b3 100644 --- a/test/test_chordpro/test_parser.py +++ b/test/test_chordpro/test_parser.py @@ -145,7 +145,7 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): """ with cls.chdir(): for crlfname in sorted(glob.glob('*.crlf.*.source')): - [*base, crlf, in_format, _] = crlfname.split('.') + [*base, _crlf, in_format, _] = crlfname.split('.') base = '.'.join(base + [in_format]) with open(crlfname, 'w') as crlffile: crlffile.write(crlf_msg.format(base)) From 7ee17760cde8bc9296c2314e09a7771d98ced618 Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Fri, 13 Nov 2015 13:02:34 +0100 Subject: [PATCH 07/10] Keep backward compatibility with .sg songs --- patacrep/songs/latex/__init__.py | 3 +++ test/test_compilation/datadir.tex.control | 4 ++-- .../datadir_datadir/songs/{datadir2.tsg => datadir2.sg} | 0 3 files changed, 5 insertions(+), 2 deletions(-) rename test/test_compilation/datadir_datadir/songs/{datadir2.tsg => datadir2.sg} (100%) diff --git a/patacrep/songs/latex/__init__.py b/patacrep/songs/latex/__init__.py index c9359f1c..1054f7da 100644 --- a/patacrep/songs/latex/__init__.py +++ b/patacrep/songs/latex/__init__.py @@ -52,6 +52,9 @@ SONG_RENDERERS = { "tsg": { 'tis': Latex2LatexSong, 'tsg': Latex2LatexSong, + + # For backward compatibility + 'sg': Latex2LatexSong, }, } diff --git a/test/test_compilation/datadir.tex.control b/test/test_compilation/datadir.tex.control index 1df14c15..afc99160 100644 --- a/test/test_compilation/datadir.tex.control +++ b/test/test_compilation/datadir.tex.control @@ -139,9 +139,9 @@ Chordpro}[ \endsong %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% songs/./datadir2.tsg +%% songs/./datadir2.sg -\import{@TEST_FOLDER@/datadir_datadir/songs/}{datadir2.tsg} +\import{@TEST_FOLDER@/datadir_datadir/songs/}{datadir2.sg} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% songs/./relative.csg diff --git a/test/test_compilation/datadir_datadir/songs/datadir2.tsg b/test/test_compilation/datadir_datadir/songs/datadir2.sg similarity index 100% rename from test/test_compilation/datadir_datadir/songs/datadir2.tsg rename to test/test_compilation/datadir_datadir/songs/datadir2.sg From 3b0ec365c389efeaf446ced32dc9835082085cff Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Fri, 13 Nov 2015 13:05:13 +0100 Subject: [PATCH 08/10] Keep .tex extension for templates --- patacrep/content/tex.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patacrep/content/tex.py b/patacrep/content/tex.py index badf58e6..0f520c19 100755 --- a/patacrep/content/tex.py +++ b/patacrep/content/tex.py @@ -33,7 +33,7 @@ def parse(keyword, argument, contentlist, config): """ if not contentlist: LOGGER.warning( - "Useless 'tsg' content: list of files to include is empty." + "Useless 'tex' content: list of files to include is empty." ) filelist = [] basefolders = itertools.chain( @@ -62,4 +62,4 @@ def parse(keyword, argument, contentlist, config): return filelist -CONTENT_PLUGINS = {'tsg': parse} +CONTENT_PLUGINS = {'tex': parse} From cd25a0795653337d099e49d70de82f0e63a648d7 Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Fri, 13 Nov 2015 13:05:20 +0100 Subject: [PATCH 09/10] remove useless comment --- patacrep/songbook/__main__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/patacrep/songbook/__main__.py b/patacrep/songbook/__main__.py index d049cccb..cc56311b 100644 --- a/patacrep/songbook/__main__.py +++ b/patacrep/songbook/__main__.py @@ -153,7 +153,6 @@ def main(): # Command line options datadirs += [item[0] for item in options.datadir] if 'datadir' in songbook: - # .tsg file if isinstance(songbook['datadir'], str): songbook['datadir'] = [songbook['datadir']] datadirs += [ From 9d74a41f5352a80a8554d5cb453e05279411d9df Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Fri, 13 Nov 2015 13:10:13 +0100 Subject: [PATCH 10/10] improve test_parser docstring --- test/test_chordpro/test_parser.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/test_chordpro/test_parser.py b/test/test_chordpro/test_parser.py index 7b7db4b3..cd38afcd 100644 --- a/test/test_chordpro/test_parser.py +++ b/test/test_chordpro/test_parser.py @@ -20,9 +20,12 @@ OUTPUTS = ['csg', 'tsg', 'html'] class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): """Test of chorpro parser, and several renderers. - For any given `foo.source`, it is parsed as a chordpro file, and should be - rendered as `foo.csg` with the chordpro renderer, and `foo.tsg` with the - latex renderer. + For any given `foo.input_format.source`, the file is parsed as `input_format` and + rendered as many times as a `foo.out_format` exists (if `out_format` is a supported + output format). + + For instance `foo.csg.source` (chordpro song) will be rendered as LaTeX, if a file + `foo.tsg` exitsts. The result of the rendering will be compared with the `foo.tsg` file. This class does nothing by itself, but its metaclass populates it with test methods testing parser and renderers. @@ -47,7 +50,7 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): yield def assertRender(self, base, in_format, out_format): # pylint: disable=invalid-name - """Assert that `{base}.source` is correctly rendered in the `out_format`. + """Assert that `{base}.{in_format}.source` is correctly rendered in the `out_format`. """ sourcename = "{}.{}.source".format(base, in_format) destname = "{}.{}".format(base, out_format)