def _separated_sections(self, iterable): sections = [] accumulator = [] for line in iterable: # file terminator - X = one choice ? = multiple choice O = end of bard quest if line == b'X' or line == b'?' or line == b'O': sections.append(accumulator) return sections # section terminator elif line == b'###': sections.append(accumulator) accumulator = [] # line within section else: accumulator.append(line.decode(stories.encoding(self.story)))
def _page_command(page): with open(os.path.join(archdir, story, _page_filename(page)), 'rb') as f: return f.readline().decode(stories.encoding(story)).strip()