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.
25 lines
686 B
25 lines
686 B
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from songbook_core.content import Content
|
|
|
|
KEYWORDS = [
|
|
"songchapter",
|
|
"songsection",
|
|
]
|
|
|
|
class SongSection(Content):
|
|
def __init__(self, keyword, name):
|
|
self.keyword = keyword
|
|
self.name = name
|
|
|
|
def render(self, __context):
|
|
return r'\{}{{{}}}'.format(self.keyword, self.name)
|
|
|
|
def parse(keyword, config, *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])
|
|
|