mirror of https://github.com/patacrep/patacrep.git
Engine for LaTeX songbooks
http://www.patacrep.com
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
660 B
26 lines
660 B
11 years ago
|
#!/usr/bin/env python
|
||
|
# -*- coding: utf-8 -*-
|
||
|
|
||
|
from songbook_core.content import Content
|
||
|
|
||
|
KEYWORDS = [
|
||
|
"songchapter",
|
||
|
"songsection",
|
||
|
]
|
||
|
|
||
|
class SongSection(Content):
|
||
|
def __init__(self, keyword):
|
||
|
self.keyword = keyword
|
||
|
self.name = name
|
||
|
|
||
|
def render(self):
|
||
|
return r'\{}{{{}}}'.format(self.keyword, self.name)
|
||
|
|
||
|
def parse(keyword, arguments):
|
||
|
if (keyword not in KEYWORDS) and (len(arguments) != 1):
|
||
|
raise ContentError(keyword, "Starred section names must have exactly one argument.")
|
||
|
return [SongSection(keyword, *arguments)]
|
||
|
|
||
|
|
||
|
CONTENT_PLUGINS = dict([(keyword, parse) for keyword in KEYWORDS])
|