Skip to content

Commit

Permalink
POC patch for generating presentation nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
thorstenb authored and rombert committed Sep 30, 2015
1 parent 279e247 commit db3c5e4
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions odpdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,10 @@ def add_child_elems(self, elems):
text_box.append(elem)
return

# special-case image frames - append to pages literally!
if isinstance(elems[0], odf_frame):
# special-case image frames and notes - append to pages
# literally!
if (isinstance(elems[0], odf_frame)
or elems[0].get_tag() == 'presentation:notes'):
for child in elems:
self._elements[-1].append(child)
else:
Expand Down Expand Up @@ -524,7 +526,28 @@ def placeholder(self):
def block_code(self, code, language=None):
para = odf_create_paragraph(style=u'md2odp-ParagraphCodeStyle')

if language is not None:
if language == 'Comment':
notes = odf_create_element('presentation:notes')

# no lang given, use plain monospace formatting
for elem in handle_whitespace(code):
if isinstance(elem, basestring):
span = odf_create_element('text:span')
span.set_text(elem)
para.append(span)
else:
para.append(elem)

frame = odf_create_text_frame(
para,
presentation_style=u'md2odp-OutlineText',
size=(u'18cm', u'25cm'),
position=(u'2cm', u'2cm'),
presentation_class=u'title')
notes.append(frame)
return ODFPartialTree.from_metrics_provider([notes], self)

elif language is not None:
# explicit lang given, use syntax highlighting
lexer = get_lexer_by_name(language)

Expand Down

0 comments on commit db3c5e4

Please sign in to comment.