diff --git a/patacrep/content/__init__.py b/patacrep/content/__init__.py index 3edc0cf3..12e9bed9 100755 --- a/patacrep/content/__init__.py +++ b/patacrep/content/__init__.py @@ -116,7 +116,7 @@ class ContentItem: """Return the string to end a block.""" return "" - def file_entry(self): + def to_dict(self): """Return the dict representation (as in the yaml file).""" raise NotImplementedError() diff --git a/patacrep/content/section.py b/patacrep/content/section.py index 403e2072..78776d5c 100755 --- a/patacrep/content/section.py +++ b/patacrep/content/section.py @@ -28,7 +28,7 @@ class Section(ContentItem): else: return r'\{}[{}]{{{}}}'.format(self.keyword, self.short, self.name) - def file_entry(self): + def to_dict(self): if self.short is None or self.keyword not in KEYWORDS: return {self.keyword: self.name} else: diff --git a/patacrep/content/setcounter.py b/patacrep/content/setcounter.py index 0b20b223..400ce26b 100755 --- a/patacrep/content/setcounter.py +++ b/patacrep/content/setcounter.py @@ -14,7 +14,7 @@ class CounterSetter(ContentItem): """Set the value of the counter.""" return r'\setcounter{{{}}}{{{}}}'.format(self.name, self.value) - def file_entry(self): + def to_dict(self): return {'setcounter': {'name': self.name, 'value': self.value}} #pylint: disable=unused-argument diff --git a/patacrep/content/song.py b/patacrep/content/song.py index 73ace8cf..dc35b5ae 100755 --- a/patacrep/content/song.py +++ b/patacrep/content/song.py @@ -63,7 +63,7 @@ class SongRenderer(ContentItem): """Order by song path""" return self.song.fullpath < other.song.fullpath - def file_entry(self): + def to_dict(self): return {'song': self.song.fullpath} #pylint: disable=unused-argument diff --git a/patacrep/content/songsection.py b/patacrep/content/songsection.py index 57d4e5e7..132c0666 100755 --- a/patacrep/content/songsection.py +++ b/patacrep/content/songsection.py @@ -19,7 +19,7 @@ class SongSection(ContentItem): """Render this section or chapter.""" return r'\{}{{{}}}'.format(self.keyword, self.name) - def file_entry(self): + def to_dict(self): return {self.keyword: self.name} #pylint: disable=unused-argument diff --git a/patacrep/content/tex.py b/patacrep/content/tex.py index 9346e725..ef588d04 100755 --- a/patacrep/content/tex.py +++ b/patacrep/content/tex.py @@ -20,7 +20,7 @@ class LaTeX(ContentItem): os.path.dirname(context['filename']), ))) - def file_entry(self): + def to_dict(self): return {'tex': self.filename} #pylint: disable=unused-argument diff --git a/patacrep/tools/content/__main__.py b/patacrep/tools/content/__main__.py index a2b65977..0d64c480 100644 --- a/patacrep/tools/content/__main__.py +++ b/patacrep/tools/content/__main__.py @@ -50,7 +50,7 @@ def do_content_items(namespace): yaml_dir = os.path.dirname(os.path.abspath(namespace.songbook)) ref_dir = os.path.join(yaml_dir, 'songs') content_items = [ - normalize_song_path(item.file_entry(), ref_dir) + normalize_song_path(item.to_dict(), ref_dir) for item in content_items ] sys.stdout.write(yaml.safe_dump(content_items, allow_unicode=True, default_flow_style=False)) diff --git a/test/test_content/datadir/python/content/customplugin.py b/test/test_content/datadir/python/content/customplugin.py index d579aca8..b835459c 100755 --- a/test/test_content/datadir/python/content/customplugin.py +++ b/test/test_content/datadir/python/content/customplugin.py @@ -5,7 +5,7 @@ from patacrep.content import ContentItem, ContentList, validate_parser_argument class FakeContent(ContentItem): """Fake content.""" - def file_entry(self): + def to_dict(self): return {'customname':''} def parse(keyword, argument, config): diff --git a/test/test_content/datadir_zippedcontent/python/content b/test/test_content/datadir_zippedcontent/python/content index 9c4371ff..2c5e1ee5 100644 Binary files a/test/test_content/datadir_zippedcontent/python/content and b/test/test_content/datadir_zippedcontent/python/content differ diff --git a/test/test_content/test_content.py b/test/test_content/test_content.py index 14a56800..78fef0ea 100644 --- a/test/test_content/test_content.py +++ b/test/test_content/test_content.py @@ -54,7 +54,7 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): with logging_reduced('patacrep.content.song'): expandedlist = content.process_content(sbcontent, config) - sourcelist = [cls._clean_path(elem.file_entry()) for elem in expandedlist] + sourcelist = [cls._clean_path(elem.to_dict()) for elem in expandedlist] controlname = "{}.control".format(base) if not os.path.exists(controlname):