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
701 B
25 lines
701 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, argument, contentlist, config):
|
|
if (keyword not in KEYWORDS) and (len(contentlist) != 1):
|
|
raise ContentError(keyword, "Starred section names must have exactly one argument.")
|
|
return [SongSection(keyword, *contentlist)]
|
|
|
|
|
|
CONTENT_PLUGINS = dict([(keyword, parse) for keyword in KEYWORDS])
|
|
|