1
0
Fork 0
mirror of https://github.com/Oreolek/gamebookformat.git synced 2024-05-17 00:18:20 +03:00

Fixed bugs in DOT and RTF output.

This commit is contained in:
Pelle Nilsson 2013-05-29 00:00:30 +02:00
parent f0ad6ea094
commit f01eb0a3f3
4 changed files with 13 additions and 7 deletions

View file

@ -28,15 +28,20 @@ class OutputFormat (object):
self.write_paragraph(p, shuffled_paragraphs, output)
def write_paragraph(self, paragraph, shuffled_paragraphs, output):
refs = []
def paragraph_link_render(to_paragraph, shuffled_paragraphs):
return self.load_template("paragraph_ref") % {
s = self.load_template("paragraph_ref") % {
'nr' : shuffled_paragraphs.to_nr[to_paragraph],
'from_nr' : shuffled_paragraphs.to_nr[paragraph]
};
}
refs.append(s)
return s
formatted_text = paragraph.format(shuffled_paragraphs,
paragraph_link_render)
print >> output, self.load_template("paragraph") % {
'nr' : shuffled_paragraphs.to_nr[paragraph],
'text' : paragraph.format(shuffled_paragraphs,
paragraph_link_render)
'text' : formatted_text,
'refs' : '\n'.join(refs) # hack for DOT output reallyn
},
def write_end(self, book, output):

View file

@ -0,0 +1 @@
%(refs)s

View file

View file

@ -1,4 +1,4 @@
\b %(nr)d
\b0 - %(text)s
\\
\\
\b0 - %(text)s \
\